예제 #1
0
        public PropEditWindow(Vector2i size, IEntity entity)
            : base($"Entity Properties: [{entity.Uid}]{entity.Name}", size)
        {
            _entity = entity;

            search = new Textbox(150);
            search.LocalPosition      = new Vector2i(5, 5);
            search.OnSubmit          += search_OnSubmit;
            search.ClearOnSubmit      = true;
            search.ClearFocusOnSubmit = false;
            Container.AddControl(search);

            _fieldList = new ListPanel();
            _fieldList.LocalPosition = new Vector2i(5, 0);
            _fieldList.Alignment     = ControlAlignments.Bottom;
            search.AddControl(_fieldList);

            BuildPropList(_fieldList);
        }
예제 #2
0
        /// <inheritdoc />
        public override void InitializeGUI()
        {
            _client = IoCManager.Resolve <IBaseClient>();

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

            var imgTitle = new SimpleImage();

            imgTitle.Sprite        = "ss14_logo";
            imgTitle.Alignment     = ControlAlignments.Right;
            imgTitle.LocalPosition = new Vector2i(-550, 100);
            _uiScreen.AddControl(imgTitle);

            var txtConnect = new Textbox(100);

            txtConnect.Text          = ConfigurationManager.GetCVar <string>("net.server");
            txtConnect.Alignment     = ControlAlignments.Left | ControlAlignments.Bottom;
            txtConnect.LocalPosition = new Vector2i(10, 50);
            txtConnect.OnSubmit     += (sender, text) =>
            {
                if (_client.RunLevel == ClientRunLevel.Initialize)
                {
                    if (TryParseAddress(text, out var ip, out var port))
                    {
                        _client.ConnectToServer(ip, port);
                    }
                }
                //TODO: Else notify user that textbox address is not valid
            };
            imgTitle.AddControl(txtConnect);

            var btnConnect = new ImageButton();

            btnConnect.ImageNormal   = "connect_norm";
            btnConnect.ImageHover    = "connect_hover";
            btnConnect.Alignment     = ControlAlignments.Left | ControlAlignments.Bottom;
            btnConnect.LocalPosition = new Vector2i(0, 20);
            btnConnect.Clicked      += sender =>
            {
                if (_client.RunLevel == ClientRunLevel.Initialize)
                {
                    if (TryParseAddress(txtConnect.Text, out var ip, out var port))
                    {
                        _client.ConnectToServer(ip, port);
                    }
                }
            };
            txtConnect.AddControl(btnConnect);

            var btnOptions = new ImageButton();

            btnOptions.ImageNormal   = "options_norm";
            btnOptions.ImageHover    = "options_hover";
            btnOptions.Alignment     = ControlAlignments.Left | ControlAlignments.Bottom;
            btnOptions.LocalPosition = new Vector2i(0, 20);
            btnOptions.Clicked      += sender =>
            {
                if (_client.RunLevel <= ClientRunLevel.Initialize)
                {
                    StateManager.RequestStateChange <OptionsMenu>();
                }
            };
            btnConnect.AddControl(btnOptions);

            var btnExit = new ImageButton();

            btnExit.ImageNormal   = "exit_norm";
            btnExit.ImageHover    = "exit_hover";
            btnExit.Alignment     = ControlAlignments.Left | ControlAlignments.Bottom;
            btnExit.LocalPosition = new Vector2i(0, 20);
            btnExit.Clicked      += sender => CluwneLib.Stop();
            btnOptions.AddControl(btnExit);

            var fvi        = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
            var lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI");

            lblVersion.ForegroundColor = new Color(245, 245, 245);
            lblVersion.Alignment       = ControlAlignments.Right | ControlAlignments.Bottom;
            lblVersion.Resize         += (sender, args) => { lblVersion.LocalPosition = new Vector2i(-3 + -lblVersion.ClientArea.Width, -3 + -lblVersion.ClientArea.Height); };
            _uiScreen.AddControl(lblVersion);
        }
예제 #3
0
        /// <inheritdoc />
        public override void InitializeGUI()
        {
            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // UI screen is added in startup

            var imgTitle = new SimpleImage();

            imgTitle.Sprite        = "ss14_logo";
            imgTitle.Alignment     = Align.Right;
            imgTitle.LocalPosition = new Vector2i(-550, 100);
            _uiScreen.AddControl(imgTitle);

            var txtConnect = new Textbox(100);

            txtConnect.Text          = ConfigurationManager.GetCVar <string>("net.server");
            txtConnect.Alignment     = Align.Left | Align.Bottom;
            txtConnect.LocalPosition = new Vector2i(10, 50);
            txtConnect.OnSubmit     += (sender, text) => { StartConnect(text); };
            imgTitle.AddControl(txtConnect);

            var btnConnect = new ImageButton();

            btnConnect.ImageNormal   = "connect_norm";
            btnConnect.ImageHover    = "connect_hover";
            btnConnect.Alignment     = Align.Left | Align.Bottom;
            btnConnect.LocalPosition = new Vector2i(0, 20);
            btnConnect.Clicked      += sender =>
            {
                if (!_isConnecting)
                {
                    StartConnect(txtConnect.Text);
                }
                else
                {
                    _isConnecting = false;
                    NetworkManager.ClientDisconnect("Client disconnected from game.");
                }
            };
            txtConnect.AddControl(btnConnect);

            var btnOptions = new ImageButton();

            btnOptions.ImageNormal   = "options_norm";
            btnOptions.ImageHover    = "options_hover";
            btnOptions.Alignment     = Align.Left | Align.Bottom;
            btnOptions.LocalPosition = new Vector2i(0, 20);
            btnOptions.Clicked      += sender =>
            {
                if (_isConnecting)
                {
                    _isConnecting = false;
                    NetworkManager.ClientDisconnect("Client disconnected from game.");
                }

                StateManager.RequestStateChange <OptionsMenu>();
            };
            btnConnect.AddControl(btnOptions);

            var btnExit = new ImageButton();

            btnExit.ImageNormal   = "exit_norm";
            btnExit.ImageHover    = "exit_hover";
            btnExit.Alignment     = Align.Left | Align.Bottom;
            btnExit.LocalPosition = new Vector2i(0, 20);
            btnExit.Clicked      += sender => CluwneLib.Stop();
            btnOptions.AddControl(btnExit);

            var fvi        = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
            var lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI");

            lblVersion.ForegroundColor = new Color(245, 245, 245);
            lblVersion.Alignment       = Align.Right | Align.Bottom;
            lblVersion.Resize         += (sender, args) => { lblVersion.LocalPosition = new Vector2i(-3 + -lblVersion.ClientArea.Width, -3 + -lblVersion.ClientArea.Height); };
            _uiScreen.AddControl(lblVersion);

#if uiDev
            var chat = new Chatbox(new Vector2i(400, 200));
            chat.LocalPosition = new Vector2i(25, 25);
            _uiScreen.AddControl(chat);

            var listPanel = new ListPanel();
            listPanel.Size          = new Vector2i(200, 200);
            listPanel.LocalPosition = new Vector2i(450, 250);
            _uiScreen.AddControl(listPanel);

            for (var i = 0; i < 5; i++)
            {
                var label = new Label($"Label: {i}", "CALIBRI");
                listPanel.AddControl(label);
            }
            var rtp = new RichTextPanel();
            rtp.Size            = new Vector2i(400, 200);
            rtp.LocalPosition   = new Vector2i(25, 250);
            rtp.BackgroundColor = Color4.DarkGray;
            rtp.ForegroundColor = new Color4(230, 230, 230, 255);
            rtp.DrawBorder      = true;
            rtp.DrawBackground  = true;
            _uiScreen.AddControl(rtp);

            rtp.Text.Append("Textbox says, \"Oh, my, God Becky, look at the image.\"\n");
            rtp.Text.Append("Textbox says, \"It is so big, it looks like, one of those buttons' girlfriends.\"\n");
            rtp.Text.Append("Textbox says, \"I mean, the image, is just so big. I can't believe it's just so square, it's like out there.\"\n");
            rtp.Text.Append("Textbox says, \"I mean gross, look. It's just so, black!\"\n");
#endif
        }
예제 #4
0
        /// <inheritdoc />
        public override void InitializeGUI()
        {
            _uiScreen = new Screen();
            _uiScreen.BackgroundImage = ResourceCache.GetSprite("ss14_logo_background");
            // UI screen is added in startup

            var imgTitle = new SimpleImage();

            imgTitle.Sprite        = "ss14_logo";
            imgTitle.Alignment     = Align.Right;
            imgTitle.LocalPosition = new Vector2i(-550, 100);
            _uiScreen.AddControl(imgTitle);

            var txtConnect = new Textbox(100);

            txtConnect.Text          = ConfigurationManager.GetCVar <string>("net.server");
            txtConnect.Alignment     = Align.Left | Align.Bottom;
            txtConnect.LocalPosition = new Vector2i(10, 50);
            txtConnect.OnSubmit     += (sender, text) => { StartConnect(text); };
            imgTitle.AddControl(txtConnect);

            var btnConnect = new ImageButton();

            btnConnect.ImageNormal   = "connect_norm";
            btnConnect.ImageHover    = "connect_hover";
            btnConnect.Alignment     = Align.Left | Align.Bottom;
            btnConnect.LocalPosition = new Vector2i(0, 20);
            btnConnect.Clicked      += sender =>
            {
                if (!_isConnecting)
                {
                    StartConnect(txtConnect.Text);
                }
                else
                {
                    _isConnecting = false;
                    NetworkManager.ClientDisconnect("Client disconnected from game.");
                }
            };
            txtConnect.AddControl(btnConnect);

            var btnOptions = new ImageButton();

            btnOptions.ImageNormal   = "options_norm";
            btnOptions.ImageHover    = "options_hover";
            btnOptions.Alignment     = Align.Left | Align.Bottom;
            btnOptions.LocalPosition = new Vector2i(0, 20);
            btnOptions.Clicked      += sender =>
            {
                if (_isConnecting)
                {
                    _isConnecting = false;
                    NetworkManager.ClientDisconnect("Client disconnected from game.");
                }

                StateManager.RequestStateChange <OptionsMenu>();
            };
            btnConnect.AddControl(btnOptions);

            var btnExit = new ImageButton();

            btnExit.ImageNormal   = "exit_norm";
            btnExit.ImageHover    = "exit_hover";
            btnExit.Alignment     = Align.Left | Align.Bottom;
            btnExit.LocalPosition = new Vector2i(0, 20);
            btnExit.Clicked      += sender => CluwneLib.Stop();
            btnOptions.AddControl(btnExit);

            var fvi        = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
            var lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI");

            lblVersion.ForegroundColor = new Color(245, 245, 245);
            lblVersion.Alignment       = Align.Right | Align.Bottom;
            lblVersion.Resize         += (sender, args) => { lblVersion.LocalPosition = new Vector2i(-3 + -lblVersion.ClientArea.Width, -3 + -lblVersion.ClientArea.Height); };
            _uiScreen.AddControl(lblVersion);
        }