Example #1
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
        });
    }
Example #2
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));
        }
    }