Example #1
0
        public WorldViewportGump(GameScene scene) : base(0, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = !Engine.Profile.Current.GameWindowLock;
            CanCloseWithEsc        = false;
            CanCloseWithRightClick = false;
            ControlInfo.Layer      = UILayer.Under;
            X            = Engine.Profile.Current.GameWindowPosition.X;
            Y            = Engine.Profile.Current.GameWindowPosition.Y;
            _worldWidth  = Engine.Profile.Current.GameWindowSize.X;
            _worldHeight = Engine.Profile.Current.GameWindowSize.Y;
            _button      = new Button(0, 0x837, 0x838, 0x838);

            _button.MouseDown += (sender, e) =>
            {
                if (!Engine.Profile.Current.GameWindowLock)
                {
                    _clicked = true;
                }
            };

            _button.MouseUp += (sender, e) =>
            {
                if (!Engine.Profile.Current.GameWindowLock)
                {
                    Point n = ResizeWindow(_lastSize);

                    OptionsGump options = Engine.UI.GetGump <OptionsGump>();
                    options?.UpdateVideo();

                    if (FileManager.ClientVersion >= ClientVersions.CV_200)
                    {
                        NetClient.Socket.Send(new PGameWindowSize((uint)n.X, (uint)n.Y));
                    }

                    _clicked = false;
                }
            };

            _button.SetTooltip("Resize game window");
            Width            = _worldWidth + BORDER_WIDTH * 2;
            Height           = _worldHeight + BORDER_HEIGHT * 2;
            _border          = new GameBorder(0, 0, Width, Height, 4);
            _border.DragEnd += (sender, e) =>
            {
                OptionsGump options = Engine.UI.GetGump <OptionsGump>();
                options?.UpdateVideo();
            };
            _viewport = new WorldViewport(scene, BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);

            Engine.UI.SystemChat = _systemChatControl = new SystemChatControl(BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);

            Add(_border);
            Add(_button);
            Add(_viewport);
            Add(_systemChatControl);
            Resize();

            _savedSize = _lastSize = Engine.Profile.Current.GameWindowSize;
        }
Example #2
0
        protected override void OnDragEnd(int x, int y)
        {
            OptionsGump options = Engine.UI.GetByLocalSerial <OptionsGump>();

            if (options != null)
            {
                options.UpdateVideo();
            }
        }
Example #3
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;
            }
        }
Example #4
0
        protected override void OnDragEnd(int x, int y)
        {
            OptionsGump options = Engine.UI.GetControl <OptionsGump>();

            options?.UpdateVideo();
        }