示例#1
0
        public JobProcessor(IWindowService windowService, IDisplayService displayService, ICursorService cursorService, IDataProvider dataProvider, IPreviewRenderer previewRenderer, IActionExecutorFactory actionExecutorFactory)
        {
            _windowService  = windowService ?? throw new ArgumentNullException(nameof(windowService));
            _displayService = displayService ?? throw new ArgumentNullException(nameof(displayService));
            _cursorService  = cursorService ?? throw new ArgumentNullException(nameof(cursorService));

            _dataProvider          = dataProvider ?? throw new ArgumentNullException(nameof(dataProvider));
            _previewRenderer       = previewRenderer ?? throw new ArgumentNullException(nameof(previewRenderer));
            _actionExecutorFactory = actionExecutorFactory ?? throw new ArgumentNullException(nameof(actionExecutorFactory));
        }
示例#2
0
    protected override IEnumerator OnShow(params object[] parameters)
    {
        yield return(base.OnShow(parameters));

        ICursorService cursorService = Services.GetService <ICursorService>();

        this.interactionsAllowed = this.playerControllerRepositoryService.ActivePlayerController.CanSendOrders();
        this.garrisonWorldCursor = (cursorService.CurrentCursor as GarrisonWorldCursor);
        yield break;
    }
示例#3
0
    public void Bind(IPlayerControllerRepositoryService playerControllerRepositoryService, Army army, ArmyAction armyAction, AgeTransform anchor, GameObject client, int index, UnitListPanel unitListPanel)
    {
        IGameService service = Services.GetService <IGameService>();

        if (service == null || service.Game == null || this.PlayerControllerRepositoryService != null || this.Army != null || this.ArmyAction != null || this.SeasonService != null)
        {
            this.Unbind();
        }
        this.unitListPanel = unitListPanel;
        this.SeasonService = service.Game.Services.GetService <ISeasonService>();
        if (this.SeasonService != null)
        {
            this.SeasonService.SeasonChange += this.SeasonService_SeasonChange;
        }
        this.CursorService = Services.GetService <ICursorService>();
        this.PlayerControllerRepositoryService = playerControllerRepositoryService;
        this.Army       = army;
        this.ArmyAction = armyAction;
        this.Client     = client;
        this.ActionToggle.AgeTransform.Visible = (armyAction is IArmyActionWithToggle);
        this.ActionButton.AgeTransform.Visible = !(armyAction is IArmyActionWithToggle);
        this.ModifierSector.Reset();
        this.ModifierSector.GetComponent <AgePrimitiveSector>().MaxAngle = 0f;
        this.ActionImage.Image = null;
        this.ModifierSector.Reset();
        IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;

        Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper");
        GuiElement guiElement;
        Texture2D  image;

        if (guiPanelHelper.TryGetGuiElement(armyAction.Name, out guiElement) && guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
        {
            this.ActionImage.Image = image;
        }
        this.AgeTransform.AgeTooltip.Anchor = anchor;
        if (this.ArmyAction is IArmyActionWithUnitSelection)
        {
            this.unitListPanel.SelectionChange += this.UnitListPanel_SelectionChange;
        }
        this.RefreshCanExecute();
    }
示例#4
0
    private void OnCastSpell(SpellDefinition spellDefinition)
    {
        ICursorService service = Services.GetService <ICursorService>();

        if (service != null)
        {
            EncounterWorldCursor encounterWorldCursor = service.CurrentCursor as EncounterWorldCursor;
            if (encounterWorldCursor != null)
            {
                service.ChangeCursor(typeof(EncounterSpellCursor), new object[]
                {
                    encounterWorldCursor.CursorTarget,
                    encounterWorldCursor.WorldEncounter,
                    spellDefinition
                });
            }
        }
        Diagnostics.Log("OnCastSpell: {0}", new object[]
        {
            spellDefinition.Name
        });
    }
 public SpiralCenterOutCounterClockwise(ICursorService cursorService)
 {
     _cursorService = cursorService;
 }
示例#6
0
    private void OnOptionSelect(GameObject obj)
    {
        AgeControlButton component = obj.GetComponent <AgeControlButton>();

        DepartmentOfIndustry.ConstructibleElement constructibleElement = component.OnActivateDataObject as DepartmentOfIndustry.ConstructibleElement;
        Diagnostics.Assert(constructibleElement != null);
        bool flag = false;

        object[] array = constructibleElement.GetType().GetCustomAttributes(typeof(WorldPlacementCursorAttribute), true);
        if (array != null && array.Length > 0)
        {
            flag = true;
        }
        else if (constructibleElement.Tags.Contains(DownloadableContent9.TagColossus))
        {
            flag  = true;
            array = new object[]
            {
                new ColossusWorldPlacementCursorAttribute()
            };
        }
        ICursorService service = Services.GetService <ICursorService>();

        if (flag)
        {
            bool flag2 = true;
            if (flag2)
            {
                if (service != null)
                {
                    service.Backup();
                    WorldPlacementCursorAttribute worldPlacementCursorAttribute = array[0] as WorldPlacementCursorAttribute;
                    Type type = worldPlacementCursorAttribute.Type;
                    service.ChangeCursor(type, new object[]
                    {
                        this.City,
                        constructibleElement
                    });
                }
                return;
            }
            OrderQueueConstruction order = new OrderQueueConstruction(this.City.Empire.Index, this.City.GUID, constructibleElement, string.Empty);
            Ticket ticket;
            this.playerControllerRepository.ActivePlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
        }
        else if (this.keyMappingService.GetKeyUp(KeyAction.ControlBindingsQueueOnAll) || this.keyMappingService.GetKeyUp(KeyAction.ControlBindingsQueueOnTopOfAll))
        {
            DepartmentOfTheInterior agency = this.City.Empire.GetAgency <DepartmentOfTheInterior>();
            List <City>             list   = agency.Cities.ToList <City>();
            for (int i = 0; i < list.Count; i++)
            {
                OrderQueueConstruction order2 = new OrderQueueConstruction(this.City.Empire.Index, list[i].GUID, constructibleElement, string.Empty);
                Ticket ticket2;
                this.playerControllerRepository.ActivePlayerController.PostOrder(order2, out ticket2, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
            }
        }
        else
        {
            OrderQueueConstruction order3 = new OrderQueueConstruction(this.City.Empire.Index, this.City.GUID, constructibleElement, string.Empty);
            Ticket ticket3;
            this.playerControllerRepository.ActivePlayerController.PostOrder(order3, out ticket3, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
        }
    }