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

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

            RegisterConfigPanel("GraphicsOptionsPanel", 1000, CoreUtils.LoadResource <GameObject>("UI/GraphicsOptionsPanel"));
        }
示例#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)})");
     }
 }
示例#4
0
        public ConfigModule()
        {
            Instance = this;

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

            ConfigState.Load();
            ConfigState.Save();
        }
示例#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);
        }
示例#6
0
 public override void OnAllModulesLoaded()
 {
     ConfigState.Save();
 }
示例#7
0
 public override void OnAllModulesLoaded()
 {
     ConfigState.Save();
     ApplyConfiguration();
 }