Example #1
0
        void SaveSettings()
        {
            var settings = AppSettings.Load();

            settings.Difficulty = cmbDifficulty.SelectedItem.ToEnumOrDefault(GameDifficultyTypes.NORMAL);
            settings.PlayerName = txtPlayerName.Text;
            settings.BGMVolume  = tbBGMVolume.Value;
            settings.SFXVolume  = tbSFXVolume.Value;
            settings.Save();

            OnSettingsSaved?.Invoke(settings);
        }
Example #2
0
        public void INTERNAL_OnSettingsSaved()
        {
            foreach (var setting in Settings)
            {
                setting.UpdateValue(false);
            }

            if (OnSettingsSaved != null)
            {
                //Debug.Log("OnSettingsSaved Callback for " + this.ModName);
                OnSettingsSaved.Invoke();
            }
        }
Example #3
0
 protected virtual void NotifyOnSettingsSaved()
 {
     //send a notification to everyone subscribed to recieve an event when the settings are applied
     OnSettingsSaved?.Invoke(this, EventArgs.Empty);
 }
Example #4
0
 /// <summary>
 /// Saves settings and invokes <see cref="OnSettingsSaved"/>
 /// </summary>
 /// <param name="sender">Author of the save</param>
 public static void Save(object sender)
 {
     Settings.Default.Save();
     OnSettingsSaved?.Invoke(sender, new EventArgs());
 }