예제 #1
0
        public override void Draw(SpriteBatch sp)
        {
            sp.Begin();
            if (_background != null)
            {
                sp.Draw(_background,
                        new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT),
                        Color.White);
            }
            _inputName.Draw(sp);
            _inputHost.Draw(sp);
            _inputPort.Draw(sp);

            _loginButton.Draw(sp);
            _exitButton.Draw(sp);
            _sOptionalButton.Draw(sp);
            if (_notice != null)
            {
                sp.DrawString(_font, _notice,
                              new Vector2(_inputName.GetPosition().X, _inputName.GetBoundingBox().Height + _inputName.GetPosition().Y),
                              Color.Red);
            }
            sp.End();
            base.Draw(sp);
        }
예제 #2
0
        public override bool Init()
        {
            _inputName = new InputField(Vector2.Zero, new Rectangle(0, 0, 200, 0), 2f);
            _inputName.CenterAlignment(new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT));

            Vector2   inputPosition = _inputName.GetPosition();
            Rectangle inputRect     = _inputName.GetBoundingBox();

            _loginButton = new Button("Login",
                                      new Vector2(inputPosition.X + inputRect.Width, inputPosition.Y),
                                      new Rectangle(0, 0, 100, 0), 2.0f);
            _exitButton = new Button("",
                                     new Vector2(Consts.VIEWPORT_WIDTH - 40, Consts.VIEWPORT_HEIGHT - 40),
                                     new Rectangle(0, 0, 40, 40), 1.0f);
            _sOptionalButton = new Button("",
                                          new Vector2(Consts.VIEWPORT_WIDTH - 80, Consts.VIEWPORT_HEIGHT - 40),
                                          new Rectangle(0, 0, 40, 40), 0.0f);

            _inputName.SetPosition(inputPosition + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.2f));
            _loginButton.SetPosition(_loginButton.GetPosition() + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.2f));

            _loginButton.CMD(Consts.UI_CMD_CHANGE_TO_LOGIN_BUTTON);
            _exitButton.CMD(Consts.UI_CMD_CHANGE_TO_EXIT_BUTTON);

            _sBg = new SBackground();
            return(base.Init());
        }
예제 #3
0
 private void UpdateInputField(float deltaTime)
 {
     if (InputControl.Input.Clicked(Consts.MOUSEBUTTON_LEFT))
     {
         if (_inputName.CheckInsideUI(_inputName.GetPosition(), _inputName.GetBoundingBox()) && !_inputName.IsEnable())
         {
             DisableInputFields();
             _inputName.CMD(Consts.UI_CMD_ENABLE);
         }
         if (_inputHost.CheckInsideUI(_inputHost.GetPosition(), _inputHost.GetBoundingBox()) && !_inputHost.IsEnable())
         {
             DisableInputFields();
             _inputHost.CMD(Consts.UI_CMD_ENABLE);
         }
         if (_inputPort.CheckInsideUI(_inputPort.GetPosition(), _inputPort.GetBoundingBox()) && !_inputPort.IsEnable())
         {
             DisableInputFields();
             _inputPort.CMD(Consts.UI_CMD_ENABLE);
         }
     }
 }
예제 #4
0
        public override bool Init()
        {
            _inputName = new InputField(Vector2.Zero, new Rectangle(0, 0, 200, 0), 2f);
            _inputName.CenterAlignment(new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT));
            _inputName.SetPosition(_inputName.GetPosition() + new Vector2(0, -Consts.VIEWPORT_HEIGHT * 0.1f));

            Vector2   inputPosition = _inputName.GetPosition();
            Rectangle inputRect     = _inputName.GetBoundingBox();

            _inputHost = new InputField(
                inputPosition + new Vector2(0, -inputRect.Height),
                new Rectangle(0, 0, 200, 0),
                2f, "127.0.0.1");
            _inputPort = new InputField(
                _inputHost.GetPosition() + new Vector2(0, -_inputHost.GetBoundingBox().Height),
                new Rectangle(0, 0, 200, 0),
                2f, "9933");

            _loginButton = new Button("Login",
                                      new Vector2(inputPosition.X + inputRect.Width, inputPosition.Y),
                                      new Rectangle(0, 0, 100, 0), 2.0f);
            _exitButton = new Button("",
                                     new Vector2(Consts.VIEWPORT_WIDTH - 40, Consts.VIEWPORT_HEIGHT - 40),
                                     new Rectangle(0, 0, 40, 40), 1.0f);
            _sOptionalButton = new Button("",
                                          new Vector2(Consts.VIEWPORT_WIDTH - 80, Consts.VIEWPORT_HEIGHT - 40),
                                          new Rectangle(0, 0, 40, 40), 0.0f);
            _sBg = new SBackground();

            _inputPort.SetTextAlignment(0.45f);
            _inputPort.SetTextMaxSize(0.5f);



            return(base.Init());
        }