Пример #1
0
    private void LoginInterface()
    {
        GUI.Box(new Rect(Position.x - Size.x / 2, Position.y - Size.y / 2, Size.x, Size.y), "");

        // Account Name
        GUI.Label(new Rect(
                      Position.x - Size.x / 2 + AccountNameLabelIntent.x,
                      Position.y + AccountNameLabelIntent.y,
                      Size.x,
                      20
                      ),
                  "Account Name");
        accountName = GUI.TextField(new Rect(
                                        Position.x - Size.x / 2 + TextFieldIntentWidth / 2.0f + AccountNameTextFieldIntent.x,
                                        Position.y + AccountNameTextFieldIntent.y,
                                        Size.x - TextFieldIntentWidth,
                                        AccountNameTextfieldHeight
                                        ),
                                    accountName,
                                    MaxTextFieldCharacters);

        // Password
        GUI.Label(new Rect(
                      Position.x - Size.x / 2 + PasswordLabelIntent.x,
                      Position.y + PasswordLabelIntent.y,
                      Size.x,
                      20
                      ),
                  "Password");
        password = GUI.TextField(new Rect(
                                     Position.x - Size.x / 2 + TextFieldIntentWidth / 2.0f + PasswordTextFieldIntent.x,
                                     Position.y + PasswordTextFieldIntent.y,
                                     Size.x - TextFieldIntentWidth,
                                     PasswordTextfieldHeight
                                     ),
                                 password,
                                 MaxTextFieldCharacters);

        // Buttons
        if (GUI.Button(new Rect(
                           Position.x - Size.x / 2 + TextFieldIntentWidth / 2.0f + LoginButtonIntent.x,
                           Position.y + LoginButtonIntent.y,
                           Size.x - TextFieldIntentWidth,
                           LoginButtonHeight
                           ),
                       "Login"))
        {
            ClientInterface client = this.GetComponent <ClientInterface>();
            client.Login();
        }

        // CheckBox
        rememberAccount = GUI.Toggle(new Rect(
                                         Position.x - Size.x / 2 + TextFieldIntentWidth / 2.0f + RememberAccountIntent.x,
                                         Position.y + RememberAccountIntent.y,
                                         Size.x - TextFieldIntentWidth,
                                         20
                                         ),
                                     rememberAccount,
                                     "Remember Account Name");
    }