Example #1
0
        public static void LoadConfigJson(bool regenConfig = false)
        {
            //If it doesn't exist, we need to gen a new one.
            if (regenConfig || !File.Exists(configFilePath))
            {
                //Gen new config will autoload the new config.
                GenNewConfig();
                return;
            }

            try {
                config = JsonUtility.FromJson <DPConfigJson>(File.ReadAllText(configFilePath));
            } catch (Exception e) {
                Debug.LogError(e);
            }

            isLoaded = true;


            foreach (var pendingAction in pendingActions)
            {
                pendingAction();
            }
            //pendingActions.Clear();
        }
Example #2
0
        private static void GenNewConfig()
        {
            Debug.Log("Generating new configuration file...");

            config   = new DPConfigJson();
            isLoaded = true;

            if (File.Exists(configFilePath))
            {
                File.Delete(configFilePath);
            }

            SaveSettingsJson();
        }