Exemple #1
0
        internal void UpdateVideo()
        {
            WorldViewportGump gump = Engine.UI.GetByLocalSerial <WorldViewportGump>();

            _gameWindowWidth.Text     = gump.Width.ToString();
            _gameWindowHeight.Text    = gump.Height.ToString();
            _gameWindowPositionX.Text = gump.X.ToString();
            _gameWindowPositionY.Text = gump.Y.ToString();
        }
Exemple #2
0
        private void Apply()
        {
            // general
            Engine.GlobalSettings.PreloadMaps           = _preloadMaps.IsChecked;
            Engine.Profile.Current.MaxFPS               = Engine.FpsLimit = _sliderFPS.Value;
            Engine.GlobalSettings.MaxLoginFPS           = _sliderFPSLogin.Value;
            Engine.Profile.Current.HighlightGameObjects = _highlightObjects.IsChecked;
            //Engine.Profile.Current.SmoothMovements = _smoothMovements.IsChecked;
            Engine.Profile.Current.EnablePathfind          = _enablePathfind.IsChecked;
            Engine.Profile.Current.AlwaysRun               = _alwaysRun.IsChecked;
            Engine.Profile.Current.ShowMobilesHP           = _showHpMobile.IsChecked;
            Engine.Profile.Current.HighlightMobilesByFlags = _highlightByState.IsChecked;
            Engine.Profile.Current.MobileHPType            = _hpComboBox.SelectedIndex;
            Engine.Profile.Current.HoldDownKeyTab          = _holdDownKeyTab.IsChecked;

            if (Engine.Profile.Current.DrawRoofs == _drawRoofs.IsChecked)
            {
                Engine.Profile.Current.DrawRoofs = !_drawRoofs.IsChecked;
                Engine.SceneManager.GetScene <GameScene>()?.UpdateMaxDrawZ(true);
            }

            if (Engine.Profile.Current.TopbarGumpIsDisabled != _enableTopbar.IsChecked)
            {
                if (_enableTopbar.IsChecked)
                {
                    Engine.UI.GetByLocalSerial <TopBarGump>()?.Dispose();
                }
                else
                {
                    TopBarGump.Create();
                }

                Engine.Profile.Current.TopbarGumpIsDisabled = _enableTopbar.IsChecked;
            }

            Engine.Profile.Current.EnableCaveBorder           = _enableCaveBorder.IsChecked;
            Engine.Profile.Current.TreeToStumps               = _treeToStumps.IsChecked;
            Engine.Profile.Current.FieldsType                 = _normalFields.IsChecked ? 0 : _staticFields.IsChecked ? 1 : _fieldsToTile.IsChecked ? 2 : 0;
            Engine.Profile.Current.HideVegetation             = _hideVegetation.IsChecked;
            Engine.Profile.Current.NoColorObjectsOutOfRange   = _noColorOutOfRangeObjects.IsChecked;
            Engine.Profile.Current.UseCircleOfTransparency    = _useCircleOfTransparency.IsChecked;
            Engine.Profile.Current.CircleOfTransparencyRadius = _circleOfTranspRadius.Value;

            // sounds
            Engine.Profile.Current.EnableSound                 = _enableSounds.IsChecked;
            Engine.Profile.Current.EnableMusic                 = _enableMusic.IsChecked;
            Engine.Profile.Current.EnableFootstepsSound        = _footStepsSound.IsChecked;
            Engine.Profile.Current.EnableCombatMusic           = _combatMusic.IsChecked;
            Engine.Profile.Current.ReproduceSoundsInBackground = _musicInBackground.IsChecked;
            Engine.Profile.Current.SoundVolume                 = _soundsVolume.Value;
            Engine.Profile.Current.MusicVolume                 = _musicVolume.Value;
            Engine.GlobalSettings.LoginMusicVolume             = _loginMusicVolume.Value;
            Engine.GlobalSettings.LoginMusic = _loginMusic.IsChecked;

            Engine.SceneManager.CurrentScene.Audio.UpdateCurrentMusicVolume();

            if (!Engine.Profile.Current.EnableMusic)
            {
                Engine.SceneManager.CurrentScene.Audio.StopMusic();
            }

            // speech
            Engine.Profile.Current.ScaleSpeechDelay = _scaleSpeechDelay.IsChecked;
            Engine.Profile.Current.SpeechDelay      = _sliderSpeechDelay.Value;
            Engine.Profile.Current.SpeechHue        = _speechColorPickerBox.Hue;
            Engine.Profile.Current.EmoteHue         = _emoteColorPickerBox.Hue;
            Engine.Profile.Current.PartyMessageHue  = _partyMessageColorPickerBox.Hue;
            Engine.Profile.Current.GuildMessageHue  = _guildMessageColorPickerBox.Hue;
            Engine.Profile.Current.AllyMessageHue   = _allyMessageColorPickerBox.Hue;

            // video
            Engine.Profile.Current.EnableDeathScreen      = _enableDeathScreen.IsChecked;
            Engine.Profile.Current.EnableBlackWhiteEffect = _enableBlackWhiteEffect.IsChecked;

            Engine.GlobalSettings.Debug            = _debugControls.IsChecked;
            Engine.Profile.Current.EnableScaleZoom = _zoom.IsChecked;

            if (Engine.GlobalSettings.ShardType != _shardType.SelectedIndex)
            {
                var status = StatusGumpBase.GetStatusGump();

                Engine.GlobalSettings.ShardType = _shardType.SelectedIndex;

                if (status != null)
                {
                    status.Dispose();
                    StatusGumpBase.AddStatusGump(status.ScreenCoordinateX, status.ScreenCoordinateY);
                }
            }

            int GameWindowSizeWidth  = 640;
            int GameWindowSizeHeight = 480;

            int.TryParse(_gameWindowWidth.Text, out GameWindowSizeWidth);
            int.TryParse(_gameWindowHeight.Text, out GameWindowSizeHeight);

            if (GameWindowSizeWidth != Engine.Profile.Current.GameWindowSize.X || GameWindowSizeHeight != Engine.Profile.Current.GameWindowSize.Y)
            {
                WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                Point             n = e.ResizeWindow(new Point(GameWindowSizeWidth, GameWindowSizeHeight));

                _gameWindowWidth.Text  = n.X.ToString();
                _gameWindowHeight.Text = n.Y.ToString();
            }

            int GameWindowPositionX = 20;
            int GameWindowPositionY = 20;

            int.TryParse(_gameWindowPositionX.Text, out GameWindowPositionX);
            int.TryParse(_gameWindowPositionY.Text, out GameWindowPositionY);

            if (GameWindowPositionX != Engine.Profile.Current.GameWindowPosition.X || GameWindowPositionY != Engine.Profile.Current.GameWindowPosition.Y)
            {
                Point n = new Point(GameWindowPositionX, GameWindowPositionY);

                WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                e.Location = n;

                Engine.Profile.Current.GameWindowPosition = n;
            }

            if (Engine.Profile.Current.GameWindowLock != _gameWindowLock.IsChecked)
            {
                if (_gameWindowLock.IsChecked)
                {
                    // lock
                    WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                    e.CanMove = false;
                }
                else
                {
                    // unlock
                    WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                    e.CanMove = true;
                }
                Engine.Profile.Current.GameWindowLock = _gameWindowLock.IsChecked;
            }

            if (_gameWindowFullsize.IsChecked != Engine.Profile.Current.GameWindowFullSize)
            {
                if (_gameWindowFullsize.IsChecked)
                {
                    WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                    e.ResizeWindow(new Point(Engine.WindowWidth, Engine.WindowHeight));
                    e.Location = new Point(-5, -5);
                }
                else
                {
                    WorldViewportGump e = Engine.UI.GetByLocalSerial <WorldViewportGump>();
                    e.ResizeWindow(new Point(640, 480));
                    e.Location = new Point(20, 20);
                }
                Engine.Profile.Current.GameWindowFullSize = _gameWindowFullsize.IsChecked;
            }

            if (_savezoom.IsChecked != Engine.Profile.Current.SaveScaleAfterClose)
            {
                if (!_savezoom.IsChecked)
                {
                    Engine.Profile.Current.ScaleZoom = 1f;
                }

                Engine.Profile.Current.SaveScaleAfterClose = _savezoom.IsChecked;
            }

            UpdateVideo();

            // fonts
            Engine.Profile.Current.ChatFont = _fontSelectorChat.GetSelectedFont();

            // combat
            Engine.Profile.Current.InnocentHue = _innocentColorPickerBox.Hue;
            Engine.Profile.Current.FriendHue   = _friendColorPickerBox.Hue;
            Engine.Profile.Current.CriminalHue = _crimialColorPickerBox.Hue;
            Engine.Profile.Current.AnimalHue   = _genericColorPickerBox.Hue;
            Engine.Profile.Current.EnemyHue    = _enemyColorPickerBox.Hue;
            Engine.Profile.Current.MurdererHue = _murdererColorPickerBox.Hue;
            Engine.Profile.Current.EnabledCriminalActionQuery = _queryBeforAttackCheckbox.IsChecked;


            // macros
            Engine.Profile.Current.Macros = Engine.SceneManager.GetScene <GameScene>().Macros.GetAllMacros().ToArray();
        }