Beispiel #1
0
        public ConfigModule()
        {
            Instance = this;

            ConfigState.Load();
            ConfigState.Save();
        }
Beispiel #2
0
        public override void OnAllModulesLoaded()
        {
            ConfigState.Save();
            ApplyConfiguration();

            RegisterConfigPanel("GraphicsOptionsPanel", 1000, CoreUtils.LoadResource <GameObject>("UI/GraphicsOptionsPanel"));
        }
Beispiel #3
0
 //our first "migration": sets LastMigratedVersion if not already set
 private static void MigrateLastMigratedVersion(ConfigState cs)
 {
     if (cs.LastMigratedVersion == null)
     {
         cs.LastMigratedVersion = CoreParams.GetCurrentVersion();
         Debug.Log($"[ConfigState] Migrated to {cs.LastMigratedVersion} ({nameof(MigrateLastMigratedVersion)})");
     }
 }
Beispiel #4
0
        public ConfigModule()
        {
            Instance = this;

            RegisterConfigPanel("GraphicsOptionsPanel", 1000, CoreUtils.LoadResource <GameObject>("UI/GraphicsOptionsPanel"));

            ConfigState.Load();
            ConfigState.Save();
        }
Beispiel #5
0
        public static void Load()
        {
            try
            {
                //backup the config file first
                try
                {
                    if (File.Exists(Path))
                    {
                        File.Copy(Path, System.IO.Path.Combine(CoreParams.PersistentDataPath, "config.backup.json"), true);
                    }
                }
                catch (Exception)
                {
                }

                Instance = CoreUtils.LoadExternalJson <ConfigState>(Path);
            }
            catch (Exception e)
            {
                Debug.LogError("[Config] Failed to load config from file, using defaults");
                Debug.LogException(e);
                try
                {
                    if (File.Exists(Path))
                    {
                        DebugUtils.TextWrite(File.ReadAllText(Path), "brokenconfig");
                    }
                }
                catch (Exception)
                {
                }
            }

            if (Instance == null)
            {
                Instance = new ConfigState();
            }

            MigrateLastMigratedVersion(Instance);
        }
Beispiel #6
0
 public override void OnAllModulesLoaded()
 {
     ConfigState.Save();
 }
Beispiel #7
0
 public override void OnAllModulesLoaded()
 {
     ConfigState.Save();
     ApplyConfiguration();
 }