예제 #1
0
        public static void LoadSettingsJson(bool regenConfig = false)
        {
            configFilePath = Path.GetFullPath(Path.Combine(Application.dataPath, @"..\"));

            configFilePath = Path.Combine(configFilePath, "UserData", "NCMSettings.json");


            //If it doesn't exist, we need to gen a new one.
            if (regenConfig || !File.Exists(configFilePath))
            {
                GenNewConfig();
                return;
            }

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

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

            NCMJsonSettings temp = new NCMJsonSettings();

            config   = temp;
            isLoaded = true;

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

            SaveSettingsJson();
        }