Пример #1
0
        public CommandLoopUpdater(ICommandLoopContext commandLoopContext, ICommandPool commandPool)
        {
            _commandLoopContext = commandLoopContext;
            _commandPool        = commandPool;

            _semaphoreSlim = new SemaphoreSlim(1, 1);
        }
Пример #2
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;
        }
Пример #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
        }