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()); }
public override bool Init() { _drawOptional = false; _menuBt = new Button("", Vector2.Zero, new Rectangle(0, 0, (int)(255 * 0.75f), (int)(255 * 0.75f)), 0.0f); _menuBt.CenterAlignment(new Rectangle(0, 0, Consts.VIEWPORT_WIDTH, Consts.VIEWPORT_HEIGHT)); _exitButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 40, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 1.0f); _soloBt = new Button("", Vector2.Zero, new Rectangle(0, 0, (int)(256 * 0.75f), (int)(54 * 0.75f)), 0.0f); _cusBattleBt = new Button("", new Vector2(100, 100), new Rectangle(0, 0, (int)(256 * 0.75f), (int)(54 * 0.75f)), 0.0f); _sOptionalButton = new Button("", new Vector2(Consts.VIEWPORT_WIDTH - 80, Consts.VIEWPORT_HEIGHT - 40), new Rectangle(0, 0, 40, 40), 0.0f); _exitButton.CMD(Consts.UI_CMD_CHANGE_TO_EXIT_BUTTON); _soloBt.CMD(Consts.UI_CMD_CHANGE_TO_SOLO_BUTTON); _cusBattleBt.CMD(Consts.UI_CMD_CHANGE_TO_CUSTUME_BATTLE_BUTTON); _soloBt.CMD(Consts.UI_CMD_DISABLE); _cusBattleBt.CMD(Consts.UI_CMD_DISABLE); AlignButton(); _sBg = new SBackground(); return(base.Init()); }
public MenuScene(ContentManager contents) : base(Constants.SCENE_MENU, contents) { //image = null; colorPlayB = new Color(255, 255, 255, 255); colorExitB = new Color(255, 255, 255, 255); colorSoundB = new Color(255, 255, 255, 255); playButtonPos = new Vector2(0, 0); exitButtonPos = new Vector2(0, 50); soundButtonPos = new Vector2(0, 100); sBG = new SBackground(); sE = new SEffect(); }
public override bool Init() { // add controller _network.AddController(Consts.CTRL_TANK, new TankController(_contents)); _network.AddController(Consts.CTRL_BULLET, new BulletController(_contents)); _network.AddController(Consts.CTRL_ITEM, new ItemController(_contents)); _readyButton = new Button("", new Vector2(0, 0), new Rectangle(0, 0, 100, 100), 2.0f); _playButton = new Button("", new Vector2(0, 0), new Rectangle(0, 0, 100, 100), 2.0f); // _sBg = new SBackground(); _usersInsideRoom = new List <User>(); _names = new List <string>(); _isEnablePlayButton = false; _namePlates = new NamePlateManager(); _namePlates.Init(); return(base.Init()); }
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()); }