Пример #1
0
        public void HideBuildingTooltip(SmartEntity building)
        {
            SupportViewComponent supportViewComp = building.SupportViewComp;

            if (supportViewComp != null)
            {
                supportViewComp.TeardownElements();
            }
        }
Пример #2
0
        private void UpdateAllStarportTooltips()
        {
            NodeList <StarportNode> starportNodeList = Service.BuildingLookupController.StarportNodeList;

            for (StarportNode starportNode = starportNodeList.Head; starportNode != null; starportNode = starportNode.Next)
            {
                SupportViewComponent supportViewComponent = starportNode.Entity.Get <SupportViewComponent>();
                if (supportViewComponent != null)
                {
                    supportViewComponent.TeardownElements();
                    this.EnsureBuildingTooltip((SmartEntity)supportViewComponent.Entity);
                }
            }
        }
Пример #3
0
        private void StartHealthRepair(HealthViewComponent healthView)
        {
            this.repairing = true;
            healthView.AutoRegenerating = true;
            Entity entity = healthView.Entity;

            this.eventManager.SendEvent(EventId.EntityPostBattleRepairStarted, entity);
            SupportViewComponent supportViewComponent = entity.Get <SupportViewComponent>();

            if (supportViewComponent != null)
            {
                supportViewComponent.TeardownElements();
            }
            GeneratorViewComponent generatorViewComponent = entity.Get <GeneratorViewComponent>();

            if (generatorViewComponent != null)
            {
                generatorViewComponent.SetEnabled(false);
            }
            BuildingComponent buildingComponent = entity.Get <BuildingComponent>();

            Service.Get <StorageEffects>().UpdateFillState(entity, buildingComponent.BuildingType);
        }
Пример #4
0
        public void EnsureBuildingTooltip(SmartEntity building)
        {
            if (building == null || building.SupportViewComp == null || Service.PostBattleRepairController.IsEntityInRepair(building))
            {
                return;
            }
            SupportViewComponent supportViewComp = building.SupportViewComp;
            BuildingComponent    buildingComp    = building.BuildingComp;
            BuildingTypeVO       buildingType    = buildingComp.BuildingType;

            if (!supportViewComp.Enabled)
            {
                return;
            }
            IState currentState = Service.GameStateMachine.CurrentState;

            if (currentState is WarBoardState)
            {
                return;
            }
            bool                      flag                      = currentState is HomeState;
            bool                      editState                 = currentState is EditBaseState;
            bool                      baseLayoutState           = currentState is BaseLayoutToolState;
            int                       num                       = -1;
            int                       timeTotal                 = -1;
            string                    text                      = null;
            IUpgradeableVO            iconAsset                 = null;
            bool                      flag2                     = Service.BuildingController.SelectedBuilding == building;
            SupportViewComponentState supportViewComponentState = SupportViewComponentState.Dormant;
            Contract                  contract                  = Service.ISupportController.FindCurrentContract(buildingComp.BuildingTO.Key);

            if (contract != null)
            {
                if (this.ShouldShowProgress(contract, flag, editState, baseLayoutState, building))
                {
                    int remainingTimeForView = contract.GetRemainingTimeForView();
                    if (remainingTimeForView <= 0 || !Service.ISupportController.IsContractValidForStorage(contract))
                    {
                        text = Service.Lang.Get("STOPPED", new object[0]);
                        supportViewComponentState = SupportViewComponentState.Bubble;
                    }
                    else
                    {
                        num       = remainingTimeForView;
                        timeTotal = contract.TotalTime;
                        if (this.ShouldShowIcon(contract.DeliveryType, flag))
                        {
                            StaticDataController staticDataController = Service.StaticDataController;
                            DeliveryType         deliveryType         = contract.DeliveryType;
                            if (deliveryType != DeliveryType.UpgradeStarship)
                            {
                                if (deliveryType == DeliveryType.UpgradeEquipment)
                                {
                                    iconAsset = staticDataController.Get <EquipmentVO>(contract.ProductUid);
                                    goto IL_19B;
                                }
                                if (deliveryType != DeliveryType.Starship)
                                {
                                    iconAsset = staticDataController.Get <TroopTypeVO>(contract.ProductUid);
                                    goto IL_19B;
                                }
                            }
                            iconAsset = staticDataController.Get <SpecialAttackTypeVO>(contract.ProductUid);
IL_19B:
                            supportViewComponentState = SupportViewComponentState.IconProgress;
                        }
                        else
                        {
                            supportViewComponentState = SupportViewComponentState.Progress;
                        }
                    }
                }
            }
            else
            {
                text = this.GetBubbleText(building, flag, editState, flag2);
                if (text != null)
                {
                    supportViewComponentState = this.GetBubbleViewComponentStateBasedOnBuilding(building);
                }
            }
            if (flag2 && flag && supportViewComponentState == SupportViewComponentState.Dormant && buildingType.Type == BuildingType.Starport)
            {
                supportViewComponentState = SupportViewComponentState.General;
            }
            if (supportViewComponentState != SupportViewComponentState.Dormant)
            {
                bool            flag3 = supportViewComponentState == supportViewComp.State;
                BuildingTooltip buildingTooltip;
                if (flag3)
                {
                    buildingTooltip = supportViewComp.BuildingTooltip;
                }
                else
                {
                    supportViewComp.TeardownElements();
                    UXController            uXController        = Service.UXController;
                    MiscElementsManager     miscElementsManager = uXController.MiscElementsManager;
                    GameObjectViewComponent gameObjectViewComp  = building.GameObjectViewComp;
                    string     str           = gameObjectViewComp.MainGameObject.GetInstanceID().ToString();
                    string     name          = "BuildingTooltip" + str;
                    GameObject worldUIParent = Service.UXController.WorldUIParent;
                    switch (supportViewComponentState)
                    {
                    case SupportViewComponentState.Bubble:
                        if (buildingType.Type == BuildingType.ChampionPlatform)
                        {
                            buildingTooltip = miscElementsManager.CreateBubbleRepairTooltip(name, worldUIParent);
                        }
                        else
                        {
                            buildingTooltip = miscElementsManager.CreateBubbleTooltip(name, worldUIParent);
                        }
                        break;

                    case SupportViewComponentState.BubbleHQ:
                    case SupportViewComponentState.BubbleArmoryUpgrade:
                    case SupportViewComponentState.BubbleShardUpgrade:
                        buildingTooltip = miscElementsManager.CreateHQBubbleTooltip(name, worldUIParent);
                        break;

                    case SupportViewComponentState.Progress:
                        buildingTooltip = miscElementsManager.CreateProgressTooltip(name, worldUIParent);
                        break;

                    case SupportViewComponentState.IconProgress:
                        buildingTooltip = miscElementsManager.CreateIconProgressTooltip(name, worldUIParent);
                        break;

                    default:
                        buildingTooltip = miscElementsManager.CreateGeneralTooltip(name, worldUIParent);
                        break;
                    }
                }
                buildingTooltip.SetSelected(flag2);
                buildingTooltip.SetTitle(this.GetBuildingTitle(buildingType));
                buildingTooltip.SetLevel(buildingType);
                buildingTooltip.SetBubbleText(text);
                buildingTooltip.SetIconAsset(iconAsset);
                buildingTooltip.SetTime(num);
                buildingTooltip.SetProgress(num, timeTotal);
                if (!flag3)
                {
                    supportViewComp.SetupElements(buildingTooltip, supportViewComponentState);
                }
            }
        }