Пример #1
0
        public MenuWindow(Core core, SettingsContainer settingsContainer, Dictionary <string, FontContainer> fonts)
        {
            this.core          = core;
            _settingsContainer = settingsContainer;
            _CoreSettings      = settingsContainer.CoreSettings;
            Fonts       = fonts;
            themeEditor = new ThemeEditor(_CoreSettings);

            /*Input.RegisterKey(Keys.F12);
             * Input.ReleaseKey += (sender, keys) =>
             * {
             *  if (keys== SettingsCoreSettings.MainMenuKeyToggle.Value)
             *  {
             *      Enable = !Enable;
             *  }
             * };*/

            CoreSettingsDrawers = new List <ISettingsHolder>();

            SettingsParser.Parse(_CoreSettings, CoreSettingsDrawers);
            Selected     = CoreSettings;
            CoreSettings = () =>
            {
                foreach (var drawer in CoreSettingsDrawers)
                {
                    drawer.Draw();
                }
            };
            _index   = -1;
            Selected = CoreSettings;


            Core.DebugInformations.CollectionChanged += OnDebugInformationsOnCollectionChanged;
            debugInformation = new DebugInformation("DebugWindow", false);
            OpenWindow       = Windows.MainDebugs;
            WindowsName      = Enum.GetValues(typeof(Windows));
            OnWindowChange  += () =>
            {
                MoreInformation = null;
                selectedName    = "";
            };
            Input.RegisterKey(_CoreSettings.MainMenuKeyToggle);
            _CoreSettings.MainMenuKeyToggle.OnValueChanged += () =>
            {
                Input.RegisterKey(_CoreSettings.MainMenuKeyToggle);
            };
        }
Пример #2
0
        public void _LoadSettings()
        {
            var loadedFile = GameController.Settings.LoadSettings(this);


            if (loadedFile == null)
            {
                _Settings = new TSettings();
                _SaveSettings();
            }
            else
            {
                _Settings = JsonConvert.DeserializeObject <TSettings>(loadedFile, SettingsContainer.jsonSettings);
            }

            SettingsParser.Parse(_Settings, Drawers);
        }