Example #1
0
        /// <summary>
        /// Initialization
        /// </summary>
        protected override void OnInitialize()
        {
            var device = AlmiranteEngine.Device;
            this.overlay = new Texture2D(device, 1, 1);
            this.overlay.SetData(new Color[] { Color.FromNonPremultiplied(0, 0, 0, 255) });

            var labellogin = new Label()
            {
                Text = "Connection failed. Reconnect?",
                Visible = true,
                Size = new Vector2(250, 15),
                Position = new Vector2(1280 / 2, (720 - 15) / 2),
                Alignment = FontAlignment.Center
            };
            this.Interface.Controls.Add(labellogin);

            this.yes = new Button()
            {
                Text = "Enter",
                Visible = true,
                Size = new Vector2(120, 30),
                Position = new Vector2((1280 - 250) / 2, ((720 - 15) / 2) + 40)
            };
            this.yes.MouseClick += OnYes;
            this.Interface.Controls.Add(this.yes);

            this.no = new Button()
            {
                Text = "Exit",
                Visible = true,
                Size = new Vector2(120, 30),
                Position = new Vector2(((1280 - 250) / 2) + 145, ((720 - 15) / 2) + 40)
            };
            this.no.MouseClick += OnNo;
            this.Interface.Controls.Add(this.no);
        }
Example #2
0
        /// <summary>
        /// Initialization
        /// </summary>
        protected override void OnInitialize()
        {
            var device = AlmiranteEngine.Device;
            this.overlay = new Texture2D(device, 1, 1);
            this.overlay.SetData(new Color[] { Color.FromNonPremultiplied(0, 0, 0, 255) });

            ///
            /// Name panel
            ///

            this.panel_login = new Control()
            {
                Size = new Vector2(250, 250),
                Position = new Vector2((1280 - 250) / 2, (720 - 250) / 2)
            };

            var labellogin = new Label()
            {
                Text = "Name:",
                Visible = true,
                Size = new Vector2(250, 15),
                Position = new Vector2(0, 0)
            };
            this.panel_login.Controls.Add(labellogin);

            this.textname = new Textbox()
            {
                Visible = true,
                Size = new Vector2(250, 30),
                Position = labellogin.Position + new Vector2(0, 30)
            };
            this.panel_login.Controls.Add(this.textname);

            this.enter = new Button()
            {
                Text = "Enter",
                Visible = true,
                Size = new Vector2(120, 30),
                Position = textname.Position + new Vector2(0, 40)
            };
            this.enter.MouseClick += OnEnter;
            this.panel_login.Controls.Add(this.enter);

            this.back = new Button()
            {
                Text = "Back",
                Visible = true,
                Size = new Vector2(120, 30),
                Position = textname.Position + new Vector2(130, 40)
            };
            this.back.MouseClick += OnBack;
            this.panel_login.Controls.Add(this.back);

            this.Interface.Controls.Add(this.panel_login);

            ///
            /// Message
            ///

            this.message_label = new Label()
            {
                Size = new Vector2(600, 15),
                Position = new Vector2(300, 0),
                Alignment = FontAlignment.Center,
                Text = "?"
            };

            this.message_button = new Button()
            {
                Size = new Vector2(100, 30), 
                Position = new Vector2(250, 30),
                Text = "OK"
            };

            this.message_panel = new Control()
            {
                Size = new Vector2(600, 50),
                Position = new Vector2((1280 - 600) / 2, (720 - 50) / 2),
                Visible = false
            };

            this.message_panel.Controls.Add(this.message_label);
            this.message_panel.Controls.Add(this.message_button);

            this.Interface.Controls.Add(this.message_panel);

            ///
            /// Messages
            ///

            Player.Instance.Protocol.Subscribe<JoinResponse>(this.OnJoinResponse);

        }