コード例 #1
0
        ///////////////////////////////////////////

        protected override void OnAttach()
        {
            base.OnAttach();

            //create window
            window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\RegisterWindow.gui");
            Controls.Add(window);

            MouseCover = true;
            BackColor = new ColorValue(0, 0, 0, .5f);

            RealName = (EditBox)window.Controls["RealName"];
            UserName = (EditBox)window.Controls["UserName"];
            
            //Age = (EditBox)window.Controls["Age"];
            //OfAge = (CheckBox)window.Controls["OfAge"];

            Pass1 = (PasswordBox)window.Controls["Pass1"];
            Pass2 = (PasswordBox)window.Controls["Pass2"];
            Email = (EditBox)window.Controls["Email"];

            ((Button)window.Controls["Exit"]).Click += Exit_Click;
            ((Button)window.Controls["Register"]).Click += Register_Click;
            ((Button)window.Controls["Cancel"]).Click += Cancel_Click;
        }
コード例 #2
0
        ///////////////////////////////////////////

        protected override void OnAttach()
        {
            base.OnAttach();

            //disable check for disconnection
            GameEngineApp.Instance.Client_AllowCheckForDisconnection = false;

            //register config fields
            EngineApp.Instance.Config.RegisterClassParameters(GetType());

            //create window
            window = ControlDeclarationManager.Instance.CreateControl(
                "Gui\\MultiplayerLoginWindow.gui");
            Controls.Add(window);

            //MouseCover = true;
            //BackColor = new ColorValue( 0, 0, 0, .5f );

            //initialize controls

            buttonConnect = (Button)window.Controls["Connect"];
            buttonConnect.Click += Connect_Click;

            //( (Button)window.Controls[ "Exit" ] ).Click += Exit_Click;
            //Quit button event handler
            ((Button)window.Controls["Exit"]).Click += delegate(Button sender)
            {
                SetShouldDetach();
                //Back(true);
            };

            //positionY = maxout;

            //generate user name
            if (string.IsNullOrEmpty(userName))
            {
                EngineRandom random = new EngineRandom();
                userName = "******" + random.Next(1000).ToString("D03");
            }

            savePass = (CheckBox)window.Controls["savePass"];

            editBoxUserPass = (PasswordBox)window.Controls["password"];
            if (!string.IsNullOrEmpty(password))
            {
                editBoxUserPass.Text = password;
                savePass.Checked = true;
            }

            //configure password feature
            editBoxUserPass.UpdatingTextControl = delegate(EditBox sender, ref string text)
            {
                text = new string('*', sender.Text.Length);
                if (sender.Focused)
                    text += "_";
                savePass.Checked = true;
            };

            //editBoxUserPass.TextChange += passwordEditBox_TextChange;

            savePass.CheckedChange += savePass_CheckedChange;

            editBoxUserPass.TextChange += editBoxUserPass_TextChange;

            editBoxUserName = (EditBox)window.Controls["UserName"];
            editBoxUserName.Text = userName;
            editBoxUserName.TextChange += editBoxUserName_TextChange;

            ((Button)window.Controls["Register"]).Click += Register_Click;

            SetInfo("", false);
        }
コード例 #3
0
        protected override void OnAttach()
        {
            window = ControlDeclarationManager.Instance.CreateControl("Gui\\MPAKlobbyWindow.gui");
            Controls.Add(window);

            //positionY = maxout;

            listBox = (ListBox)window.Controls["Servers"];

            ((Button)window.Controls["Quit"]).Click += delegate(Button sender)
            {
                SetShouldDetach();// Back(true);
            };

            //positionY = maxout;

            ((Button)window.Controls["TechLab"]).Click += delegate(Button sender)
            {
                this.OnDetach();
                Controls.Add(new TechLabUnitBuyWindow());
            };

            ((Button)window.Controls["Refresh"]).Click += delegate(Button sender)
            {
                refreshlistbox();
            };

            ((Button)window.Controls["Customize"]).Click += delegate(Button sender)
            {
                this.OnDetach();
                Controls.Add(new TechLabUnitCustomizeWindow());
            };

            //Run button event handler
            ((Button)window.Controls["Run"]).Click += delegate(Button sender)
            {
                if (listBox.SelectedIndex != -1)
                    RunMap(AKSERVERS[listBox.SelectedIndex]);
            };

            createServerPort = window.Controls["Serverport"] as EditBox;
            if (createServerPort != null)
            {
                createServerPort.TextChange += delegate(Control sender)
                {
                    createServerPort.TextChange += createServerPort_TextChange;
                };
                createserverport = int.Parse(createServerPort.Text.Trim());
            }

            PassBox = window.Controls["passwordBox"] as PasswordBox;
            if (PassBox != null)
            {
                PassBox.TextChange += delegate(Control sender)
                {
                    PassBox.TextChange += PassBox_TextChange;
                    if (PassBox.Text.Length > 0)
                    {
                        clientpassword = PassBox.Text.Trim();
                        serverpassword = clientpassword;
                    }
                    else
                    {
                        clientpassword = serverpassword = "";
                    }
                };
            }

            CheckPrivate = window.Controls["chkserverPrivate"] as CheckBox;
            if (CheckPrivate != null)
            {
                CheckPrivate.CheckedChange += delegate(CheckBox sender)
                {
                    if (CheckPrivate.Checked == true)
                    {
                        privateserver = true;
                        SetInfo("Server set to private", false);
                    }
                    else
                    {
                        privateserver = false;
                    }
                };
            }

            EditBox IPtext = window.Controls["DirectConnectionTextBox"] as EditBox;

            ((Button)window.Controls["DirectIPCon"]).Click += delegate(Button sender)
            {
                GameNetworkClient client = new GameNetworkClient(true);
                client.ConnectionStatusChanged += Client_ConnectionStatusChanged;
                string error;
                if (!client.BeginConnect(IPtext.Text.ToString(), int.Parse(createserverport.ToString()), EngineVersionInformation.Version,
                    Program.username, clientpassword, out error))
                {
                    Log.Error(error);
                    DisposeClient();
                    return;
                }
            };

            ((Button)window.Controls["singlePlayer"]).Click += delegate(Button sender)
            {
                GameEngineApp.Instance.SetNeedMapLoad("Maps\\MainDemo\\Map.map");
            };

            //TextBox ComWelN = window.Controls["ComWelNote"] as TextBox;
            //if (ComWelN != null)
            //{
            //    ComWelN.Text = "Welcome Commander " + MySqlGetUserName();
            //}

            buttonCreateServer = (Button)window.Controls["CreateServer"];
            buttonCreateServer.Click += CreateServer_Click;

            //refreshlistbox();

            base.OnAttach();
        }