コード例 #1
0
        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);
        }
コード例 #2
0
        //top left - 334, 36 + ndx*124
        protected CharacterInfoPanel(int characterIndex,
                                     INativeGraphicsManager gfxManager,
                                     IEODialogButtonService dialogButtonService)
        {
            _gfxManager  = gfxManager;
            DrawPosition = new Vector2(334, 36 + characterIndex * 124);

            _loginButton = new XNAButton(dialogButtonService.SmallButtonSheet,
                                         new Vector2(161, 57),
                                         dialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Login),
                                         dialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Login));
            _loginButton.OnClick += async(o, e) => await LoginButtonClick();

            _loginButton.SetParentControl(this);

            _deleteButton = new XNAButton(dialogButtonService.SmallButtonSheet,
                                          new Vector2(161, 85),
                                          dialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Delete),
                                          dialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Delete));
            _deleteButton.OnClick += async(o, e) => await DeleteButtonClick();

            _deleteButton.SetParentControl(this);

            _backgroundImage = _gfxManager.TextureFromResource(GFXTypes.PreLoginUI, 11);
        }
コード例 #3
0
        protected override void InitializeControlsHelper(IControlSet currentControlSet)
        {
            base.InitializeControlsHelper(currentControlSet);

            _changePasswordButton = GetControl(currentControlSet, GameControlIdentifier.ChangePasswordButton, GetPasswordButton);
            _characterInfoPanels.AddRange(_characterInfoPanelFactory.CreatePanels());

            _allComponents.Add(_changePasswordButton);
            _allComponents.AddRange(_characterInfoPanels);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public ChangePasswordDialog(INativeGraphicsManager nativeGraphicsManager,
                                    IGameStateProvider gameStateProvider,
                                    IContentManagerProvider contentManagerProvider,
                                    IEOMessageBoxFactory eoMessageBoxFactory,
                                    IKeyboardDispatcherProvider keyboardDispatcherProvider,
                                    IPlayerInfoProvider playerInfoProvider,
                                    IEODialogButtonService dialogButtonService)
            : base(gameStateProvider)
        {
            _eoMessageBoxFactory = eoMessageBoxFactory;
            _playerInfoProvider  = playerInfoProvider;
            var dispatcher = keyboardDispatcherProvider.Dispatcher;

            BackgroundTexture = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 21);

            var cursorTexture = contentManagerProvider.Content.Load <Texture2D>("Cursor");

            _inputBoxes = new IXNATextBox[4];
            for (int i = 0; i < _inputBoxes.Length; ++i)
            {
                var tb = new XNATextBox(new Rectangle(198, 60 + i * 30, 137, 19), Constants.FontSize08, caretTexture: cursorTexture)
                {
                    LeftPadding = 5,
                    DefaultText = " ",
                    MaxChars    = i == 0 ? 16 : 12,
                    PasswordBox = i > 1,
                    TextColor   = ColorConstants.LightBeigeText
                };
                _inputBoxes[i] = tb;
            }

            _clickEventHandler = new TextBoxClickEventHandler(dispatcher, _inputBoxes);
            _tabEventHandler   = new TextBoxTabEventHandler(dispatcher, _inputBoxes);

            dispatcher.Subscriber = _inputBoxes[0];

            _ok = new XNAButton(
                dialogButtonService.SmallButtonSheet,
                new Vector2(157, 195),
                dialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Ok),
                dialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Ok));
            _ok.OnClick += OnButtonPressed;

            _cancel = new XNAButton(
                dialogButtonService.SmallButtonSheet,
                new Vector2(250, 195),
                dialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Cancel),
                dialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Cancel));
            _cancel.OnClick += (s, e) => Close(XNADialogResult.Cancel);

            CenterInGameView();
        }
コード例 #6
0
        public ProgressDialog(INativeGraphicsManager nativeGraphicsManager,
                              IGameStateProvider gameStateProvider,
                              IEODialogButtonService eoDialogButtonService,
                              string messageText,
                              string captionText)
            : base(gameStateProvider)
        {
            BackgroundTexture = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 18);

            _messageLabel = new XNALabel(Constants.FontSize10)
            {
                AutoSize     = true,
                ForeColor    = ColorConstants.LightYellowText,
                Text         = messageText,
                TextWidth    = 254,
                DrawPosition = new Vector2(18, 57)
            };
            _messageLabel.SetParentControl(this);

            _captionLabel = new XNALabel(Constants.FontSize10)
            {
                AutoSize     = true,
                ForeColor    = ColorConstants.LightYellowText,
                Text         = captionText,
                DrawPosition = new Vector2(59, 23)
            };
            _captionLabel.SetParentControl(this);

            _cancelButton = new XNAButton(eoDialogButtonService.SmallButtonSheet,
                                          new Vector2(181, 113),
                                          eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Cancel),
                                          eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Cancel));
            _cancelButton.OnClick += DoCancel;
            _cancelButton.SetParentControl(this);

            _pbBackgroundTexture = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 19);

            _pbForegroundTexture = new Texture2D(Game.GraphicsDevice, 1, _pbBackgroundTexture.Height - 2); //foreground texture is just a fill
            var pbForeFill = new Color[_pbForegroundTexture.Width * _pbForegroundTexture.Height];

            for (int i = 0; i < pbForeFill.Length; ++i)
            {
                pbForeFill[i] = Color.FromNonPremultiplied(0xb4, 0xdc, 0xe6, 0xff);
            }
            _pbForegroundTexture.SetData(pbForeFill);

            CenterInGameView();
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public EOMessageBox(INativeGraphicsManager graphicsManager,
                            IGameStateProvider gameStateProvider,
                            IEODialogButtonService eoDialogButtonService,
                            string message,
                            string caption               = "",
                            EOMessageBoxStyle style      = EOMessageBoxStyle.SmallDialogSmallHeader,
                            EODialogButtons whichButtons = EODialogButtons.Ok)
            : base(gameStateProvider)
        {
            var useSmallHeader = style != EOMessageBoxStyle.SmallDialogLargeHeader;

            int graphic;

            switch (style)
            {
            case EOMessageBoxStyle.SmallDialogLargeHeader: graphic = 18; break;

            case EOMessageBoxStyle.SmallDialogSmallHeader: graphic = 23; break;

            case EOMessageBoxStyle.LargeDialogSmallHeader: graphic = 25; break;

            default: throw new ArgumentOutOfRangeException(nameof(style), "Unrecognized dialog style!");
            }

            BackgroundTexture = graphicsManager.TextureFromResource(GFXTypes.PreLoginUI, graphic);

            _messageLabel = new XNALabel(Constants.FontSize10)
            {
                AutoSize     = true,
                ForeColor    = ColorConstants.LightYellowText,
                Text         = message,
                TextWidth    = 254,
                DrawPosition = new Vector2(18, useSmallHeader ? 40 : 57)
            };
            _messageLabel.SetParentControl(this);

            _captionLabel = new XNALabel(Constants.FontSize10)
            {
                AutoSize     = true,
                ForeColor    = ColorConstants.LightYellowText,
                Text         = caption,
                TextWidth    = 254,
                DrawPosition = useSmallHeader ? new Vector2(18, 12) : new Vector2(59, 23)
            };
            _captionLabel.SetParentControl(this);

            var smallButtonSheet = eoDialogButtonService.SmallButtonSheet;
            var okOut            = eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Ok);
            var okOver           = eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Ok);
            var cancelOut        = eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Cancel);
            var cancelOver       = eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Cancel);

            switch (whichButtons)
            {
            case EODialogButtons.Ok:
                _ok          = new XNAButton(smallButtonSheet, new Vector2(181, 113), okOut, okOver);
                _ok.OnClick += (sender, e) => Close(XNADialogResult.OK);
                _ok.SetParentControl(this);
                break;

            case EODialogButtons.Cancel:
                _cancel          = new XNAButton(smallButtonSheet, new Vector2(181, 113), cancelOut, cancelOver);
                _cancel.OnClick += (sender, e) => Close(XNADialogResult.Cancel);
                _cancel.SetParentControl(this);
                break;

            case EODialogButtons.OkCancel:
                //implement this more fully when it is needed
                //update draw location of ok button to be on left?
                _ok          = new XNAButton(smallButtonSheet, new Vector2(89, 113), okOut, okOver);
                _ok.OnClick += (sender, e) => Close(XNADialogResult.OK);
                _ok.SetParentControl(this);

                _cancel          = new XNAButton(smallButtonSheet, new Vector2(181, 113), cancelOut, cancelOver);
                _cancel.OnClick += (s, e) => Close(XNADialogResult.Cancel);
                _cancel.SetParentControl(this);
                break;
            }

            if (useSmallHeader)
            {
                if (_ok != null)
                {
                    _ok.DrawPosition = new Vector2(_ok.DrawPosition.X,
                                                   style == EOMessageBoxStyle.SmallDialogSmallHeader ? 82 : 148);
                }

                if (_cancel != null)
                {
                    _cancel.DrawPosition = new Vector2(_cancel.DrawPosition.X,
                                                       style == EOMessageBoxStyle.SmallDialogSmallHeader ? 82 : 148);
                }
            }

            CenterInGameView();
        }
コード例 #9
0
        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();
        }