コード例 #1
0
        public void UpdateGeneratorAccruedCurrency(SmartEntity entity)
        {
            Building           buildingTO         = entity.BuildingComp.BuildingTO;
            BuildingTypeVO     buildingType       = entity.BuildingComp.BuildingType;
            bool               flag               = Service.BuildingController.SelectedBuilding == entity;
            ISupportController iSupportController = Service.ISupportController;

            if (iSupportController.FindCurrentContract(entity.BuildingComp.BuildingTO.Key) == null)
            {
                int accruedCurrency = buildingTO.AccruedCurrency;
                buildingTO.AccruedCurrency = this.UpdateAccruedCurrencyForView(buildingTO, buildingType);
                entity.GeneratorViewComp.ShowCollectButton(buildingTO.AccruedCurrency >= buildingType.CollectNotify);
                if (buildingTO.AccruedCurrency >= buildingType.Storage && accruedCurrency < buildingType.Storage)
                {
                    Service.EventManager.SendEvent(EventId.GeneratorJustFilled, entity);
                }
            }
            if (flag)
            {
                string       contextId = null;
                CurrencyType currency  = buildingType.Currency;
                if (currency != CurrencyType.Credits)
                {
                    if (currency != CurrencyType.Materials)
                    {
                        if (currency == CurrencyType.Contraband)
                        {
                            contextId = "Contraband";
                        }
                    }
                    else
                    {
                        contextId = "Materials";
                    }
                }
                else
                {
                    contextId = "Credits";
                }
                Service.UXController.HUD.ToggleContextButton(contextId, this.IsGeneratorCollectable(entity));
            }
        }
コード例 #2
0
        private NotificationObject GetUnitsCompleteNotification()
        {
            if (Service.CurrentPlayer == null || Service.CurrentPlayer.CampaignProgress == null)
            {
                return(null);
            }
            if (Service.CurrentPlayer.CampaignProgress.FueInProgress || !(Service.GameStateMachine.CurrentState is HomeState))
            {
                return(null);
            }
            NotificationTypeVO notificationTypeVO = Service.StaticDataController.Get <NotificationTypeVO>("notif2");
            int num = 0;
            NodeList <SupportNode> nodeList           = Service.EntityController.GetNodeList <SupportNode>();
            ISupportController     iSupportController = Service.ISupportController;

            for (SupportNode supportNode = nodeList.Head; supportNode != null; supportNode = supportNode.Next)
            {
                SmartEntity       smartEntity  = (SmartEntity)supportNode.Entity;
                BuildingComponent buildingComp = supportNode.BuildingComp;
                string            key          = buildingComp.BuildingTO.Key;
                if (!ContractUtils.IsBuildingUpgrading(smartEntity) && !ContractUtils.IsBuildingConstructing(smartEntity) && !iSupportController.IsBuildingFrozen(key))
                {
                    Contract contract = iSupportController.FindCurrentContract(key);
                    if (contract != null && iSupportController.IsContractValidForStorage(contract))
                    {
                        int num2 = ContractUtils.CalculateRemainingTimeOfAllTroopContracts(smartEntity);
                        if (num2 > num)
                        {
                            num = num2;
                        }
                    }
                }
            }
            if (num >= notificationTypeVO.MinCompletionTime)
            {
                DateTime time = DateTime.Now.AddSeconds((double)num + 2.0);
                return(this.CreateReengagementNotification("notif2", time, true));
            }
            return(null);
        }
コード例 #3
0
        public int CalculateTimeUntilAllGeneratorsFull()
        {
            NodeList <GeneratorViewNode> generatorViewNodeList = Service.Get <BuildingLookupController>().GeneratorViewNodeList;
            ISupportController           supportController     = Service.Get <ISupportController>();
            int num = 0;

            if (generatorViewNodeList != null)
            {
                for (GeneratorViewNode generatorViewNode = generatorViewNodeList.Head; generatorViewNode != null; generatorViewNode = generatorViewNode.Next)
                {
                    if (generatorViewNode.BuildingComp != null && supportController.FindCurrentContract(generatorViewNode.BuildingComp.BuildingTO.Key) == null)
                    {
                        int num2 = this.CalculateGeneratorFillTimeRemaining(generatorViewNode.Entity);
                        if (num2 > num)
                        {
                            num = num2;
                        }
                    }
                }
            }
            return(num);
        }