Пример #1
0
        protected override void OnDragEnd(int x, int y)
        {
            OptionsGump1 options = Engine.UI.GetByLocalSerial <OptionsGump1>();

            if (options != null)
            {
                options.UpdateVideo();
            }
        }
Пример #2
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);

                    OptionsGump1 options = Engine.UI.GetByLocalSerial <OptionsGump1>();
                    if (options != null)
                    {
                        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);
            _viewport          = new WorldViewport(scene, BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);
            _systemChatControl = new SystemChatControl(BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);
            Add(_border);
            Add(_button);
            Add(_viewport);
            Add(_systemChatControl);
            Resize();

            _savedSize = _lastSize = Engine.Profile.Current.GameWindowSize;
        }
Пример #3
0
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Help:
                GameActions.RequestHelp();

                break;

            case Buttons.Options:

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

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


                break;

            case Buttons.LogOut:
                Engine.UI.Add(new QuestionGump("Quit\nUltima Online?", s =>
                {
                    if (s)
                    {
                        Engine.SceneManager.ChangeScene(ScenesType.Login);
                    }
                }));

                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;
            }
        }