Ejemplo n.º 1
0
        /// <summary>
        /// Scene initialization
        /// </summary>
        protected override void OnInitialize()
        {
            var device = AlmiranteEngine.Device;
            this.background = new Texture2D(device, 1, 1);
            this.background.SetData(new Color[] { Color.FromNonPremultiplied(0, 0, 0, 255) });
            this.map = AlmiranteEngine.Resources.LoadSync<Texture2D>("Objects\\Back");

            this.text = new Textbox()
            {
                Size = new Vector2(620, 30),
                Position = new Vector2(10, 720 - 40),
                MaxLength = 60
            };
            this.text.KeyDown += OnKeyDown;
            this.text.Enter += OnFocus;
            this.text.Leave += OnUnfocus;

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

            this.chat = new Chat()
            {
                Size = new Vector2(620, 620),
                Position = new Vector2(10, 720 - 40 - 10 - 620),
                MaxEntries = 50
            };
            this.Interface.Controls.Add(this.chat);

            Player.Instance.Protocol.Subscribe<PlayerMessage>(this.OnMessage);
        }
Ejemplo n.º 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);

        }