private void OnSelectCreepingNodeCB(GameObject obj)
 {
     if (base.PlayerController != null)
     {
         CreepingNodeImprovementLabel.CreepingNodePair creepingNodePair = obj.GetComponent <AgeControlButton>().OnActivateDataObject as CreepingNodeImprovementLabel.CreepingNodePair;
         PointOfInterest pointOfInterest = creepingNodePair.PointOfInterest;
         CreepingNodeImprovementDefinition creepingNodeImprovementDefinition = creepingNodePair.CreepingNodeImprovementDefinition;
         OrderQueueCreepingNode            order = new OrderQueueCreepingNode(base.Empire.Index, this.departmentOfTheInterior.MainCity.GUID, pointOfInterest.GUID, creepingNodeImprovementDefinition, pointOfInterest.WorldPosition, false, true);
         base.PlayerController.PostOrder(order);
     }
 }
Ejemplo n.º 2
0
    private SynchronousJobState SyncrhronousJob_QueueNode()
    {
        if (base.AIEntity == null || (base.AIEntity.Empire as MajorEmpire).ELCPIsEliminated || this.departmentOfTheInterior.MainCity == null || this.departmentOfTheInterior.MainCity.SimulationObject.Tags.Contains(City.TagCityStatusRazed))
        {
            return(SynchronousJobState.Failure);
        }
        if (this.departmentOfTheInterior.MainCity.GetPropertyValue(SimulationProperties.NetCityGrowth) <= 0f || this.nodesPerPopulation <= 0f)
        {
            return(SynchronousJobState.Success);
        }
        int i = 0;

        while (i < this.availableNodes.Count)
        {
            if (!this.IsNodeValid(i))
            {
                this.availableNodes.RemoveAt(i);
            }
            else
            {
                CreepingNodeImprovementDefinition nodeDefinition = this.availableNodes[i].nodeDefinition;
                OrderQueueCreepingNode            order          = new OrderQueueCreepingNode(base.AIEntity.Empire.Index, this.aiEntityCity.City.GUID, this.availableNodes[i].pointOfInterest.GUID, nodeDefinition, this.availableNodes[i].pointOfInterest.WorldPosition, false, true);
                base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order);
                this.availableNodes.RemoveAt(i);
                if (this.availableNodes.Count == 0)
                {
                    return(SynchronousJobState.Success);
                }
                bool flag = true;
                foreach (Player player in this.playerRepositoryService)
                {
                    if (player.Type == PlayerType.Human && player.State != PlayerState.Ready)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    Diagnostics.Log("ELCP: SyncrhronousJob_QueueNode() detected all humans are ready, aborting");
                    return(SynchronousJobState.Failure);
                }
                this.nodesPerPopulation -= 1f;
                return(SynchronousJobState.Running);
            }
        }
        return(SynchronousJobState.Success);
    }