2023-01-24 19:31:49 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Common
|
|
|
|
{
|
|
|
|
public static class PersistentDataManager
|
|
|
|
{
|
2023-03-11 04:51:22 +00:00
|
|
|
public enum PerfectChallengeType
|
|
|
|
{
|
|
|
|
Off, // no perfect challenge
|
|
|
|
Arcade, // "arcade rule"
|
|
|
|
Legacy, // "legacy rule"
|
|
|
|
On // "megamix rule"
|
|
|
|
}
|
|
|
|
|
2023-01-24 19:31:49 +00:00
|
|
|
[NonSerialized] public static GameSettings gameSettings;
|
|
|
|
|
|
|
|
public static void CreateDefaultSettings()
|
|
|
|
{
|
2023-03-11 04:51:22 +00:00
|
|
|
gameSettings = new GameSettings(
|
2023-05-07 20:33:15 +00:00
|
|
|
true,
|
2023-03-11 04:51:22 +00:00
|
|
|
false,
|
|
|
|
1,
|
|
|
|
GlobalGameManager.DEFAULT_SCREEN_SIZES[1].width,
|
|
|
|
GlobalGameManager.DEFAULT_SCREEN_SIZES[1].height,
|
|
|
|
0.8f,
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
340,
|
2024-01-17 23:43:26 +00:00
|
|
|
48000,
|
2023-03-11 04:51:22 +00:00
|
|
|
true,
|
|
|
|
true,
|
2024-01-21 23:11:48 +00:00
|
|
|
PerfectChallengeType.Off,
|
2023-03-11 04:51:22 +00:00
|
|
|
true,
|
2023-03-12 02:56:26 +00:00
|
|
|
false,
|
|
|
|
true,
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
true,
|
2023-03-12 02:56:26 +00:00
|
|
|
true
|
2023-03-11 04:51:22 +00:00
|
|
|
);
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
// disable if platform is mac
|
|
|
|
if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
|
|
|
|
gameSettings.discordRPCEnable = false;
|
|
|
|
else
|
|
|
|
gameSettings.discordRPCEnable = true;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
gameSettings.timingDisplayComponents = new List<OverlaysManager.TimingDisplayComponent>()
|
|
|
|
{
|
2024-01-22 00:43:29 +00:00
|
|
|
OverlaysManager.TimingDisplayComponent.CreateDefaultSingle()
|
2023-03-11 04:51:22 +00:00
|
|
|
};
|
|
|
|
gameSettings.skillStarComponents = new List<OverlaysManager.SkillStarComponent>()
|
|
|
|
{
|
|
|
|
OverlaysManager.SkillStarComponent.CreateDefault()
|
|
|
|
};
|
|
|
|
gameSettings.sectionComponents = new List<OverlaysManager.SectionComponent>()
|
|
|
|
{
|
|
|
|
OverlaysManager.SectionComponent.CreateDefault()
|
|
|
|
};
|
|
|
|
|
2023-01-24 19:31:49 +00:00
|
|
|
SaveSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void LoadSettings()
|
|
|
|
{
|
|
|
|
if (File.Exists(Application.persistentDataPath + "/settings.json"))
|
|
|
|
{
|
|
|
|
string json = File.ReadAllText(Application.persistentDataPath + "/settings.json");
|
2024-02-04 06:54:32 +00:00
|
|
|
if (json == "")
|
|
|
|
{
|
|
|
|
GlobalGameManager.IsFirstBoot = true;
|
|
|
|
CreateDefaultSettings();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
try
|
|
|
|
{
|
|
|
|
gameSettings = JsonConvert.DeserializeObject<GameSettings>(json);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Debug.LogError($"Error while loading settings, creating default settings;\n{e.Message}");
|
|
|
|
GlobalGameManager.IsFirstBoot = true;
|
|
|
|
CreateDefaultSettings();
|
|
|
|
}
|
2023-01-24 19:31:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
GlobalGameManager.IsFirstBoot = true;
|
2023-01-24 19:31:49 +00:00
|
|
|
CreateDefaultSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void SaveSettings()
|
|
|
|
{
|
|
|
|
string json = JsonUtility.ToJson(gameSettings);
|
|
|
|
// save json to persistentDataPath
|
|
|
|
FileStream file = File.Create(Application.persistentDataPath + "/settings.json");
|
|
|
|
file.Write(System.Text.Encoding.ASCII.GetBytes(json), 0, json.Length);
|
|
|
|
file.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void SaveTheme(string json)
|
|
|
|
{
|
|
|
|
// save json to persistentDataPath
|
|
|
|
FileStream file = File.Create(Application.persistentDataPath + "/editorTheme.json");
|
|
|
|
file.Write(System.Text.Encoding.ASCII.GetBytes(json), 0, json.Length);
|
|
|
|
file.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public struct GameSettings
|
|
|
|
{
|
2023-03-11 04:51:22 +00:00
|
|
|
// default settings constructor
|
|
|
|
public GameSettings(
|
2023-05-07 20:33:15 +00:00
|
|
|
bool showSplash = false,
|
2023-03-11 04:51:22 +00:00
|
|
|
bool isFullscreen = false,
|
|
|
|
int resolutionIndex = 0,
|
|
|
|
int resolutionWidth = 1280,
|
|
|
|
int resolutionHeight = 720,
|
|
|
|
float masterVolume = 0.8f,
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
int dspSize = 340,
|
2023-03-11 04:51:22 +00:00
|
|
|
int sampleRate = 44100,
|
|
|
|
bool editorCursorEnable = true,
|
|
|
|
bool discordRPCEnable = true,
|
|
|
|
PerfectChallengeType perfectChallengeType = PerfectChallengeType.On,
|
|
|
|
bool isMedalOn = true,
|
|
|
|
bool timingDisplayMinMode = false,
|
2023-03-12 02:56:26 +00:00
|
|
|
bool overlaysInEditor = true,
|
|
|
|
bool letterboxBgEnable = true,
|
2023-10-27 20:19:16 +00:00
|
|
|
bool letterboxFxEnable = true,
|
|
|
|
int editorScale = 0,
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
bool scaleWScreenSize = false,
|
2024-03-22 01:37:41 +00:00
|
|
|
bool showParamTooltips = true,
|
|
|
|
bool previewNoteSounds = true
|
2023-03-11 04:51:22 +00:00
|
|
|
)
|
|
|
|
{
|
2023-05-07 20:33:15 +00:00
|
|
|
this.showSplash = showSplash;
|
2023-03-11 04:51:22 +00:00
|
|
|
this.isFullscreen = isFullscreen;
|
|
|
|
|
|
|
|
this.resolutionIndex = resolutionIndex;
|
|
|
|
this.resolutionWidth = resolutionWidth;
|
|
|
|
this.resolutionHeight = resolutionHeight;
|
|
|
|
|
|
|
|
this.masterVolume = masterVolume;
|
|
|
|
this.dspSize = dspSize;
|
|
|
|
this.sampleRate = sampleRate;
|
|
|
|
|
|
|
|
this.editorCursorEnable = editorCursorEnable;
|
|
|
|
if (Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor)
|
|
|
|
this.discordRPCEnable = false;
|
|
|
|
else
|
|
|
|
this.discordRPCEnable = true;
|
2023-10-27 20:19:16 +00:00
|
|
|
this.editorScale = editorScale;
|
|
|
|
this.scaleWScreenSize = scaleWScreenSize;
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
this.showParamTooltips = showParamTooltips;
|
2024-03-22 01:37:41 +00:00
|
|
|
this.previewNoteSounds = previewNoteSounds;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
this.perfectChallengeType = perfectChallengeType;
|
|
|
|
this.isMedalOn = isMedalOn;
|
|
|
|
this.timingDisplayMinMode = timingDisplayMinMode;
|
|
|
|
this.overlaysInEditor = overlaysInEditor;
|
2023-03-12 02:56:26 +00:00
|
|
|
this.letterboxBgEnable = true;
|
|
|
|
this.letterboxFxEnable = true;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
this.timingDisplayComponents = new List<OverlaysManager.TimingDisplayComponent>()
|
|
|
|
{
|
|
|
|
OverlaysManager.TimingDisplayComponent.CreateDefaultDual()
|
|
|
|
};
|
|
|
|
this.skillStarComponents = new List<OverlaysManager.SkillStarComponent>()
|
|
|
|
{
|
|
|
|
OverlaysManager.SkillStarComponent.CreateDefault()
|
|
|
|
};
|
|
|
|
this.sectionComponents = new List<OverlaysManager.SectionComponent>()
|
|
|
|
{
|
|
|
|
OverlaysManager.SectionComponent.CreateDefault()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-24 19:31:49 +00:00
|
|
|
// Display / Audio Settings
|
2023-05-07 20:33:15 +00:00
|
|
|
public bool showSplash;
|
2023-01-24 19:31:49 +00:00
|
|
|
public bool isFullscreen;
|
|
|
|
|
|
|
|
public int resolutionIndex;
|
|
|
|
public int resolutionWidth;
|
|
|
|
public int resolutionHeight;
|
|
|
|
|
|
|
|
public float masterVolume;
|
2023-03-11 04:51:22 +00:00
|
|
|
public int dspSize;
|
|
|
|
public int sampleRate;
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
// Editor Settings
|
|
|
|
public bool editorCursorEnable;
|
|
|
|
public bool discordRPCEnable;
|
2023-10-27 20:19:16 +00:00
|
|
|
public int editorScale;
|
|
|
|
public bool scaleWScreenSize;
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
public bool showParamTooltips;
|
2024-03-22 01:37:41 +00:00
|
|
|
public bool previewNoteSounds;
|
Advanced Blocks (#720)
* play sfx and play animation blocks
i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial
* count in rework + preloading, multisound addition
multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol
new Count-In and Play SFX block preloads sfx now!! epic.
* prefab-ify event properties, Button EntityType
* things are very nearly working!
however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
* okay it's WORKING now
i just need to do some better dropdown stuff
* ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
* about to make a struct + class, tooltip improvements
gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend
* finishing up, probably one more commit after this
* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle
* grah it's ALMOST DONE
* it's 99.9% finished.
just some touch ups, i don't think i even know of any bugs
* alright, looks like that's all the bugs gone
* EVERYTHING IS FINISHED!!
2024-02-26 01:46:23 +00:00
|
|
|
// public bool showCornerTooltips;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
// Gameplay Settings
|
|
|
|
public PerfectChallengeType perfectChallengeType;
|
|
|
|
public bool isMedalOn;
|
|
|
|
public bool timingDisplayMinMode;
|
|
|
|
public bool overlaysInEditor;
|
2023-03-12 02:56:26 +00:00
|
|
|
public bool letterboxBgEnable;
|
|
|
|
public bool letterboxFxEnable;
|
2023-03-11 04:51:22 +00:00
|
|
|
public List<OverlaysManager.TimingDisplayComponent> timingDisplayComponents;
|
|
|
|
public List<OverlaysManager.SkillStarComponent> skillStarComponents;
|
|
|
|
public List<OverlaysManager.SectionComponent> sectionComponents;
|
2024-01-22 00:43:29 +00:00
|
|
|
// public List<OverlaysManager.DurationComponent> durationComponents;
|
|
|
|
// public List<OverlaysManager.WordJudgementComponent> wordJudgementComponents;
|
2023-01-24 19:31:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|