//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); }
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(); }
public ScrollingMessageDialog(INativeGraphicsManager nativeGraphicsManager, IGameStateProvider gameStateProvider, IEODialogButtonService eoDialogButtonService) : base(gameStateProvider) { _font = Game.Content.Load <SpriteFont>(Constants.FontSize08); _textSplitter = new TextSplitter("", _font) { LineLength = 275 }; BackgroundTexture = nativeGraphicsManager.TextureFromResource(GFXTypes.PreLoginUI, 40); var smallButtonSheet = eoDialogButtonService.SmallButtonSheet; _ok = new XNAButton(smallButtonSheet, new Vector2(138, 197), eoDialogButtonService.GetSmallDialogButtonOutSource(SmallButton.Ok), eoDialogButtonService.GetSmallDialogButtonOverSource(SmallButton.Ok)); _ok.OnClick += (sender, e) => Close(XNADialogResult.OK); _ok.SetParentControl(this); _scrollBar = new ScrollBar(new Vector2(320, 66), new Vector2(16, 119), ScrollBarColors.LightOnMed, nativeGraphicsManager); _scrollBar.SetParentControl(this); MessageText = ""; CenterInGameView(); }
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(); }
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(); }
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(); }