Пример #1
0
        public WorldViewportGump(GameScene scene) : base(0, 0)
        {
            _scene                 = scene;
            AcceptMouseInput       = false;
            CanMove                = !ProfileManager.Current.GameWindowLock;
            CanCloseWithEsc        = false;
            CanCloseWithRightClick = false;
            ControlInfo.Layer      = UILayer.Under;
            X            = ProfileManager.Current.GameWindowPosition.X;
            Y            = ProfileManager.Current.GameWindowPosition.Y;
            _worldWidth  = ProfileManager.Current.GameWindowSize.X;
            _worldHeight = ProfileManager.Current.GameWindowSize.Y;
            _savedSize   = _lastSize = ProfileManager.Current.GameWindowSize;

            _button = new Button(0, 0x837, 0x838, 0x838);

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

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

                    UIManager.GetGump <OptionsGump>()
                    ?.UpdateVideo();

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

                    _clicked = false;
                }
            };

            _button.SetTooltip(ResGumps.ResizeGameWindow);
            Width          = _worldWidth + BORDER_WIDTH * 2;
            Height         = _worldHeight + BORDER_WIDTH * 2;
            _borderControl = new BorderControl(0, 0, Width, Height, 4);

            _borderControl.DragEnd += (sender, e) =>
            {
                UIManager.GetGump <OptionsGump>()
                ?.UpdateVideo();
            };

            UIManager.SystemChat = _systemChatControl = new SystemChatControl(BORDER_WIDTH, BORDER_WIDTH, _worldWidth, _worldHeight);

            Add(_borderControl);
            Add(_button);
            Add(_systemChatControl);
            Resize();
        }
Пример #2
0
 public void ReloadChatControl(SystemChatControl chat)
 {
     _systemChatControl.Dispose();
     Engine.UI.SystemChat = _systemChatControl = chat;
     Add(_systemChatControl);
     Resize();
 }
Пример #3
0
 public void ReloadChatControl(SystemChatControl chat)
 {
     _systemChatControl.Dispose();
     UIManager.SystemChat = _systemChatControl = chat;
     Add(_systemChatControl);
     Resize();
 }
Пример #4
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;
        }