Ejemplo n.º 1
0
        public bool Load(string filepath = "")
        {
            if (!String.IsNullOrEmpty(filepath))
            {
                FilePath = filepath;
            }

            // Load config file
            if (File.Exists(Defines.ConfigFile))
            {
                configTable = Toml.ReadFile(Defines.ConfigFile).ToDictionary();

                if (configTable.ContainsKey(Defines.KeyConfig))
                {
                    InputMonitor.SetKeys((Dictionary <string, object>)configTable[Defines.KeyConfig]);
                }
                if (configTable.ContainsKey(Defines.TouchConfig))
                {
                    TouchSettings.SetConfig((Dictionary <string, object>)configTable[Defines.TouchConfig]);
                }
                if (configTable.ContainsKey(Defines.GameConfig))
                {
                    GameSettingsScreen.SetConfig((Dictionary <string, object>)configTable[Defines.GameConfig]);
                }
            }
            else
            {
                // Build defaults
            }
            return(true);
        }
Ejemplo n.º 2
0
 public void ResetGameSettings()
 {
     configTable = Toml.ReadFile(Defines.ConfigFile).ToDictionary();
     if (configTable.ContainsKey(Defines.GameConfig))
     {
         GameSettingsScreen.SetConfig((Dictionary <string, object>)configTable[Defines.GameConfig]);
     }
 }
Ejemplo n.º 3
0
 public void Update()
 {
     configTable = new Dictionary <string, object>()
     {
         { Defines.KeyConfig, InputMonitor.GetConfig() },
         { Defines.TouchConfig, TouchSettings.GetConfig() },
         { Defines.GameConfig, GameSettingsScreen.GetConfig() }
     };
 }
Ejemplo n.º 4
0
        public void Save(string filepath = "")
        {
            if (!String.IsNullOrEmpty(filepath))
            {
                FilePath = filepath;
            }

            var data = new Dictionary <string, object>()
            {
                { Defines.KeyConfig, InputMonitor.GetConfig() },
                { Defines.TouchConfig, TouchSettings.GetConfig() },
                { Defines.GameConfig, GameSettingsScreen.GetConfig() }
            };

            Toml.WriteFile(data, Defines.ConfigFile);

            // Should this go here? I don't see why we would save if we didn't want to apply it immediately
            UpdateGlobals();
        }