private void RecalculateMaxEquipmentCapacity()
        {
            CurrentPlayer         currentPlayer  = Service.Get <CurrentPlayer>();
            NodeList <ArmoryNode> armoryNodeList = Service.Get <BuildingLookupController>().ArmoryNodeList;
            int num = 0;

            for (ArmoryNode armoryNode = armoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next)
            {
                BuildingTypeVO buildingType = armoryNode.BuildingComp.BuildingType;
                if (!ContractUtils.IsBuildingConstructing(armoryNode.Entity))
                {
                    num += buildingType.Storage;
                }
            }
            currentPlayer.ActiveArmory.SetMaxEquipmentCapacity(num);
        }
        protected override void OnScreenLoaded()
        {
            Service.Get <UXController>().HUD.Visible = false;
            this.InitButtons();
            this.SetUIText();
            this.LoadFx();
            UXSprite   element = base.GetElement <UXSprite>("SpriteInstructions");
            ArmoryNode head    = Service.Get <BuildingLookupController>().ArmoryNodeList.Head;

            if (head != null)
            {
                BuildingTypeVO  buildingType    = head.BuildingComp.BuildingType;
                ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingType, element, false);
                projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                ProjectorUtils.GenerateProjector(projectorConfig);
            }
            this.fadingOutSubject = false;
        }
Example #3
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id <= EventId.EntityDestroyed)
     {
         if (id != EventId.BuildingViewReady)
         {
             if (id != EventId.CurrencyCollected)
             {
                 if (id != EventId.EntityDestroyed)
                 {
                     return(EatResponse.NotEaten);
                 }
                 uint num = (uint)cookie;
                 using (Dictionary <Entity, ShuttleAnim> .KeyCollection.Enumerator enumerator = this.shuttles.Keys.GetEnumerator())
                 {
                     while (enumerator.MoveNext())
                     {
                         Entity current = enumerator.Current;
                         if (current.ID == num)
                         {
                             this.RemoveStarportShuttle(current);
                             break;
                         }
                     }
                     return(EatResponse.NotEaten);
                 }
             }
             else
             {
                 CurrencyCollectionTag currencyCollectionTag = cookie as CurrencyCollectionTag;
                 if (currencyCollectionTag.Type == CurrencyType.Contraband)
                 {
                     this.UpdateContrabandShuttle((SmartEntity)currencyCollectionTag.Building);
                     return(EatResponse.NotEaten);
                 }
                 return(EatResponse.NotEaten);
             }
         }
         EntityViewParams entityViewParams = (EntityViewParams)cookie;
         SmartEntity      entity           = entityViewParams.Entity;
         if (!this.shuttles.ContainsKey(entity) && Service.Get <GameStateMachine>().CurrentState is HomeState && entity.BuildingComp.BuildingType.Type == BuildingType.Resource && entity.BuildingComp.BuildingType.Currency == CurrencyType.Contraband)
         {
             this.UpdateContrabandShuttle(entity);
         }
     }
     else if (id <= EventId.BuildingReplaced)
     {
         if (id != EventId.StarportMeterUpdated)
         {
             if (id == EventId.BuildingReplaced)
             {
                 Entity         entity2      = (Entity)cookie;
                 BuildingTypeVO buildingType = entity2.Get <BuildingComponent>().BuildingType;
                 if (buildingType.Type == BuildingType.Starport || (buildingType.Type == BuildingType.Resource && buildingType.Currency == CurrencyType.Contraband))
                 {
                     if (buildingType.Currency == CurrencyType.Contraband)
                     {
                         this.UpdateShuttle(entity2, 0.5f, 1);
                     }
                     else if (buildingType.Type == BuildingType.Armory)
                     {
                         this.UpdateShuttle(entity2, 0.5f, 2);
                     }
                     else
                     {
                         this.UpdateShuttle(entity2, 0.5f, 0);
                     }
                 }
             }
         }
         else
         {
             MeterShaderComponent meterShaderComponent = (MeterShaderComponent)cookie;
             this.UpdateShuttle(meterShaderComponent.Entity, meterShaderComponent.Percentage, 0);
         }
     }
     else if (id != EventId.UserLiftedBuilding)
     {
         if (id == EventId.EquipmentDeactivated)
         {
             NodeList <ArmoryNode> armoryNodeList = Service.Get <BuildingLookupController>().ArmoryNodeList;
             for (ArmoryNode armoryNode = armoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next)
             {
                 this.DestroyArmoryShuttle(armoryNode.Entity);
             }
         }
     }
     else
     {
         Entity         entity3       = (Entity)cookie;
         BuildingTypeVO buildingType2 = entity3.Get <BuildingComponent>().BuildingType;
         if (buildingType2.Type == BuildingType.Starport || (buildingType2.Type == BuildingType.Resource && buildingType2.Currency == CurrencyType.Contraband) || buildingType2.Type == BuildingType.Armory)
         {
             this.RemoveStarportShuttle(entity3);
         }
     }
     return(EatResponse.NotEaten);
 }
Example #4
0
        public bool HasConstructedBuilding(BuildingTypeVO reqBuilding)
        {
            int lvl = reqBuilding.Lvl;

            switch (reqBuilding.Type)
            {
            case BuildingType.HQ:
                for (HQNode hQNode = this.HQNodeList.Head; hQNode != null; hQNode = hQNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)hQNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Barracks:
                for (BarracksNode barracksNode = this.BarracksNodeList.Head; barracksNode != null; barracksNode = barracksNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)barracksNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Factory:
                for (FactoryNode factoryNode = this.FactoryNodeList.Head; factoryNode != null; factoryNode = factoryNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)factoryNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.FleetCommand:
                for (FleetCommandNode fleetCommandNode = this.FleetCommandNodeList.Head; fleetCommandNode != null; fleetCommandNode = fleetCommandNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)fleetCommandNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.HeroMobilizer:
                for (TacticalCommandNode tacticalCommandNode = this.TacticalCommandNodeList.Head; tacticalCommandNode != null; tacticalCommandNode = tacticalCommandNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)tacticalCommandNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.ChampionPlatform:
                for (ChampionPlatformNode championPlatformNode = this.ChampionPlatformNodeList.Head; championPlatformNode != null; championPlatformNode = championPlatformNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)championPlatformNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Housing:
                for (HousingNode housingNode = this.HousingNodeList.Head; housingNode != null; housingNode = housingNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)housingNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Squad:
                for (SquadBuildingNode squadBuildingNode = this.SquadBuildingNodeList.Head; squadBuildingNode != null; squadBuildingNode = squadBuildingNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)squadBuildingNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Starport:
                for (StarportNode starportNode = this.StarportNodeList.Head; starportNode != null; starportNode = starportNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)starportNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.DroidHut:
                for (DroidHutNode droidHutNode = this.DroidHutNodeList.Head; droidHutNode != null; droidHutNode = droidHutNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)droidHutNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Wall:
                for (WallNode wallNode = this.WallNodeList.Head; wallNode != null; wallNode = wallNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)wallNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Turret:
                for (TurretBuildingNode turretBuildingNode = this.TurretBuildingNodeList.Head; turretBuildingNode != null; turretBuildingNode = turretBuildingNode.Next)
                {
                    if (turretBuildingNode.BuildingComp.BuildingType.UpgradeGroup == reqBuilding.UpgradeGroup && GameUtils.GetBuildingEffectiveLevel((SmartEntity)turretBuildingNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.TroopResearch:
                for (OffenseLabNode offenseLabNode = this.OffenseLabNodeList.Head; offenseLabNode != null; offenseLabNode = offenseLabNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)offenseLabNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.DefenseResearch:
                for (DefenseLabNode defenseLabNode = this.DefenseLabNodeList.Head; defenseLabNode != null; defenseLabNode = defenseLabNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)defenseLabNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Resource:
                for (GeneratorNode generatorNode = this.GeneratorNodeList.Head; generatorNode != null; generatorNode = generatorNode.Next)
                {
                    if (generatorNode.BuildingComp.BuildingType.Currency == reqBuilding.Currency && GameUtils.GetBuildingEffectiveLevel((SmartEntity)generatorNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Storage:
                for (StorageNode storageNode = this.StorageNodeList.Head; storageNode != null; storageNode = storageNode.Next)
                {
                    if (storageNode.BuildingComp.BuildingType.Currency == reqBuilding.Currency && GameUtils.GetBuildingEffectiveLevel((SmartEntity)storageNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Trap:
                for (TrapNode trapNode = this.TrapNodeList.Head; trapNode != null; trapNode = trapNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)trapNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Cantina:
                for (CantinaNode cantinaNode = this.CantinaNodeList.Head; cantinaNode != null; cantinaNode = cantinaNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)cantinaNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.NavigationCenter:
                for (NavigationCenterNode navigationCenterNode = this.NavigationCenterNodeList.Head; navigationCenterNode != null; navigationCenterNode = navigationCenterNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)navigationCenterNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.ScoutTower:
                for (ScoutTowerNode scoutTowerNode = this.ScoutTowerNodeList.Head; scoutTowerNode != null; scoutTowerNode = scoutTowerNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)scoutTowerNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);

            case BuildingType.Armory:
                for (ArmoryNode armoryNode = this.ArmoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next)
                {
                    if (GameUtils.GetBuildingEffectiveLevel((SmartEntity)armoryNode.BuildingComp.Entity) >= lvl)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            Service.Logger.Warn("Unknown reqBuilding type for level: " + reqBuilding.Uid);
            return(false);
        }
Example #5
0
        public Entity GetCurrentArmory()
        {
            ArmoryNode head = this.ArmoryNodeList.Head;

            return((head != null) ? head.ArmoryComp.Entity : null);
        }
Example #6
0
        private void FillBuildingListByType(List <SmartEntity> list, BuildingType type)
        {
            switch (type)
            {
            case BuildingType.Any:
            {
                NodeList <BuildingNode> nodeList = this.entityController.GetNodeList <BuildingNode>();
                for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next)
                {
                    list.Add((SmartEntity)buildingNode.Entity);
                }
                return;
            }

            case BuildingType.HQ:
                for (HQNode hQNode = this.HQNodeList.Head; hQNode != null; hQNode = hQNode.Next)
                {
                    list.Add((SmartEntity)hQNode.Entity);
                }
                return;

            case BuildingType.Barracks:
                for (BarracksNode barracksNode = this.BarracksNodeList.Head; barracksNode != null; barracksNode = barracksNode.Next)
                {
                    list.Add((SmartEntity)barracksNode.Entity);
                }
                return;

            case BuildingType.Factory:
                for (FactoryNode factoryNode = this.FactoryNodeList.Head; factoryNode != null; factoryNode = factoryNode.Next)
                {
                    list.Add((SmartEntity)factoryNode.Entity);
                }
                return;

            case BuildingType.FleetCommand:
                for (FleetCommandNode fleetCommandNode = this.FleetCommandNodeList.Head; fleetCommandNode != null; fleetCommandNode = fleetCommandNode.Next)
                {
                    list.Add((SmartEntity)fleetCommandNode.Entity);
                }
                return;

            case BuildingType.HeroMobilizer:
                for (TacticalCommandNode tacticalCommandNode = this.TacticalCommandNodeList.Head; tacticalCommandNode != null; tacticalCommandNode = tacticalCommandNode.Next)
                {
                    list.Add((SmartEntity)tacticalCommandNode.Entity);
                }
                return;

            case BuildingType.ChampionPlatform:
                for (ChampionPlatformNode championPlatformNode = this.ChampionPlatformNodeList.Head; championPlatformNode != null; championPlatformNode = championPlatformNode.Next)
                {
                    list.Add((SmartEntity)championPlatformNode.Entity);
                }
                return;

            case BuildingType.Housing:
                for (HousingNode housingNode = this.HousingNodeList.Head; housingNode != null; housingNode = housingNode.Next)
                {
                    list.Add((SmartEntity)housingNode.Entity);
                }
                return;

            case BuildingType.Squad:
                for (SquadBuildingNode squadBuildingNode = this.SquadBuildingNodeList.Head; squadBuildingNode != null; squadBuildingNode = squadBuildingNode.Next)
                {
                    list.Add((SmartEntity)squadBuildingNode.Entity);
                }
                return;

            case BuildingType.Starport:
                for (StarportNode starportNode = this.StarportNodeList.Head; starportNode != null; starportNode = starportNode.Next)
                {
                    list.Add((SmartEntity)starportNode.Entity);
                }
                return;

            case BuildingType.DroidHut:
                for (DroidHutNode droidHutNode = this.DroidHutNodeList.Head; droidHutNode != null; droidHutNode = droidHutNode.Next)
                {
                    list.Add((SmartEntity)droidHutNode.Entity);
                }
                return;

            case BuildingType.Wall:
                for (WallNode wallNode = this.WallNodeList.Head; wallNode != null; wallNode = wallNode.Next)
                {
                    list.Add((SmartEntity)wallNode.Entity);
                }
                return;

            case BuildingType.Turret:
                for (TurretBuildingNode turretBuildingNode = this.TurretBuildingNodeList.Head; turretBuildingNode != null; turretBuildingNode = turretBuildingNode.Next)
                {
                    list.Add((SmartEntity)turretBuildingNode.Entity);
                }
                return;

            case BuildingType.TroopResearch:
                for (OffenseLabNode offenseLabNode = this.OffenseLabNodeList.Head; offenseLabNode != null; offenseLabNode = offenseLabNode.Next)
                {
                    list.Add((SmartEntity)offenseLabNode.Entity);
                }
                return;

            case BuildingType.DefenseResearch:
                for (DefenseLabNode defenseLabNode = this.DefenseLabNodeList.Head; defenseLabNode != null; defenseLabNode = defenseLabNode.Next)
                {
                    list.Add((SmartEntity)defenseLabNode.Entity);
                }
                return;

            case BuildingType.Resource:
                for (GeneratorNode generatorNode = this.GeneratorNodeList.Head; generatorNode != null; generatorNode = generatorNode.Next)
                {
                    list.Add((SmartEntity)generatorNode.Entity);
                }
                return;

            case BuildingType.Storage:
                for (StorageNode storageNode = this.StorageNodeList.Head; storageNode != null; storageNode = storageNode.Next)
                {
                    list.Add((SmartEntity)storageNode.Entity);
                }
                return;

            case BuildingType.ShieldGenerator:
                for (ShieldGeneratorNode shieldGeneratorNode = this.ShieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next)
                {
                    list.Add((SmartEntity)shieldGeneratorNode.Entity);
                }
                return;

            case BuildingType.Clearable:
                for (ClearableNode clearableNode = this.ClearableNodeList.Head; clearableNode != null; clearableNode = clearableNode.Next)
                {
                    list.Add((SmartEntity)clearableNode.Entity);
                }
                return;

            case BuildingType.Trap:
                for (TrapNode trapNode = this.TrapNodeList.Head; trapNode != null; trapNode = trapNode.Next)
                {
                    list.Add((SmartEntity)trapNode.Entity);
                }
                return;

            case BuildingType.Cantina:
                for (CantinaNode cantinaNode = this.CantinaNodeList.Head; cantinaNode != null; cantinaNode = cantinaNode.Next)
                {
                    list.Add((SmartEntity)cantinaNode.Entity);
                }
                return;

            case BuildingType.NavigationCenter:
                for (NavigationCenterNode navigationCenterNode = this.NavigationCenterNodeList.Head; navigationCenterNode != null; navigationCenterNode = navigationCenterNode.Next)
                {
                    list.Add((SmartEntity)navigationCenterNode.Entity);
                }
                return;

            case BuildingType.ScoutTower:
                for (ScoutTowerNode scoutTowerNode = this.ScoutTowerNodeList.Head; scoutTowerNode != null; scoutTowerNode = scoutTowerNode.Next)
                {
                    list.Add((SmartEntity)scoutTowerNode.Entity);
                }
                return;

            case BuildingType.Armory:
                for (ArmoryNode armoryNode = this.ArmoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next)
                {
                    list.Add((SmartEntity)armoryNode.Entity);
                }
                return;
            }
            Service.Logger.Warn("Unknown building type " + type);
        }
        public EatResponse OnEvent(EventId id, object cookie)
        {
            IState currentState = Service.Get <GameStateMachine>().CurrentState;

            if (id <= EventId.WorldLoadComplete)
            {
                if (id <= EventId.StorageDoorEvent)
                {
                    if (id != EventId.BuildingViewReady)
                    {
                        switch (id)
                        {
                        case EventId.CurrencyCollected:
                        {
                            CurrencyCollectionTag currencyCollectionTag = cookie as CurrencyCollectionTag;
                            SmartEntity           smartEntity           = (SmartEntity)currencyCollectionTag.Building;
                            if (smartEntity != null)
                            {
                                BuildingAnimationComponent buildingAnimationComp = smartEntity.BuildingAnimationComp;
                                if (buildingAnimationComp != null)
                                {
                                    this.UpdateAnimation(smartEntity, currentState, buildingAnimationComp, true);
                                }
                            }
                            break;
                        }

                        case EventId.GeneratorJustFilled:
                            this.UpdateAnimationOnGeneratorFull((SmartEntity)cookie, currentState);
                            break;

                        case EventId.StorageDoorEvent:
                        {
                            SmartEntity smartEntity = (SmartEntity)cookie;
                            if (smartEntity != null && smartEntity.BuildingAnimationComp != null && smartEntity.StorageComp != null && smartEntity.StorageComp.CurrentFullnessPercentage < 1f)
                            {
                                BuildingAnimationComponent buildingAnimationComp = smartEntity.BuildingAnimationComp;
                                if (this.BuildingEligibleForActiveAnimation(smartEntity, currentState, buildingAnimationComp))
                                {
                                    buildingAnimationComp.Anim.Stop();
                                    int num = this.storageOpenCloseAnims.Length;
                                    for (int i = 0; i < num; i++)
                                    {
                                        this.EnqueueAnimation(buildingAnimationComp, this.storageOpenCloseAnims[i]);
                                    }
                                }
                            }
                            break;
                        }
                        }
                    }
                    else
                    {
                        EntityViewParams entityViewParams = cookie as EntityViewParams;
                        SmartEntity      smartEntity      = entityViewParams.Entity;
                        GameObject       mainGameObject   = smartEntity.GameObjectViewComp.MainGameObject;
                        Animation        component        = mainGameObject.GetComponent <Animation>();
                        if (!(component == null))
                        {
                            AssetMeshDataMonoBehaviour component2 = mainGameObject.GetComponent <AssetMeshDataMonoBehaviour>();
                            this.UpdateAnimation(smartEntity, currentState, new BuildingAnimationComponent(component, component2 ? component2.ListOfParticleSystems : null), true);
                        }
                    }
                }
                else if (id != EventId.TroopRecruited)
                {
                    if (id == EventId.WorldLoadComplete)
                    {
                        this.UpdateAnimations(currentState);
                    }
                }
                else
                {
                    ContractEventData contractEventData = cookie as ContractEventData;
                    if (contractEventData.Contract.DeliveryType == DeliveryType.Infantry)
                    {
                        SmartEntity smartEntity = (SmartEntity)contractEventData.Entity;
                        if (smartEntity != null)
                        {
                            BuildingAnimationComponent buildingAnimationComp = smartEntity.BuildingAnimationComp;
                            if (buildingAnimationComp != null && this.BuildingEligibleForActiveAnimation(smartEntity, currentState, buildingAnimationComp))
                            {
                                buildingAnimationComp.Anim.Stop();
                                for (int j = 0; j < this.barracksOpenCloseAnims.Length; j++)
                                {
                                    this.EnqueueAnimation(buildingAnimationComp, this.barracksOpenCloseAnims[j]);
                                }
                            }
                        }
                    }
                }
            }
            else if (id <= EventId.ContractStopped)
            {
                if (id != EventId.GameStateChanged)
                {
                    switch (id)
                    {
                    case EventId.ContractStarted:
                    case EventId.ContractContinued:
                    {
                        ContractEventData contractEventData2 = (ContractEventData)cookie;
                        this.StartAnimationOnContractStarted(contractEventData2.Entity, contractEventData2.Contract, currentState);
                        break;
                    }

                    case EventId.ContractStopped:
                        this.UpdateAnimationOnContractStopped((Entity)cookie, currentState);
                        break;
                    }
                }
                else
                {
                    this.UpdateAnimations(currentState);
                }
            }
            else if (id != EventId.ScreenClosing)
            {
                switch (id)
                {
                case EventId.EntityPostBattleRepairStarted:
                case EventId.EntityPostBattleRepairFinished:
                {
                    SmartEntity smartEntity = (SmartEntity)cookie;
                    if (smartEntity != null)
                    {
                        BuildingAnimationComponent buildingAnimationComp = smartEntity.BuildingAnimationComp;
                        if (buildingAnimationComp != null)
                        {
                            this.UpdateAnimation(smartEntity, currentState, buildingAnimationComp, true);
                        }
                    }
                    break;
                }

                case EventId.AllPostBattleRepairFinished:
                    break;

                case EventId.ShuttleAnimStateChanged:
                {
                    ShuttleAnim shuttleAnim = (ShuttleAnim)cookie;
                    SmartEntity smartEntity = (SmartEntity)shuttleAnim.Starport;
                    if (smartEntity.BuildingComp.BuildingType.Type == BuildingType.Armory)
                    {
                        Service.Get <ShuttleController>().DestroyArmoryShuttle(smartEntity);
                    }
                    else
                    {
                        this.UpdateContraBandGeneratorAnimation(smartEntity, shuttleAnim);
                    }
                    break;
                }

                default:
                    if (id == EventId.EquipmentDeactivated)
                    {
                        NodeList <ArmoryNode> armoryNodeList = Service.Get <BuildingLookupController>().ArmoryNodeList;
                        for (ArmoryNode armoryNode = armoryNodeList.Head; armoryNode != null; armoryNode = armoryNode.Next)
                        {
                            this.UpdateArmoryAnimation((SmartEntity)armoryNode.Entity);
                        }
                    }
                    break;
                }
            }
            else if (cookie is ArmoryScreen)
            {
                NodeList <ArmoryNode> armoryNodeList2 = Service.Get <BuildingLookupController>().ArmoryNodeList;
                for (ArmoryNode armoryNode2 = armoryNodeList2.Head; armoryNode2 != null; armoryNode2 = armoryNode2.Next)
                {
                    this.UpdateArmoryAnimation((SmartEntity)armoryNode2.Entity);
                }
            }
            return(EatResponse.NotEaten);
        }