コード例 #1
0
        void ReleaseDesignerOutlets()
        {
            if (FacebookBtn != null)
            {
                FacebookBtn.Dispose();
                FacebookBtn = null;
            }

            if (GoogleBtn != null)
            {
                GoogleBtn.Dispose();
                GoogleBtn = null;
            }

            if (LoginBtn != null)
            {
                LoginBtn.Dispose();
                LoginBtn = null;
            }

            if (LoginDesc != null)
            {
                LoginDesc.Dispose();
                LoginDesc = null;
            }

            if (LoginPlaceholder != null)
            {
                LoginPlaceholder.Dispose();
                LoginPlaceholder = null;
            }

            if (LoginTitle != null)
            {
                LoginTitle.Dispose();
                LoginTitle = null;
            }

            if (MicrosoftBtn != null)
            {
                MicrosoftBtn.Dispose();
                MicrosoftBtn = null;
            }
        }
コード例 #2
0
        protected override void OnLoad()
        {
            base.OnLoad();

            MMW.FindGameComponent <BackgroundScript>().Trans(new Color4(148, 222, 148, 255), 0.25);

            input       = new MenuInputResolver();
            input.Up    = Key.W;
            input.Down  = Key.S;
            input.Right = Key.D;
            input.Left  = Key.A;

            transit = new TransitControl();
            transit.LocalLocation = new Vector2(MMW.ClientSize.Width * 2.0f, 0);
            transit.Size          = new Vector2(MMW.ClientSize.Width, MMW.ClientSize.Height);
            transit.Target        = Vector2.Zero;

            var labelTitle = new Label()
            {
                Parent        = transit,
                Alignment     = ContentAlignment.TopCenter,
                Text          = "WORLD INFO",
                Font          = new Font("Yu Gothic UI Light", 40.0f),
                LocalLocation = new Vector2(0.0f, 32.0f),
            };

            Controls.Add(labelTitle);

            var imgWorld = new PictureBox()
            {
                Parent        = transit,
                Image         = Util.FromBitmapString(Info.WorldImage),
                LocalLocation = new Vector2(100.0f, 0.0f),
                Size          = new Vector2((MMW.Width * 0.5f) - 200.0f, MMW.Height - 280.0f),
                Alignment     = ContentAlignment.MiddleLeft,
                SizeMode      = SizeMode.Zoom,
            };

            Controls.Add(imgWorld);

            var labelWorldNameTitle = new Label()
            {
                Parent        = transit,
                Text          = "World Name",
                LocalLocation = new Vector2(MMW.Width * 0.5f, 146.0f),
                Font          = new Font("Yu Gothic UI", 14.0f, FontStyle.Bold),
            };

            Controls.Add(labelWorldNameTitle);

            var textWorldName = new TextBox(transit, Info.WorldName, new Vector2(MMW.Width * 0.5f, 175.0f), new Vector2(MMW.Width * 0.5f - 100.0f, 32.0f));

            textWorldName.Readonly = true;
            Controls.Add(textWorldName);

            var labelWorldDescTitle = new Label()
            {
                Parent        = transit,
                Text          = "World Desc",
                LocalLocation = new Vector2(MMW.Width * 0.5f, 216.0f),
                Font          = new Font("Yu Gothic UI", 14.0f, FontStyle.Bold),
            };

            Controls.Add(labelWorldDescTitle);

            var textWorldDesc = new TextBox(transit, Info.WorldDesc, new Vector2(MMW.Width * 0.5f, 245.0f), new Vector2(MMW.Width * 0.5f - 100.0f, MMW.Height - 420.0f));

            textWorldDesc.Readonly = true;
            Controls.Add(textWorldDesc);

            TextBox2 textboxPass = null;

            if (Info.WorldPass)
            {
                var labelPass = new Label(textWorldDesc, "Password", new Vector2(0.0f, MMW.Height - 420.0f + 10.0f));
                Controls.Add(labelPass);

                textboxPass = new TextBox2(labelPass, "", new Vector2(100.0f, 0.0f), new Vector2(200.0f, 32.0f));
                Controls.Add(textboxPass);
            }


            var btnJoin = new Button(textWorldDesc, "Join", new Vector2(MMW.Width * 0.5f - 200.0f, MMW.Height - 420.0f + 10.0f), new Vector2(100.0f, 32.0f), "click");

            Controls.Add(btnJoin);

            labelInfo = new Label(btnJoin, "", new Vector2(0.0f, 30.0f));
            Controls.Add(labelInfo);

            btnJoin.Clicked += (s, e) =>
            {
                AcceptInput = false;

                var loginDesc = new LoginDesc()
                {
                    UserName  = "******",
                    UserColor = new Color4f()
                    {
                    },
                };
                if (Info.WorldPass)
                {
                    loginDesc.Password = textboxPass.Text;
                }

                //Server.LoginResultReceived += Server_LoginResultReceived;

                var json = Util.SerializeJson(loginDesc);
                Server.SendTcp(Walker.DataType.Login, json);
                //Server.ReceiveTimeout = 5 * 1000;

                labelInfo.Text  = "Logging In...";
                labelInfo.Brush = Brushes.White;
            };
        }