private void Click() { if (this.ArmyAction == null) { return; } bool flag = false; object[] customAttributes = this.ArmyAction.GetType().GetCustomAttributes(typeof(WorldPlacementCursorAttribute), true); if (customAttributes != null && customAttributes.Length > 0) { flag = true; if (this.ArmyAction is IArmyActionWithToggle && (this.ArmyAction as IArmyActionWithToggle).IsToggled(this.Army)) { flag = false; } } if (flag) { if (this.CursorService != null) { this.CursorService.Backup(); Diagnostics.Assert(customAttributes.Length == 1); WorldPlacementCursorAttribute worldPlacementCursorAttribute = customAttributes[0] as WorldPlacementCursorAttribute; Type type = worldPlacementCursorAttribute.Type; if (this.ArmyAction is IArmyActionWithUnitSelection) { this.CursorService.ChangeCursor(type, new object[] { this.Army, this.ArmyAction, this.unitListPanel.SelectUnits.ToArray() }); } else { this.CursorService.ChangeCursor(type, new object[] { this.Army, this.ArmyAction }); } } } else { this.failure.Clear(); if (this.ArmyAction != null) { if (this.ArmyAction is IArmyActionWithUnitSelection) { if (this.ArmyAction.CanExecute(this.Army, ref this.failure, this.unitListPanel.SelectUnits.ToArray())) { Ticket ticket; this.ArmyAction.Execute(this.Army, this.PlayerControllerRepositoryService.ActivePlayerController, out ticket, new EventHandler <TicketRaisedEventArgs>(this.ArmyAction_TicketRaised), this.unitListPanel.SelectUnits.ToArray()); } } else if (this.ArmyAction is IArmyActionWithTargetSelection) { this.armyActionTargets.Clear(); (this.ArmyAction as IArmyActionWithTargetSelection).FillTargets(this.Army, this.armyActionTargets, ref this.failure); if (this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[] { this.armyActionTargets })) { Ticket ticket2; this.ArmyAction.Execute(this.Army, this.PlayerControllerRepositoryService.ActivePlayerController, out ticket2, new EventHandler <TicketRaisedEventArgs>(this.ArmyAction_TicketRaised), this.armyActionTargets.ToArray()); } } else if (this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[0])) { Ticket ticket3; this.ArmyAction.Execute(this.Army, this.PlayerControllerRepositoryService.ActivePlayerController, out ticket3, new EventHandler <TicketRaisedEventArgs>(this.ArmyAction_TicketRaised), new object[0]); } } } this.RefreshCanExecute(); }
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)); } }