protected override void InitializeControlsHelper(IControlSet currentControlSet) { _tbAccountName = GetControl(currentControlSet, GameControlIdentifier.CreateAccountName, GetCreateAccountNameTextBox); _tbPassword = GetControl(currentControlSet, GameControlIdentifier.CreateAccountPassword, GetCreateAccountPasswordTextBox); _tbConfirm = GetControl(currentControlSet, GameControlIdentifier.CreateAccountPasswordConfirm, GetCreateAccountConfirmTextBox); _tbRealName = GetControl(currentControlSet, GameControlIdentifier.CreateAccountRealName, GetCreateAccountRealNameTextBox); _tbLocation = GetControl(currentControlSet, GameControlIdentifier.CreateAccountLocation, GetCreateAccountLocationTextBox); _tbEmail = GetControl(currentControlSet, GameControlIdentifier.CreateAccountEmail, GetCreateAccountEmailTextBox); _btnCancel = GetControl(currentControlSet, GameControlIdentifier.CreateAccountCancelButton, GetCreateAccountCancelButton); _labels = GetControl(currentControlSet, GameControlIdentifier.CreateAccountLabels, GetCreateAccountLabels); _allComponents.Add(_tbAccountName); _allComponents.Add(_tbPassword); _allComponents.Add(_tbConfirm); _allComponents.Add(_tbRealName); _allComponents.Add(_tbLocation); _allComponents.Add(_tbEmail); _allComponents.Add(_btnCancel); _allComponents.Add(_labels); var textBoxes = _allComponents.OfType <IXNATextBox>().ToArray(); _clickHandler = new TextBoxClickEventHandler(_dispatcher, textBoxes); _tabHandler = new TextBoxTabEventHandler(_dispatcher, textBoxes); if (_dispatcher.Subscriber != null) { _dispatcher.Subscriber.Selected = false; } _dispatcher.Subscriber = _tbAccountName; _dispatcher.Subscriber.Selected = true; base.InitializeControlsHelper(currentControlSet); }
protected override void InitializeControlsHelper(IControlSet currentControlSet) { base.InitializeControlsHelper(currentControlSet); _loginPanelBackground = GetControl(currentControlSet, GameControlIdentifier.LoginPanelBackground, GetLoginPanelBackground); _tbUsername = GetControl(currentControlSet, GameControlIdentifier.LoginAccountName, GetLoginUserNameTextBox); _tbPassword = GetControl(currentControlSet, GameControlIdentifier.LoginPassword, GetLoginPasswordTextBox); _btnLogin = GetControl(currentControlSet, GameControlIdentifier.LoginButton, GetLoginAccountButton); _btnCancel = GetControl(currentControlSet, GameControlIdentifier.LoginCancel, GetLoginCancelButton); _allComponents.Add(_loginPanelBackground); _allComponents.Add(_tbUsername); _allComponents.Add(_tbPassword); _allComponents.Add(_btnLogin); _allComponents.Add(_btnCancel); _clickHandler = new TextBoxClickEventHandler(_dispatcher, _allComponents.OfType <IXNATextBox>().ToArray()); _tabHandler = new TextBoxTabEventHandler(_dispatcher, _allComponents.OfType <IXNATextBox>().ToArray()); if (_dispatcher.Subscriber != null) { _dispatcher.Subscriber.Selected = false; } _dispatcher.Subscriber = _tbUsername; _dispatcher.Subscriber.Selected = true; }
public CreateCharacterDialog( INativeGraphicsManager nativeGraphicsManager, IGameStateProvider gameStateProvider, ICharacterRendererFactory rendererFactory, ContentManager contentManager, KeyboardDispatcher dispatcher, IEOMessageBoxFactory messageBoxFactory, IEODialogButtonService eoDialogButtonService) : base(gameStateProvider) { _messageBoxFactory = messageBoxFactory; BackgroundTexture = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 20); _charCreateSheet = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 22); var cursorTexture = contentManager.Load <Texture2D>("cursor"); _inputBox = new XNATextBox(new Rectangle(80, 57, 138, 19), Constants.FontSize08, caretTexture: cursorTexture) { LeftPadding = 5, DefaultText = " ", Text = " ", MaxChars = 12, Selected = true, TextColor = ColorConstants.LightBeigeText, Visible = true }; _inputBox.SetParentControl(this); dispatcher.Subscriber = _inputBox; for (int i = 0; i < _arrowButtons.Length; ++i) { var btn = new XNAButton(_charCreateSheet, new Vector2(196, 85 + i * 26), new Rectangle(185, 38, 19, 19), new Rectangle(206, 38, 19, 19)); btn.OnClick += ArrowButtonClick; btn.SetParentControl(this); _arrowButtons[i] = btn; } _characterControl = new CreateCharacterControl(rendererFactory) { DrawPosition = new Vector2(235, 58) }; _characterControl.SetParentControl(this); _srcRectangles[0] = new Rectangle(0, 38, 23, 19); _srcRectangles[1] = new Rectangle(0, 19, 23, 19); _srcRectangles[2] = new Rectangle(0, 0, 23, 19); _srcRectangles[3] = new Rectangle(46, 38, 23, 19); _ok = new XNAButton(eoDialogButtonService.SmallButtonSheet, new Vector2(157, 195), eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Ok), eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Ok)); _ok.OnClick += (s, e) => ClickOk(); _ok.SetParentControl(this); _cancel = new XNAButton(eoDialogButtonService.SmallButtonSheet, new Vector2(250, 195), eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Cancel), eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Cancel)); _cancel.OnClick += (s, e) => Close(XNADialogResult.Cancel); _cancel.SetParentControl(this); CenterInGameView(); }