예제 #1
0
파일: Login.cs 프로젝트: xPanini/HEROsMod
        public LoginWindow()
        {
            UIView.exclusiveControl = this;

            Width       = 600;
            this.Anchor = AnchorPosition.Center;

            lUsername              = new UILabel(HEROsMod.HeroText("Username"));
            tbUsername             = new UITextbox();
            lPassword              = new UILabel(HEROsMod.HeroText("Password"));
            tbPassword             = new UITextbox();
            tbPassword.PasswordBox = true;
            UIButton bLogin    = new UIButton(HEROsMod.HeroText("Login"));
            UIButton bCancel   = new UIButton(HEROsMod.HeroText("Cancel"));
            UIButton bRegister = new UIButton(HEROsMod.HeroText("Register"));

            bRegister.AutoSize = false;
            bRegister.Width    = 100;

            lUsername.Scale = .5f;
            lPassword.Scale = .5f;

            bLogin.Anchor  = AnchorPosition.TopRight;
            bCancel.Anchor = AnchorPosition.TopRight;

            lUsername.X  = spacing;
            lUsername.Y  = spacing;
            tbUsername.X = lUsername.X + lUsername.Width + spacing;
            tbUsername.Y = lUsername.Y;
            lPassword.X  = lUsername.X;
            lPassword.Y  = lUsername.Y + lUsername.Height + spacing;
            tbPassword.X = tbUsername.X;
            tbPassword.Y = lPassword.Y;

            bCancel.Position = new Vector2(this.Width - spacing, tbPassword.Y + tbPassword.Height + spacing);
            bLogin.Position  = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);
            bRegister.X      = spacing;
            bRegister.Y      = bCancel.Y;
            this.Height      = bCancel.Y + bCancel.Height + spacing;

            bCancel.onLeftClick     += bCancel_onLeftClick;
            bLogin.onLeftClick      += bLogin_onLeftClick;
            bRegister.onLeftClick   += bRegister_onLeftClick;
            tbUsername.OnEnterPress += bLogin_onLeftClick;
            tbPassword.OnEnterPress += bLogin_onLeftClick;
            tbUsername.OnTabPress   += tbUsername_OnTabPress;
            tbPassword.OnTabPress   += tbPassword_OnTabPress;

            AddChild(lUsername);
            AddChild(tbUsername);
            AddChild(lPassword);
            AddChild(tbPassword);
            AddChild(bLogin);
            AddChild(bCancel);
            AddChild(bRegister);

            tbUsername.Focus();
        }
예제 #2
0
        public NameWaypointWindow(Vector2 waypointPos)
        {
            this.waypointPos        = waypointPos;
            UIView.exclusiveControl = this;

            Width       = 600;
            Height      = 100;
            this.Anchor = AnchorPosition.Center;

            label   = new UILabel("Waypoint Name");
            textbox = new UITextbox();
            UIButton bSave   = new UIButton("Ok");
            UIButton bCancel = new UIButton("Cancel");

            label.Scale = .5f;

            label.Anchor   = AnchorPosition.Left;
            textbox.Anchor = AnchorPosition.Left;
            bSave.Anchor   = AnchorPosition.BottomRight;
            bCancel.Anchor = AnchorPosition.BottomRight;

            float tby = textbox.Height / 2 + spacing;

            label.Position   = new Vector2(spacing, tby);
            textbox.Position = new Vector2(label.Position.X + label.Width + spacing, tby);
            bCancel.Position = new Vector2(this.Width - spacing, this.Height - spacing);
            bSave.Position   = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);

            bCancel.onLeftClick  += bCancel_onLeftClick;
            bSave.onLeftClick    += bSave_onLeftClick;
            textbox.OnEnterPress += bSave_onLeftClick;

            AddChild(label);
            AddChild(textbox);
            AddChild(bSave);
            AddChild(bCancel);

            textbox.Focus();
        }
예제 #3
0
        public NewGroupWindow()
        {
            UIView.exclusiveControl = this;

            Width       = 600;
            Height      = 100;
            this.Anchor = AnchorPosition.Center;

            label   = new UILabel(HEROsMod.HeroText("GroupName") + ":");
            textbox = new UITextbox();
            UIButton bSave   = new UIButton(HEROsMod.HeroText("Create"));
            UIButton bCancel = new UIButton(HEROsMod.HeroText("Cancel"));

            label.Scale = .5f;

            label.Anchor   = AnchorPosition.Left;
            textbox.Anchor = AnchorPosition.Left;
            bSave.Anchor   = AnchorPosition.BottomRight;
            bCancel.Anchor = AnchorPosition.BottomRight;

            float tby = textbox.Height / 2 + spacing;

            label.Position   = new Vector2(spacing, tby);
            textbox.Position = new Vector2(label.Position.X + label.Width + spacing, tby);
            bCancel.Position = new Vector2(this.Width - spacing, this.Height - spacing);
            bSave.Position   = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);

            bCancel.onLeftClick  += bCancel_onLeftClick;
            bSave.onLeftClick    += bSave_onLeftClick;
            textbox.OnEnterPress += bSave_onLeftClick;

            AddChild(label);
            AddChild(textbox);
            AddChild(bSave);
            AddChild(bCancel);

            textbox.Focus();
        }
예제 #4
0
파일: Login.cs 프로젝트: xPanini/HEROsMod
 private void tbUsername_OnTabPress(object sender, EventArgs e)
 {
     tbUsername.Unfocus();
     tbPassword.Focus();
 }