public PropModalInventoryContextualMenu(Point position, IEquipmentModule equipmentModule, IUiContentStorage uiContentStorage, IServiceProvider serviceProvider) : base(position, uiContentStorage) { _equipmentModule = equipmentModule; _serviceProvider = serviceProvider; }
/// <inheritdoc /> public LeaderBoardScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; _uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); _dbContext = serviceScope.GetRequiredService <DbContext>(); _goToMainMenuButton = new TextButton( UiResources.MainMenuButtonTitle, _uiContentStorage.GetButtonTexture(), _uiContentStorage.GetButtonFont(), new Rectangle( 0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); _goToMainMenuButton.OnClick += GoToMainMenuButtonClickHandler; _leaderBoardRecords = _dbContext.GetLeaderBoard(new LeaderboardLimit(limit: 10)); _font = _uiContentStorage.GetButtonFont(); }
public PersonConditionsPanel(ISectorUiState uiState, int screenX, int screenY, IUiContentStorage uiContentStorage) { _uiState = uiState; _screenX = screenX; _screenY = screenY; _uiContentStorage = uiContentStorage; }
public PersonPropsModalDialog( IUiContentStorage uiContentStorage, GraphicsDevice graphicsDevice, ISectorUiState uiState, IServiceProvider serviceProvider) : base(uiContentStorage, graphicsDevice) { _uiContentStorage = uiContentStorage; _uiState = uiState; _serviceProvider = serviceProvider; }
public TravelPanel(IHumanActorTaskSource <ISectorTaskSourceContext> humanActorTaskSource, IUiContentStorage uiContentStorage) { _humanActorTaskSource = humanActorTaskSource; _uiContentStorage = uiContentStorage; _autoplayModeButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ); _autoplayModeButton.OnClick += AutoplayModeButton_OnClick; _autoplayModeButtonTitle = string.Format(UiResources.SwitchAutomodeButtonTitle, UiResources.SwitchAutomodeButtonOffTitle); var personPropButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(16, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); personPropButton.OnClick += PersonEquipmentButton_OnClick; var personStatsButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(32, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); personStatsButton.OnClick += PersonStatsButton_OnClick; var gameSpeedButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(16, 32, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); gameSpeedButton.OnClick += GameSpeedButton_OnClick; _buttons = new[] { _autoplayModeButton, personPropButton, personStatsButton, gameSpeedButton }; }
public ContainerModalDialog(ISectorUiState uiState, IUiContentStorage uiContentStorage, GraphicsDevice graphicsDevice, IServiceProvider serviceProvider) : base( uiContentStorage, graphicsDevice) { _uiState = uiState; _uiContentStorage = uiContentStorage; _serviceProvider = serviceProvider; _containerName = UiResources.FakeContainerName; }
/// <inheritdoc /> public ScoresScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; var scoreManager = serviceScope.GetRequiredService <IScoreManager>(); _scoreSummary = TextSummaryHelper.CreateTextSummary(scoreManager.Scores); _uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); _globeGenerationScene = new GlobeSelectionScreen(game: game, spriteBatch: spriteBatch); var buttonTexture = _uiContentStorage.GetButtonTexture(); var font = _uiContentStorage.GetButtonFont(); _restartButton = new TextButton( title: UiResources.StartGameButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X, y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _restartButton.OnClick += RestartButtonClickHandler; _goToMainMenu = new TextButton( title: UiResources.MainMenuButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X + (BUTTON_WIDTH_OFFSET * 2), y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _goToMainMenu.OnClick += GoToMainMenuButtonClickHandler; _goToNextScreen = new TextButton( title: UiResources.NextScreenButtonTitle, texture: buttonTexture, font: font, rect: new Rectangle( x: RESTART_BUTTON_POSITION_X + (BUTTON_WIDTH_OFFSET * 4), y: BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _goToNextScreen.OnClick += GoToNextScreenButtonClickHandler; }
public CombatActPanel(ICombatActModule combatActModule, IEquipmentModule equipmentModule, IUiContentStorage uiContentStorage, ISectorUiState sectorUiState) { _combatActModule = combatActModule; _equipmentModule = equipmentModule; _uiContentStorage = uiContentStorage; _sectorUiState = sectorUiState; _buttons = new List <CombatActButton>(); _buttonGroup = new CombatActButtonGroup(); Initialize(_buttons); _equipmentModule.EquipmentChanged += EquipmentModule_EquipmentChanged; }
public PersonConditionsPanel(ISectorUiState uiState, int screenX, int screenY, IUiContentStorage uiContentStorage, IUiSoundStorage uiSoundStorage, SoundtrackManager soundtrackManager, GraphicsDevice graphicsDevice) { _uiState = uiState; _screenX = screenX; _screenY = screenY; _uiContentStorage = uiContentStorage; _uiSoundStorage = uiSoundStorage; _soundtrackManager = soundtrackManager; _alertSoundEffect = _uiSoundStorage.GetAlertEffect().CreateInstance(); _alertTexture = CreateTexture(graphicsDevice, ICON_SIZE + ICON_SPACING * 2, ICON_SIZE + ICON_SPACING * 2, LastColors.Red); _alertedConditions = new List <IPersonCondition>(); }
public BottomMenuPanel( IHumanActorTaskSource <ISectorTaskSourceContext> humanActorTaskSource, ICombatActModule combatActModule, IUiContentStorage uiContentStorage, IEquipmentModule equipmentModule, ISectorUiState sectorUiState, ICommandPool commandPool, ServiceProviderCommandFactory commandFactory, ICommandLoopContext commandLoopContext, IPlayerEventLogService logService) { _travelPanel = new TravelPanel(humanActorTaskSource, uiContentStorage, commandPool, commandFactory, commandLoopContext); _combatActPanel = new CombatActPanel(combatActModule, equipmentModule, uiContentStorage, sectorUiState); _travelPanel.PropButtonClicked += PersonPropButton_OnClick; _travelPanel.StatButtonClicked += PersonStatsButton_OnClick; _travelPanel.TraitsButtonClicked += PersonTraitsButton_OnClick; _travelPanel.FastDeathButtonClicked += FastDeathButtonClicked; _currentModeMenu = _travelPanel; var combatButtonIcon = new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(48, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT) ); var idleButtonIcon = new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(0, 32, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT) ); _idleModeSwitcherButton = new IconButton( uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), idleButtonIcon, new Rectangle(0, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT)); _idleModeSwitcherButton.OnClick += IdleModeSwitcherButton_OnClick; _combatActModule = combatActModule; _uiContentStorage = uiContentStorage; _sectorUiState = sectorUiState; _logService = logService; _combatModeSwitcherButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: combatButtonIcon, rect: new Rectangle(0, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT)); _combatModeSwitcherButton.OnClick += CombatModeSwitcherButton_OnClick; }
public ContainerModalTransferContextualMenu( Point position, IPropStore inventoryStore, IPropStore containerStore, IUiContentStorage uiContentStorage, IServiceProvider serviceProvider, PropTransferMachineStore sourceStore, PropTransferMachineStore targetStore, string menuTitle) : base(position, uiContentStorage) { _inventoryStore = inventoryStore; _containerStore = containerStore; _serviceProvider = serviceProvider; _sourceStore = sourceStore; _targetStore = targetStore; _menuTitle = menuTitle; }
public PersonMarkersPanel(int positionOffsetY, IUiContentStorage uiContentStorage, SectorViewModelContext sectorViewModelContext, IPlayer player, ISectorUiState sectorUiState, ICommandPool commandPool, ServiceProviderCommandFactory commandFactory) { _positionOffsetY = positionOffsetY; _uiContentStorage = uiContentStorage; _sectorViewModelContext = sectorViewModelContext; _player = player; _sectorUiState = sectorUiState; _commandPool = commandPool; _commandFactory = commandFactory; _visibleActors = new List <ActorViewModel>(); _drawnItemList = new List <Marker>(); }
/// <inheritdoc /> public LeaderBoardScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; _uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); _goToMainMenu = new TextButton( title: UiResources.MainMenuButtonTitle, texture: _uiContentStorage.GetButtonTexture(), font: _uiContentStorage.GetButtonFont(), rect: new Rectangle( x: GO_TO_MAIN_MENU_BUTTON_POSITION_X, y: GO_TO_MAIN_MENU_BUTTON_POSITION_Y, width: BUTTON_WIDTH, height: BUTTON_HEIGHT)); _goToMainMenu.OnClick += GoToMainMenuButtonClickHandler; //TODO: prepare leader's board table }
public GlobeSelectionScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceProvider = ((LivGame)game).ServiceProvider; _uiContentStorage = serviceProvider.GetRequiredService <IUiContentStorage>(); _globeInitializer = serviceProvider.GetRequiredService <IGlobeInitializer>(); _globeLoop = serviceProvider.GetRequiredService <IGlobeLoopUpdater>(); _commandLoop = serviceProvider.GetRequiredService <ICommandLoopUpdater>(); _playerState = serviceProvider.GetRequiredService <ISectorUiState>(); _inventoryState = serviceProvider.GetRequiredService <IInventoryState>(); var buttonTexture = _uiContentStorage.GetButtonTexture(); var font = _uiContentStorage.GetButtonFont(); _generateButton = new TextButton(UiResources.GenerateGlobeButtonTitle, buttonTexture, font, new Rectangle(150, 150, BUTTON_WIDTH, BUTTON_HEIGHT)); _generateButton.OnClick += GenerateButtonClickHandlerAsync; }
public BottomMenuPanel( IHumanActorTaskSource <ISectorTaskSourceContext> humanActorTaskSource, ICombatActModule combatActModule, IUiContentStorage uiContentStorage, IEquipmentModule equipmentModule, ISectorUiState sectorUiState) { _travelPanel = new TravelPanel(humanActorTaskSource, uiContentStorage); _combatActPanel = new CombatActPanel(combatActModule, equipmentModule, uiContentStorage, sectorUiState); _travelPanel.PropButtonClicked += PersonPropButton_OnClick; _travelPanel.StatButtonClicked += PersonStatsButton_OnClick; _currentModeMenu = _travelPanel; var idleButtonIcon = new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(48, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT) ); var combatButtonIcon = new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(0, 32, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT) ); _idleModeSwitcherButton = new IconButton(uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), combatButtonIcon, new Rectangle(0, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT)); _idleModeSwitcherButton.OnClick += IdleModeSwitcherButton_OnClick; _combatActModule = combatActModule; _uiContentStorage = uiContentStorage; _combatModeSwitcherButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: idleButtonIcon, rect: new Rectangle(0, 0, SWITCHER_MODE_BUTTON_WIDTH, SWITCHER_MODE_BUTTON_HEIGHT)); _combatModeSwitcherButton.OnClick += CombatModeSwitcherButton_OnClick; }
protected ModalDialogBase(IUiContentStorage uiContentStorage, GraphicsDevice graphicsDevice) { _shadowTexture = uiContentStorage.GetModalShadowTexture(); _graphicsDevice = graphicsDevice; _backgroundTopTexture = uiContentStorage.GetModalTopTextures()[0]; _backgroundBottomTexture = uiContentStorage.GetModalBottomTextures()[0]; _dialogRect = new Rectangle( (graphicsDevice.Viewport.Width / 2) - (MODAL_WIDTH / 2), (graphicsDevice.Viewport.Height / 2) - (MODAL_HEIGHT / 2), MODAL_WIDTH, MODAL_HEIGHT); _closeButton = new TextButton("X", uiContentStorage.GetButtonTexture(), uiContentStorage.GetButtonFont(), new Rectangle(_dialogRect.Right - CLOSE_BUTTON_SIZE - CLOSE_BUTTON_PADDING, _dialogRect.Top + CLOSE_BUTTON_PADDING, CLOSE_BUTTON_SIZE, CLOSE_BUTTON_SIZE)); _closeButton.OnClick += CloseButton_OnClick; ContentRect = new Rectangle( _dialogRect.Left + MODAL_CONTENT_MARGIN, _dialogRect.Top + MODAL_CONTENT_MARGIN + MODAL_HEADER_HEIGHT, _dialogRect.Right - MODAL_CONTENT_MARGIN, _dialogRect.Bottom - MODAL_CONTENT_MARGIN); }
public MainScreen(Game game, SpriteBatch spriteBatch) : base(game) { _spriteBatch = spriteBatch; var serviceScope = ((LivGame)Game).ServiceProvider; _uiState = serviceScope.GetRequiredService <ISectorUiState>(); _player = serviceScope.GetRequiredService <IPlayer>(); _transitionPool = serviceScope.GetRequiredService <ITransitionPool>(); _animationBlockerService = serviceScope.GetRequiredService <IAnimationBlockerService>(); _commandPool = serviceScope.GetRequiredService <ICommandPool>(); _commandFactory = new ServiceProviderCommandFactory(((LivGame)game).ServiceProvider); var uiSoundStorage = serviceScope.GetRequiredService <IUiSoundStorage>(); _uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>(); var soundtrackManager = serviceScope.GetRequiredService <SoundtrackManager>(); _camera = new Camera(); _personEffectsPanel = new PersonConditionsPanel(_uiState, screenX: game.GraphicsDevice.Viewport.Bounds.Center.X, screenY: 8, _uiContentStorage, uiSoundStorage, soundtrackManager, Game.GraphicsDevice); _personEquipmentModal = new PersonPropsModalDialog( _uiContentStorage, game.GraphicsDevice, _uiState, ((LivGame)game).ServiceProvider); _personStatsModal = new PersonStatsModalDialog( _uiContentStorage, game.GraphicsDevice, _uiState); _personTraitsModal = new PersonTraitsModalDialog( _uiContentStorage, game.GraphicsDevice, _uiState); _containerModal = new ContainerModalDialog( _uiState, _uiContentStorage, Game.GraphicsDevice, serviceScope); var humanActorTaskSource = serviceScope.GetRequiredService <IHumanActorTaskSource <ISectorTaskSourceContext> >(); var mainPerson = _player.MainPerson; if (mainPerson is null) { throw new InvalidOperationException("Main person is not initalized. Generate globe first."); } _logService = serviceScope.GetRequiredService <IPlayerEventLogService>(); _bottomMenu = new BottomMenuPanel( humanActorTaskSource, mainPerson.GetModule <ICombatActModule>(), _uiContentStorage, mainPerson.GetModule <IEquipmentModule>(), _uiState, _commandPool, _commandFactory, serviceScope.GetRequiredService <ICommandLoopContext>(), _logService); _bottomMenu.PropButtonClicked += BottomMenu_PropButtonClicked; _bottomMenu.StatButtonClicked += BottomMenu_StatButtonClicked; _bottomMenu.TraitsButtonClicked += BottomMenu_TraitsButtonClicked; _scoreManager = serviceScope.GetRequiredService <IScoreManager>(); }
public PersonStatsModalDialog(IUiContentStorage uiContentStorage, GraphicsDevice graphicsDevice, ISectorUiState uiState) : base(uiContentStorage, graphicsDevice) { _uiContentStorage = uiContentStorage; _uiState = uiState; }
protected PropModalInventoryContextualMenuBase(Point position, IUiContentStorage uiContentStorage) { _position = new Point(position.X - MENU_MARGIN, position.Y - MENU_MARGIN); _position = position; _uiContentStorage = uiContentStorage; }
public TravelPanel(IHumanActorTaskSource <ISectorTaskSourceContext> humanActorTaskSource, IUiContentStorage uiContentStorage, ICommandPool commandPool, ServiceProviderCommandFactory commandFactory, ICommandLoopContext commandLoopContext) { _humanActorTaskSource = humanActorTaskSource; _uiContentStorage = uiContentStorage; _commandPool = commandPool; _commandFactory = commandFactory; _commandLoopContext = commandLoopContext; _autoplayModeButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ); _autoplayModeButton.OnClick += AutoplayModeButton_OnClick; _autoplayModeButtonTitle = string.Format(UiResources.SwitchAutomodeButtonTitle, UiResources.SwitchAutomodeButtonOffTitle); var personPropButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(16, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); personPropButton.OnClick += PersonEquipmentButton_OnClick; _personPropButton = personPropButton; var personStatsButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(32, 0, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); personStatsButton.OnClick += PersonStatsButton_OnClick; var personTraitsButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(48, 32, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(48, 32, BUTTON_WIDTH, BUTTON_HEIGHT)); personTraitsButton.OnClick += PersonTraitsButton_OnClick; var gameSpeedButton = new IconButton( texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(16, 32, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); gameSpeedButton.OnClick += GameSpeedButton_OnClick; _personStatsButton = personStatsButton; var idleButton = new IconButton(texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(32, 32, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); idleButton.OnClick += IdleButton_OnClick; _idleButton = idleButton; var fastDeathButton = new IconButton(texture: uiContentStorage.GetSmallVerticalButtonBackgroundTexture(), iconData: new IconData( uiContentStorage.GetSmallVerticalButtonIconsTexture(), new Rectangle(32, 32, BUTTON_WIDTH, BUTTON_HEIGHT) ), rect: new Rectangle(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT)); fastDeathButton.OnClick += FastDeathButton_OnClick; #if DEBUG _buttons = new[] { _autoplayModeButton, personPropButton, personStatsButton, personTraitsButton, idleButton, gameSpeedButton, fastDeathButton }; #else _buttons = new[] { personPropButton, personStatsButton, personTraitsButton, idleButton }; #endif }