예제 #1
0
        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;
        }
예제 #2
0
 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>();
 }
예제 #3
0
        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
        }
예제 #4
0
        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>();
        }