Пример #1
0
        public override void InitializeGUI()
        {
            //TODO: This needs to go in BaseClient
            NetworkManager.RegisterNetMessage <MsgPlayerListReq>(MsgPlayerListReq.NAME, (int)MsgPlayerListReq.ID, message =>
                                                                 Logger.Error($"[SRV] Unhandled NetMessage type: {message.MsgId}"));

            NetworkManager.RegisterNetMessage <MsgPlayerList>(MsgPlayerList.NAME, (int)MsgPlayerList.ID, HandlePlayerList);

            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // UI screen is added in startup

            var imgMainBg = new SimpleImage();

            imgMainBg.Sprite    = "lobby_mainbg";
            imgMainBg.Alignment = Align.HCenter | Align.VCenter;
            _uiScreen.AddControl(imgMainBg);

            var imgStatus = new SimpleImage();

            imgStatus.Sprite        = "lobby_statusbar";
            imgStatus.LocalPosition = new Vector2i(10, 63);
            imgMainBg.AddControl(imgStatus);

            var lblServer = new Label("SERVER: ", "MICROGME");

            lblServer.ForegroundColor = new Color(245, 245, 245);
            lblServer.LocalPosition   = new Vector2i(5, 2);
            imgStatus.AddControl(lblServer);

            _lblServerInfo = new Label("LLJK#1", "MICROGME");
            _lblServerInfo.ForegroundColor = new Color(139, 0, 0);
            _lblServerInfo.FixedWidth      = 100;
            _lblServerInfo.Alignment       = Align.Right;
            lblServer.AddControl(_lblServerInfo);

            var lblMode = new Label("GAMEMODE: ", "MICROGME");

            lblMode.ForegroundColor = new Color(245, 245, 245);
            lblMode.Alignment       = Align.Right;
            lblMode.LocalPosition   = new Vector2i(10, 0);
            _lblServerInfo.AddControl(lblMode);

            _lblModeInfo = new Label("SECRET", "MICROGME");
            _lblModeInfo.ForegroundColor = new Color(139, 0, 0);
            _lblModeInfo.FixedWidth      = 90;
            _lblModeInfo.Alignment       = Align.Right;
            lblMode.AddControl(_lblModeInfo);

            var lblPlayers = new Label("PLAYERS: ", "MICROGME");

            lblPlayers.ForegroundColor = new Color(245, 245, 245);
            lblPlayers.Alignment       = Align.Right;
            lblPlayers.LocalPosition   = new Vector2i(10, 0);
            _lblModeInfo.AddControl(lblPlayers);

            _lblPlayersInfo = new Label("17/32", "MICROGME");
            _lblPlayersInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPlayersInfo.FixedWidth      = 60;
            _lblPlayersInfo.Alignment       = Align.Right;
            lblPlayers.AddControl(_lblPlayersInfo);

            var lblPort = new Label("PORT: ", "MICROGME");

            lblPort.ForegroundColor = new Color(245, 245, 245);
            lblPort.Alignment       = Align.Right;
            lblPort.LocalPosition   = new Vector2i(10, 0);
            _lblPlayersInfo.AddControl(lblPort);

            _lblPortInfo = new Label(MainScreen.DefaultPort.ToString(), "MICROGME");
            _lblPortInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPortInfo.FixedWidth      = 50;
            _lblPortInfo.Alignment       = Align.Right;
            lblPort.AddControl(_lblPortInfo);

            _tabs               = new TabbedMenu();
            _tabs.TopSprite     = "lobby_tab_top";
            _tabs.MidSprite     = "lobby_tab_mid";
            _tabs.BotSprite     = "lobby_tab_bot";
            _tabs.TabOffset     = new Vector2i(-8, 300);
            _tabs.LocalPosition = new Vector2i(5, 90);
            imgMainBg.AddControl(_tabs);

            var tabCharacter = new TabContainer(new Vector2i(793, 350));

            tabCharacter.TabSpriteName = "lobby_tab_person";
            _tabs.AddTab(tabCharacter);

            var tabObserve = new TabContainer(new Vector2i(793, 350));

            tabObserve.TabSpriteName = "lobby_tab_eye";
            _tabs.AddTab(tabObserve);

            var tabServer = new PlayerListTab(new Vector2i(793, 350));

            tabServer.TabSpriteName = "lobby_tab_info";
            _tabs.AddTab(tabServer);
            _tabs.SelectTab(tabServer);

            var imgChatBg = new SimpleImage();

            imgChatBg.Sprite    = "lobby_chatbg";
            imgChatBg.Alignment = Align.HCenter | Align.Bottom;
            imgChatBg.Resize   += (sender, args) => { imgChatBg.LocalPosition = new Vector2i(0, -9 + -imgChatBg.Height); };
            imgMainBg.AddControl(imgChatBg);

            _lobbyChat           = new Chatbox(new Vector2i(780, 225));
            _lobbyChat.Alignment = Align.HCenter | Align.VCenter;
            imgChatBg.AddControl(_lobbyChat);

            var btnReady = new ImageButton();

            btnReady.ImageNormal = "lobby_ready";
            btnReady.ImageHover  = "lobby_ready_green";
            btnReady.Alignment   = Align.Right;
            btnReady.Resize     += (sender, args) => { btnReady.LocalPosition = new Vector2i(-5 + -btnReady.Width, -5 + -btnReady.Height); };
            imgChatBg.AddControl(btnReady);
            btnReady.Clicked += _btnReady_Clicked;

            var btnBack = new ImageButton();

            btnBack.ImageNormal = "lobby_back";
            btnBack.ImageHover  = "lobby_back_green";
            btnBack.Resize     += (sender, args) => { btnBack.LocalPosition = new Vector2i(-5 + -btnBack.Width, 0); };
            btnReady.AddControl(btnBack);
            btnBack.Clicked += _btnBack_Clicked;
        }
Пример #2
0
        public EntitySpawnWindow(Vector2i size)
            : base("Entity Spawn Panel", size)
        {
            _placementManager = IoCManager.Resolve <IPlacementManager>();

            _entityList = new ScrollableContainer(new Vector2i(200, 400));
            _entityList.LocalPosition = new Vector2i(5, 5);
            Container.AddControl(_entityList);

            var searchLabel = new Label("Entity Search:", "CALIBRI");

            searchLabel.LocalPosition = new Vector2i(210, 0);
            Container.AddControl(searchLabel);

            var entSearchTextbox = new Textbox(125);

            entSearchTextbox.LocalPosition = new Vector2i(210, 20);
            entSearchTextbox.OnSubmit     += entSearchTextbox_OnSubmit;
            Container.AddControl(entSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI");
            _clearLabel.DrawBackground  = true;
            _clearLabel.DrawBorder      = true;
            _clearLabel.LocalPosition   = new Vector2i(210, 55);
            _clearLabel.Clicked        += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            Container.AddControl(_clearLabel);

            var overLabel = new Label("Override Placement:", "CALIBRI");

            overLabel.LocalPosition = new Vector2i(0, 15);
            overLabel.Alignment     = ControlAlignments.Bottom;
            _clearLabel.AddControl(overLabel);

            var initOpts = new List <string>();

            initOpts.AddRange(new[]
            {
                "PlaceFree",
                "PlaceNearby",
                "SnapgridCenter",
                "SnapgridBorder",
                "AlignSimilar",
                "AlignTileAny",
                "AlignTileEmpty",
                "AlignTileNonSolid",
                "AlignTileSolid",
                "AlignWall",
            });

            _lstOverride = new Listbox(140, 125, initOpts);
            _lstOverride.ItemSelected += _lstOverride_ItemSelected;
            _lstOverride.SelectItem("PlaceFree");
            _lstOverride.LocalPosition = new Vector2i(0, 0);
            _lstOverride.Alignment     = ControlAlignments.Bottom;
            overLabel.AddControl(_lstOverride);

            _eraserButton               = new ImageButton();
            _eraserButton.ImageNormal   = "erasericon";
            _eraserButton.LocalPosition = new Vector2i(5, 0);
            _eraserButton.Alignment     = ControlAlignments.Right;
            _clearLabel.AddControl(_eraserButton);
            _eraserButton.Clicked += EraserButtonClicked;

            BuildEntityList();

            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
Пример #3
0
        /// <inheritdoc />
        public override void InitializeGUI()
        {
            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // added to interface manager in startup

            _bgPanel = new Panel();
            _bgPanel.BackgroundImage = ResourceCache.GetResource <SpriteResource>(@"Textures/UserInterface/TicketOverlay.png");
            _bgPanel.BackgroundColor = new Color(128, 128, 128, 128);
            _bgPanel.Alignment       = ControlAlignments.HCenter | ControlAlignments.VCenter;
            _bgPanel.Layout         += (sender, args) =>
            {
                _bgPanel.Width  = (int)(_uiScreen.Width * 0.85f);
                _bgPanel.Height = (int)(_uiScreen.Height * 0.85f);
            };
            _uiScreen.AddControl(_bgPanel);

            _lblTitle = new Label("Options", "CALIBRI", 48);
            _lblTitle.LocalPosition = new Vector2i(10, 10);
            _bgPanel.AddControl(_lblTitle);

            _lstResolution               = new Listbox(250, 150);
            _lstResolution.Alignment     = ControlAlignments.Bottom;
            _lstResolution.LocalPosition = new Vector2i(50, 50);
            _lstResolution.ItemSelected += _lstResolution_ItemSelected;
            PopulateAvailableVideoModes(_lstResolution);
            _lblTitle.AddControl(_lstResolution);

            _chkFullScreen               = new Checkbox();
            _chkFullScreen.Value         = ConfigurationManager.GetCVar <bool>("display.fullscreen");
            _chkFullScreen.ValueChanged += _chkFullScreen_ValueChanged;
            _chkFullScreen.Alignment     = ControlAlignments.Bottom;
            _chkFullScreen.LocalPosition = new Vector2i(0, 50);
            _lstResolution.AddControl(_chkFullScreen);

            _lblFullScreen               = new Label("Fullscreen", "CALIBRI");
            _lblFullScreen.Alignment     = ControlAlignments.Right;
            _lblFullScreen.LocalPosition = new Vector2i(3, 0);
            _chkFullScreen.AddControl(_lblFullScreen);

            _chkVSync               = new Checkbox();
            _chkVSync.Value         = ConfigurationManager.GetCVar <bool>("display.vsync");
            _chkVSync.ValueChanged += _chkVSync_ValueChanged;
            _chkVSync.Alignment     = ControlAlignments.Bottom;
            _chkVSync.LocalPosition = new Vector2i(0, 3);
            _chkFullScreen.AddControl(_chkVSync);

            _lblVSync               = new Label("Vsync", "CALIBRI");
            _lblVSync.Alignment     = ControlAlignments.Right;
            _lblVSync.LocalPosition = new Vector2i(3, 0);
            _chkVSync.AddControl(_lblVSync);

            _btnApply           = new Button("Apply Settings");
            _btnApply.Clicked  += _btnApply_Clicked;
            _btnApply.Alignment = ControlAlignments.Bottom | ControlAlignments.Right;
            _btnApply.Resize   += (sender, args) => { _btnApply.LocalPosition = new Vector2i(-10 + -_btnApply.ClientArea.Width, -10 + -_btnApply.ClientArea.Height); };
            _bgPanel.AddControl(_btnApply);

            _btnBack          = new Button("Back");
            _btnBack.Clicked += _btnBack_Clicked;
            _btnBack.Resize  += (sender, args) => { _btnBack.LocalPosition = new Vector2i(-10 + -_btnBack.ClientArea.Width, 0); };
            _btnApply.AddControl(_btnBack);
        }
Пример #4
0
        public override void InitializeGUI()
        {
            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // UI screen is added in startup

            var imgMainBg = new SimpleImage();

            imgMainBg.Sprite    = "lobby_mainbg";
            imgMainBg.Alignment = ControlAlignments.HCenter | ControlAlignments.VCenter;
            _uiScreen.AddControl(imgMainBg);

            var imgStatus = new SimpleImage();

            imgStatus.Sprite        = "lobby_statusbar";
            imgStatus.LocalPosition = new Vector2i(10, 63);
            imgMainBg.AddControl(imgStatus);

            var lblServer = new Label("SERVER: ", "MICROGME");

            lblServer.ForegroundColor = new Color(245, 245, 245);
            lblServer.LocalPosition   = new Vector2i(5, 2);
            imgStatus.AddControl(lblServer);

            _lblServerInfo = new Label("------", "MICROGME");
            _lblServerInfo.ForegroundColor = new Color(139, 0, 0);
            _lblServerInfo.FixedWidth      = 100;
            _lblServerInfo.Alignment       = ControlAlignments.Right;
            lblServer.AddControl(_lblServerInfo);

            var lblMode = new Label("GAMEMODE: ", "MICROGME");

            lblMode.ForegroundColor = new Color(245, 245, 245);
            lblMode.Alignment       = ControlAlignments.Right;
            lblMode.LocalPosition   = new Vector2i(10, 0);
            _lblServerInfo.AddControl(lblMode);

            _lblModeInfo = new Label("------", "MICROGME");
            _lblModeInfo.ForegroundColor = new Color(139, 0, 0);
            _lblModeInfo.FixedWidth      = 90;
            _lblModeInfo.Alignment       = ControlAlignments.Right;
            lblMode.AddControl(_lblModeInfo);

            var lblPlayers = new Label("PLAYERS: ", "MICROGME");

            lblPlayers.ForegroundColor = new Color(245, 245, 245);
            lblPlayers.Alignment       = ControlAlignments.Right;
            lblPlayers.LocalPosition   = new Vector2i(10, 0);
            _lblModeInfo.AddControl(lblPlayers);

            _lblPlayersInfo = new Label("--/--", "MICROGME");
            _lblPlayersInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPlayersInfo.FixedWidth      = 60;
            _lblPlayersInfo.Alignment       = ControlAlignments.Right;
            lblPlayers.AddControl(_lblPlayersInfo);

            var lblPort = new Label("PORT: ", "MICROGME");

            lblPort.ForegroundColor = new Color(245, 245, 245);
            lblPort.Alignment       = ControlAlignments.Right;
            lblPort.LocalPosition   = new Vector2i(10, 0);
            _lblPlayersInfo.AddControl(lblPort);

            _lblPortInfo = new Label("----", "MICROGME");
            _lblPortInfo.ForegroundColor = new Color(139, 0, 0);
            _lblPortInfo.FixedWidth      = 50;
            _lblPortInfo.Alignment       = ControlAlignments.Right;
            lblPort.AddControl(_lblPortInfo);

            _tabs               = new TabbedMenu();
            _tabs.TopSprite     = "lobby_tab_top";
            _tabs.MidSprite     = "lobby_tab_mid";
            _tabs.BotSprite     = "lobby_tab_bot";
            _tabs.TabOffset     = new Vector2i(-8, 300);
            _tabs.LocalPosition = new Vector2i(5, 90);
            imgMainBg.AddControl(_tabs);

            var tabCharacter = new TabContainer(new Vector2i(793, 350));

            tabCharacter.TabSpriteName = "lobby_tab_person";
            _tabs.AddTab(tabCharacter);

            var tabObserve = new TabContainer(new Vector2i(793, 350));

            tabObserve.TabSpriteName = "lobby_tab_eye";
            _tabs.AddTab(tabObserve);

            _tabServer = new PlayerListTab(new Vector2i(793, 350));
            _tabServer.TabSpriteName = "lobby_tab_info";
            _tabs.AddTab(_tabServer);
            _tabs.SelectTab(_tabServer);

            var imgChatBg = new SimpleImage();

            imgChatBg.Sprite    = "lobby_chatbg";
            imgChatBg.Alignment = ControlAlignments.HCenter | ControlAlignments.Bottom;
            imgChatBg.Resize   += (sender, args) => { imgChatBg.LocalPosition = new Vector2i(0, -9 + -imgChatBg.Height); };
            imgMainBg.AddControl(imgChatBg);

            _lobbyChat                   = new Chatbox(new Vector2i(780, 225));
            _lobbyChat.Alignment         = ControlAlignments.HCenter | ControlAlignments.VCenter;
            _lobbyChat.DefaultChatFormat = "ooc \"{0}\"";
            imgChatBg.AddControl(_lobbyChat);

            var btnReady = new ImageButton();

            btnReady.ImageNormal = "lobby_ready";
            btnReady.ImageHover  = "lobby_ready_green";
            btnReady.Alignment   = ControlAlignments.Right;
            btnReady.Resize     += (sender, args) => { btnReady.LocalPosition = new Vector2i(-5 + -btnReady.Width, -5 + -btnReady.Height); };
            imgChatBg.AddControl(btnReady);
            btnReady.Clicked += _btnReady_Clicked;

            var btnBack = new ImageButton();

            btnBack.ImageNormal = "lobby_back";
            btnBack.ImageHover  = "lobby_back_green";
            btnBack.Resize     += (sender, args) => { btnBack.LocalPosition = new Vector2i(-5 + -btnBack.Width, 0); };
            btnReady.AddControl(btnBack);
            btnBack.Clicked += _btnBack_Clicked;
        }