Exemple #1
0
        protected override void OnDragBegin(int x, int y)
        {
            if (Entity.Serial.IsMobile)
            {
                GameActions.RequestMobileStatus(Entity);

                Engine.UI.GetByLocalSerial <HealthBarGump>(Entity)?.Dispose();

                if (Entity == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }

                Rectangle     rect = FileManager.Gumps.GetTexture(0x0804).Bounds;
                HealthBarGump currentHealthBarGump;
                Engine.UI.Add(currentHealthBarGump = new HealthBarGump((Mobile)Entity)
                {
                    X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                });
                Engine.UI.AttemptDragControl(currentHealthBarGump, Mouse.Position, true);
            }
            else
            {
                GameActions.PickUp(Entity);
            }
        }
Exemple #2
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Kick:
                //
                World.Party.RemovePartyMember(Member.Serial);

                break;

            case Buttons.GetBar:

                Engine.UI.GetByLocalSerial <HealthBarGump>(Member.Mobile)?.Dispose();

                if (Member.Mobile == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }

                Rectangle rect = FileManager.Gumps.GetTexture(0x0804).Bounds;
                Engine.UI.Add(new HealthBarGump(Member.Mobile)
                {
                    X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                });

                break;
            }
        }
Exemple #3
0
        protected override bool OnMouseDoubleClick(int x, int y, MouseButton button)
        {
            if (Mobile != null)
            {
                if (Mobile != World.Player)
                {
                    if (World.Player.InWarMode && World.Player != Mobile)
                    {
                        GameActions.Attack(Mobile);
                    }
                    else
                    {
                        GameActions.DoubleClick(Mobile);
                    }
                }
                else
                {
                    StatusGumpBase.AddStatusGump(ScreenCoordinateX, ScreenCoordinateY);
                    Dispose();
                }
            }


            return(true);
        }
        protected override void OnDragBegin(int x, int y)
        {
            if (Entity is Mobile || Entity is Item it && it.IsDamageable)
            {
                if (Engine.UI.IsDragging)
                {
                    return;
                }

                GameActions.RequestMobileStatus(Entity);

                Engine.UI.GetGump <HealthBarGump>(Entity)?.Dispose();

                if (Entity == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }

                Rectangle     rect = FileManager.Gumps.GetTexture(0x0804).Bounds;
                HealthBarGump currentHealthBarGump;
                Engine.UI.Add(currentHealthBarGump = new HealthBarGump(Entity)
                {
                    X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                });
                Engine.UI.AttemptDragControl(currentHealthBarGump, Mouse.Position, true);
            }
Exemple #5
0
        public override void OnButtonClick(int buttonID)
        {
            PartyMember member = World.Party.Members[PartyMemeberIndex];

            if (member == null)
            {
                return;
            }

            switch ((Buttons)buttonID)
            {
            case Buttons.Kick:
                //

                GameActions.RequestPartyRemoveMember(member.Serial);


                break;

            case Buttons.GetBar:
                UIManager.GetGump <BaseHealthBarGump>(member.Serial)?.Dispose();

                if (member.Serial == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }



                if (ProfileManager.Current.CustomBarsToggled)
                {
                    Rectangle rect = new Rectangle(0, 0, HealthBarGumpCustom.HPB_WIDTH, HealthBarGumpCustom.HPB_HEIGHT_SINGLELINE);
                    UIManager.Add(new HealthBarGumpCustom(member.Serial)
                    {
                        X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                    });
                }
                else
                {
                    Rectangle rect = UOFileManager.Gumps.GetTexture(0x0804).Bounds;
                    UIManager.Add(new HealthBarGump(member.Serial)
                    {
                        X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                    });
                }

                break;
            }
        }
        public override void OnButtonClick(int buttonID)
        {
            PartyMember member = World.Party.Members[PartyMemeberIndex];

            if (member == null)
            {
                return;
            }

            switch ((Buttons)buttonID)
            {
            case Buttons.Kick:
                //

                GameActions.RequestPartyRemoveMember(member.Serial);


                break;

            case Buttons.GetBar:

                Engine.UI.GetControl <HealthBarGump>(member.Serial)?.Dispose();

                if (member.Serial == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }

                Rectangle rect = FileManager.Gumps.GetTexture(0x0804).Bounds;
                Engine.UI.Add(new HealthBarGump(member.Serial)
                {
                    X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                });

                break;
            }
        }
Exemple #7
0
        protected override void OnDragBegin(int x, int y)
        {
            if (Entity is Mobile || Entity is Item it && it.IsDamageable)
            {
                if (UIManager.IsDragging)
                {
                    return;
                }

                GameActions.RequestMobileStatus(Entity);
                BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Entity);
                gump?.Dispose();

                if (Entity == World.Player)
                {
                    StatusGumpBase.GetStatusGump()?.Dispose();
                }

                if (ProfileManager.Current.CustomBarsToggled)
                {
                    Rectangle rect = new Rectangle(0, 0, HealthBarGumpCustom.HPB_WIDTH, HealthBarGumpCustom.HPB_HEIGHT_SINGLELINE);
                    UIManager.Add(gump = new HealthBarGumpCustom(Entity)
                    {
                        X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                    });
                }
                else
                {
                    Rectangle rect = GumpsLoader.Instance.GetTexture(0x0804).Bounds;
                    UIManager.Add(gump = new HealthBarGump(Entity)
                    {
                        X = Mouse.Position.X - (rect.Width >> 1), Y = Mouse.Position.Y - (rect.Height >> 1)
                    });
                }

                UIManager.AttemptDragControl(gump, Mouse.Position, true);
            }
Exemple #8
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Help:
                GameActions.RequestHelp();

                break;

            case Buttons.Options:

                OptionsGump gump = Engine.UI.GetByLocalSerial <OptionsGump>();

                if (gump == null)
                {
                    Engine.UI.Add(new OptionsGump
                    {
                        X = Engine.WindowWidth / 2 - 300,
                        Y = Engine.WindowHeight / 2 - 250
                    });
                }
                else
                {
                    gump.BringOnTop();
                }


                break;

            case Buttons.LogOut:
                Engine.SceneManager.GetScene <GameScene>()?.RequestQuitGame();

                break;

            case Buttons.Quests:
                GameActions.RequestQuestMenu();

                break;

            case Buttons.Skills:

                World.SkillsRequested = true;
                NetClient.Socket.Send(new PSkillsRequest(World.Player));

                break;

            case Buttons.Guild:
                GameActions.OpenGuildGump();

                break;

            case Buttons.PeaceWarToggle:
                GameActions.ToggleWarMode();

                break;

            case Buttons.Status:
                if (Mobile == World.Player)
                {
                    Engine.UI.GetByLocalSerial <HealthBarGump>(Mobile)?.Dispose();

                    StatusGumpBase status = StatusGumpBase.GetStatusGump();

                    if (status == null)
                    {
                        StatusGumpBase.AddStatusGump(Mouse.Position.X - 100, Mouse.Position.Y - 25);
                    }
                    else
                    {
                        status.BringOnTop();
                    }
                }
                else
                {
                    if (Engine.UI.GetByLocalSerial <HealthBarGump>(Mobile) != null)
                    {
                        break;
                    }

                    GameActions.RequestMobileStatus(Mobile);

                    Rectangle bounds = FileManager.Gumps.GetTexture(0x0804).Bounds;

                    Engine.UI.Add(new HealthBarGump(Mobile)
                    {
                        X = Mouse.Position.X - (bounds.Width / 2),
                        Y = Mouse.Position.Y - 5,
                    });
                }

                break;
            }
        }
Exemple #9
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();
        }