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 void InitializeControls(IControlSet currentControlSet) { if (!_resourcesInitialized) { throw new InvalidOperationException("Error initializing controls: resources have not yet been initialized"); } if (_controlsInitialized) { throw new InvalidOperationException("Error initializing controls: controls have already been initialized"); } if (GameState != GameStates.PlayingTheGame) { _backgroundImage = GetControl(currentControlSet, GameControlIdentifier.BackgroundImage, GetBackgroundImage); _allComponents.Add(_backgroundImage); } InitializeControlsHelper(currentControlSet); foreach (var control in XNAControlComponents) { control.AddControlToDefaultGame(); } _controlsInitialized = true; }
protected override void InitializeControlsHelper(IControlSet currentControlSet) { _btnCreate = GetControl(currentControlSet, GameState == GameStates.LoggedIn ? GameControlIdentifier.CreateCharacterButton : GameControlIdentifier.CreateAccountButton, GetCreateButton); _person2Picture = GetControl(currentControlSet, GameControlIdentifier.PersonDisplay2, GetPerson2Picture); _allComponents.Add(_btnCreate); _allComponents.Add(_person2Picture); base.InitializeControlsHelper(currentControlSet); }
protected override void InitializeControlsHelper(IControlSet currentControlSet) { _createAccount = GetControl(currentControlSet, GameControlIdentifier.InitialCreateAccount, GetMainCreateAccountButton); _login = GetControl(currentControlSet, GameControlIdentifier.InitialLogin, GetMainLoginButton); _viewCredits = GetControl(currentControlSet, GameControlIdentifier.InitialViewCredits, GetViewCreditsButton); _exitGame = GetControl(currentControlSet, GameControlIdentifier.InitialExitGame, GetExitButton); _versionInfo = GetControl(currentControlSet, GameControlIdentifier.InitialVersionLabel, GetVersionInfoLabel); _personPicture = GetControl(currentControlSet, GameControlIdentifier.PersonDisplay1, GetPersonPicture1); _allComponents.Add(_createAccount); _allComponents.Add(_login); _allComponents.Add(_viewCredits); _allComponents.Add(_exitGame); _allComponents.Add(_versionInfo); _allComponents.Add(_personPicture); }