Ejemplo n.º 1
0
        private void SaveSettings(object o, MouseEventArgs e)
        {
            if (Config.FullScreen != FullScreenCheckBox.Checked)
            {
                DXManager.ToggleFullScreen();
            }

            if (GameSizeComboBox.SelectedItem is Size && Config.GameSize != (Size)GameSizeComboBox.SelectedItem)
            {
                Config.GameSize = (Size)GameSizeComboBox.SelectedItem;

                if (ActiveScene is GameScene)
                {
                    ActiveScene.Size = Config.GameSize;
                    DXManager.SetResolution(ActiveScene.Size);
                }
            }

            if (LanguageComboBox.SelectedItem is string && Config.Language != (string)LanguageComboBox.SelectedItem)
            {
                Config.Language = (string)LanguageComboBox.SelectedItem;

                if (CEnvir.Connection != null && CEnvir.Connection.ServerConnected)
                {
                    CEnvir.Enqueue(new C.SelectLanguage {
                        Language = Config.Language
                    });
                }
            }


            if (Config.VSync != VSyncCheckBox.Checked)
            {
                Config.VSync = VSyncCheckBox.Checked;
                DXManager.ResetDevice();
            }

            Config.LimitFPS   = LimitFPSCheckBox.Checked;
            Config.ClipMouse  = ClipMouseCheckBox.Checked;
            Config.DebugLabel = DebugLabelCheckBox.Checked;

            DebugLabel.IsVisible = Config.DebugLabel;
            PingLabel.IsVisible  = Config.DebugLabel;

            if (Config.SoundInBackground != BackgroundSoundBox.Checked)
            {
                Config.SoundInBackground = BackgroundSoundBox.Checked;

                DXSoundManager.UpdateFlags();
            }


            bool volumeChanged = false;


            if (Config.SystemVolume != SystemVolumeBox.Value)
            {
                Config.SystemVolume = (int)SystemVolumeBox.Value;
                volumeChanged       = true;
            }


            if (Config.MusicVolume != MusicVolumeBox.Value)
            {
                Config.MusicVolume = (int)MusicVolumeBox.Value;
                volumeChanged      = true;
            }


            if (Config.PlayerVolume != PlayerVolumeBox.Value)
            {
                Config.PlayerVolume = (int)PlayerVolumeBox.Value;
                volumeChanged       = true;
            }

            if (Config.MonsterVolume != MonsterVolumeBox.Value)
            {
                Config.MonsterVolume = (int)MonsterVolumeBox.Value;
                volumeChanged        = true;
            }

            if (Config.MagicVolume != SpellVolumeBox.Value)
            {
                Config.MagicVolume = (int)SpellVolumeBox.Value;
                volumeChanged      = true;
            }

            Config.ShowItemNames     = ItemNameCheckBox.Checked;
            Config.ShowMonsterNames  = MonsterNameCheckBox.Checked;
            Config.ShowPlayerNames   = PlayerNameCheckBox.Checked;
            Config.ShowUserHealth    = UserHealthCheckBox.Checked;
            Config.ShowMonsterHealth = MonsterHealthCheckBox.Checked;
            Config.ShowDamageNumbers = DamageNumbersCheckBox.Checked;

            Config.EscapeCloseAll     = EscapeCloseAllCheckBox.Checked;
            Config.ShiftOpenChat      = ShiftOpenChatCheckBox.Checked;
            Config.RightClickDeTarget = RightClickDeTargetCheckBox.Checked;
            Config.MonsterBoxVisible  = MonsterBoxVisibleCheckBox.Checked;
            Config.LogChat            = LogChatCheckBox.Checked;
            Config.DrawEffects        = DrawEffectsCheckBox.Checked;

            if (volumeChanged)
            {
                DXSoundManager.AdjustVolume();
            }

            Config.UseNetworkConfig = UseNetworkConfigCheckBox.Checked;
            Config.IPAddress        = IPAddressTextBox.TextBox.Text;
            Config.Port             = (int)PortBox.Value;


            bool coloursChanged = false;

            if (Config.LocalTextColour != LocalColourBox.BackColour)
            {
                Config.LocalTextColour = LocalColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GMWhisperInTextColour != GMWhisperInColourBox.BackColour)
            {
                Config.GMWhisperInTextColour = GMWhisperInColourBox.BackColour;
                coloursChanged = true;
            }

            if (Config.WhisperInTextColour != WhisperInColourBox.BackColour)
            {
                Config.WhisperInTextColour = WhisperInColourBox.BackColour;
                coloursChanged             = true;
            }

            if (Config.WhisperOutTextColour != WhisperOutColourBox.BackColour)
            {
                Config.WhisperOutTextColour = WhisperOutColourBox.BackColour;
                coloursChanged = true;
            }

            if (Config.GroupTextColour != GroupColourBox.BackColour)
            {
                Config.GroupTextColour = GroupColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GuildTextColour != GuildColourBox.BackColour)
            {
                Config.GuildTextColour = GuildColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.ShoutTextColour != ShoutColourBox.BackColour)
            {
                Config.ShoutTextColour = ShoutColourBox.BackColour;
                coloursChanged         = true;
            }

            if (Config.GlobalTextColour != GlobalColourBox.BackColour)
            {
                Config.GlobalTextColour = GlobalColourBox.BackColour;
                coloursChanged          = true;
            }

            if (Config.ObserverTextColour != ObserverColourBox.BackColour)
            {
                Config.ObserverTextColour = ObserverColourBox.BackColour;
                coloursChanged            = true;
            }

            if (Config.HintTextColour != HintColourBox.BackColour)
            {
                Config.HintTextColour = HintColourBox.BackColour;
                coloursChanged        = true;
            }

            if (Config.SystemTextColour != SystemColourBox.BackColour)
            {
                Config.SystemTextColour = SystemColourBox.BackColour;
                coloursChanged          = true;
            }

            if (Config.GainsTextColour != GainsColourBox.BackColour)
            {
                Config.GainsTextColour = GainsColourBox.BackColour;
                coloursChanged         = true;
            }
            if (Config.AnnouncementTextColour != AnnouncementColourBox.BackColour)
            {
                Config.AnnouncementTextColour = AnnouncementColourBox.BackColour;
                coloursChanged = true;
            }

            if (coloursChanged && GameScene.Game != null)
            {
                foreach (ChatTab tab in ChatTab.Tabs)
                {
                    tab.UpdateColours();
                }
            }
        }