public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.UserWantedEditBaseState) { if (id != EventId.BuildingViewReady) { if (id == EventId.GameStateChanged) { Type type = (Type)cookie; if (type == typeof(EditBaseState)) { this.EnsureLoweredLiftedBuilding(); } } } else { EntityViewParams entityViewParams = cookie as EntityViewParams; if (this.lifted && this.buildingSelector.IsPartOfSelection(entityViewParams.Entity)) { this.LiftSelectedBuilding(entityViewParams.Entity, false, false); } } } else if (!(bool)cookie) { this.eatDrags = true; } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.BuildingViewReady) { if (id == EventId.GameStateChanged) { Type type = (Type)cookie; IState currentState = Service.GameStateMachine.CurrentState; if ((type != typeof(HomeState) || !(currentState is EditBaseState)) && (type != typeof(EditBaseState) || !(currentState is HomeState))) { this.EnsureDeselectSelectedBuilding(); } SmartEntity smartEntity = (!(currentState is HomeState) && !(currentState is EditBaseState)) ? null : this.selectedBuilding; Service.UXController.HUD.ShowContextButtons(smartEntity); } } else { EntityViewParams entityViewParams = cookie as EntityViewParams; if (this.IsPartOfSelection(entityViewParams.Entity)) { this.ApplySelectedEffect(entityViewParams.Entity); } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.TroopViewReady) { if (id != EventId.BuildingMovedOnBoard) { if (id == EventId.TroopViewReady) { EntityViewParams entityViewParams = (EntityViewParams)cookie; if (entityViewParams.Entity == this.troopEntity) { Service.Get <EventManager>().UnregisterObserver(this, EventId.TroopViewReady); this.TryShowEffect(); } } } else if (this.starportEntity == cookie) { this.shuttle = null; Service.Get <EventManager>().RegisterObserver(this, EventId.ShuttleAnimStateChanged, EventPriority.Default); } } else if (id != EventId.BuildingReplaced) { if (id == EventId.ShuttleAnimStateChanged) { ShuttleAnim shuttleAnim = (ShuttleAnim)cookie; if (shuttleAnim.State == ShuttleState.Idle && shuttleAnim.Starport == this.starportEntity) { this.shuttle = shuttleAnim; Service.Get <EventManager>().UnregisterObserver(this, EventId.ShuttleAnimStateChanged); this.TryShowEffect(); } } } else { Entity entity = (Entity)cookie; if (this.starportEntity.Get <StarportComponent>() == null) { StarportComponent starportComponent = entity.Get <StarportComponent>(); if (starportComponent != null) { this.starportEntity = entity; this.shuttle = Service.Get <ShuttleController>().GetShuttleForStarport(this.starportEntity); } } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.MapDataProcessingStart: this.worldLoadPending = true; this.canRepair = this.CheckIfCanRepair(); return(EatResponse.NotEaten); case EventId.MapDataProcessingEnd: { IL_15: if (id == EventId.BuildingViewReady) { if (this.canRepair) { EntityViewParams entityViewParams = (EntityViewParams)cookie; this.OnEntityLoaded(entityViewParams.Entity); } return(EatResponse.NotEaten); } if (id == EventId.GameStateAboutToChange) { this.UpdateEntityRepairs(cookie as IState); return(EatResponse.NotEaten); } if (id != EventId.EntityHealthViewRegenerated) { return(EatResponse.NotEaten); } HealthViewComponent healthViewComponent = (HealthViewComponent)cookie; if (healthViewComponent.Entity != null) { this.entitiesInRepairMap.Remove(healthViewComponent.Entity); this.OnHeathRepairStopped(healthViewComponent); this.CleanupEntityAfterRepair(healthViewComponent.Entity, healthViewComponent); } return(EatResponse.NotEaten); } case EventId.WorldLoadComplete: { this.worldLoadPending = false; IState currentState = Service.GameStateMachine.CurrentState; this.UpdateEntityRepairs(currentState); return(EatResponse.NotEaten); } } goto IL_15; }
public EatResponse OnEvent(EventId id, object cookie) { if (id == EventId.TroopViewReady && this.bigHeadModeActivated) { EntityViewParams entityViewParams = (EntityViewParams)cookie; SmartEntity entity = entityViewParams.Entity; GameObjectViewComponent gameObjectViewComp = entity.GameObjectViewComp; GameObject gameObject = this.FindHead(gameObjectViewComp.MainGameObject); if (gameObject != null) { this.AddScaleWobbleComponent(gameObject); } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.GameStateChanged) { if (id != EventId.TroopViewReady) { if (id == EventId.GameStateChanged) { Type type = (Type)cookie; if (type == typeof(BattleEndState) || type == typeof(BattleEndPlaybackState)) { this.CleanupAllDecals(); } } } else { EntityViewParams entityViewParams = cookie as EntityViewParams; this.OnHeroOrChampionViewReady(entityViewParams.Entity); } } else { if (id != EventId.HeroDeployed) { switch (id) { case EventId.HeroKilled: case EventId.ChampionKilled: this.OnHeroOrChampionKilled(cookie as Entity); return(EatResponse.NotEaten); case EventId.ChampionDeployed: return(EatResponse.NotEaten); case EventId.AddDecalToTroop: break; default: return(EatResponse.NotEaten); } } this.OnHeroDeployed(cookie as Entity); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id == EventId.BuildingViewReady || id == EventId.BuildingViewFailed) { EntityViewParams entityViewParams = cookie as EntityViewParams; if (entityViewParams == null || entityViewParams.Entity == null) { Service.Get <StaRTSLogger>().Error("WorldInitializer received a building event with a null cookie or building entity."); } else { this.entitiesToLoad.Remove(entityViewParams.Entity); this.CheckLoadComplete(); } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.BuildingQuickStashed) { if (id != EventId.UserLoweredBuilding) { if (id == EventId.BuildingViewReady) { EntityViewParams entityViewParams = (EntityViewParams)cookie; if (this.IsBuildingStashed(entityViewParams.Entity)) { GameObjectViewComponent gameObjectViewComp = entityViewParams.Entity.GameObjectViewComp; TransformComponent transformComp = entityViewParams.Entity.TransformComp; gameObjectViewComp.SetXYZ(Units.BoardToWorldX(transformComp.CenterX()), -1000f, Units.BoardToWorldZ(transformComp.CenterZ())); } } } else { Entity entity = (Entity)cookie; if (entity != null) { Building buildingTO = entity.Get <BuildingComponent>().BuildingTO; Position position = this.lastSavedMap.GetPosition(buildingTO.Key); if ((position != null && this.HasBuildingMoved(buildingTO, position)) || (Service.GameStateMachine.CurrentState is WarBaseEditorState && position == null)) { this.ShouldRevertMap = true; } } } } else if (this.IsQuickStashModeEnabled) { SmartEntity smartEntity = (SmartEntity)cookie; this.StashBuilding(smartEntity); string uid = smartEntity.BuildingComp.BuildingTO.Uid; Service.BuildingController.EnsureDeselectSelectedBuilding(); Service.UXController.HUD.BaseLayoutToolView.RefreshStashedBuildingCount(uid); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.BuildingViewReady) { return(EatResponse.NotEaten); } EntityViewParams entityViewParams = cookie as EntityViewParams; Entity entity = entityViewParams.Entity; BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); if (buildingComponent == null) { return(EatResponse.NotEaten); } GameObjectViewComponent gameObjectViewComponent = entity.Get <GameObjectViewComponent>(); TurretTypeVO turretTypeVO = null; if (buildingComponent.BuildingType.Type == BuildingType.Turret) { turretTypeVO = Service.Get <IDataController>().Get <TurretTypeVO>(buildingComponent.BuildingType.TurretUid); } if (turretTypeVO == null || string.IsNullOrEmpty(turretTypeVO.TrackerName)) { Animation component = gameObjectViewComponent.MainGameObject.GetComponent <Animation>(); if (component != null) { AssetMeshDataMonoBehaviour component2 = gameObjectViewComponent.MainGameObject.GetComponent <AssetMeshDataMonoBehaviour>(); entity.Add <BuildingAnimationComponent>(new BuildingAnimationComponent(component, component2 ? component2.ListOfParticleSystems : null)); } } else { TrackingComponent trackingComp = entity.Get <TrackingComponent>(); TrackingGameObjectViewComponent component3 = new TrackingGameObjectViewComponent(gameObjectViewComponent.MainGameObject, turretTypeVO, trackingComp); entity.Add <TrackingGameObjectViewComponent>(component3); } return(EatResponse.NotEaten); }
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); }
public virtual EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.DroidViewReady: { EntityViewParams entityViewParams = cookie as EntityViewParams; this.PrepareDroid(entityViewParams.Entity); return(EatResponse.NotEaten); } case EventId.BuildingViewReady: case EventId.BuildingViewFailed: { IL_1C: switch (id) { case EventId.BuildingLevelUpgraded: case EventId.BuildingSwapped: case EventId.BuildingConstructed: break; default: { switch (id) { case EventId.BuildingPurchaseSuccess: case EventId.BuildingStartedUpgrading: goto IL_125; case EventId.BuildingPurchaseModeStarted: case EventId.BuildingPurchaseModeEnded: IL_4A: if (id == EventId.ClearableCleared) { goto IL_13D; } if (id == EventId.ClearableStarted || id == EventId.ChampionStartedRepairing) { goto IL_125; } if (id == EventId.ChampionRepaired) { goto IL_13D; } if (id == EventId.WorldLoadComplete) { this.InitializeDroids(); return(EatResponse.NotEaten); } if (id == EventId.BattleLoadStart) { this.DestroyAllDroids(); return(EatResponse.NotEaten); } if (id != EventId.InventoryResourceUpdated) { return(EatResponse.NotEaten); } if (object.Equals(cookie, "droids")) { this.AssignWorkToDroid(this.GetDroidHut(), false, true, true); } return(EatResponse.NotEaten); } goto IL_4A; IL_125: Entity building = cookie as Entity; this.AssignWorkToDroid(building, false, false, true); return(EatResponse.NotEaten); } } IL_13D: ContractEventData contractEventData = cookie as ContractEventData; this.RemoveWorkFromDroid(contractEventData.Entity, id != EventId.ClearableCleared); return(EatResponse.NotEaten); } case EventId.BuildingCancelled: case EventId.TroopCancelled: { ContractEventData contractEventData2 = (ContractEventData)cookie; ContractType contractType = ContractUtils.GetContractType(contractEventData2.Contract.DeliveryType); if (ContractUtils.ContractTypeConsumesDroid(contractType)) { SmartEntity entity = contractEventData2.Entity; BuildingComponent buildingComp = entity.BuildingComp; this.RemoveWorkFromDroid(entity, buildingComp.BuildingType.Type != BuildingType.Clearable); } return(EatResponse.NotEaten); } } goto IL_1C; }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.BuildingViewReady: { EntityViewParams entityViewParams = (EntityViewParams)cookie; Entity entity = entityViewParams.Entity; if (this.waitingForView.Contains(entity)) { this.waitingForView.Remove(entity); GameObjectViewComponent view = entity.Get <GameObjectViewComponent>(); List <ScaffoldingData> list = this.viewObjects[entity]; int i = 0; int count = list.Count; while (i < count) { GameObject gameObj = list[i].GameObj; gameObj.SetActive(true); this.AttachToView(gameObj, view); i++; } } return(EatResponse.NotEaten); } case EventId.BuildingViewFailed: IL_18: switch (id) { case EventId.BuildingLevelUpgraded: case EventId.BuildingSwapped: case EventId.BuildingConstructed: { ContractEventData contractEventData = (ContractEventData)cookie; this.HideScaffold(contractEventData.Entity); return(EatResponse.NotEaten); } default: if (id != EventId.ChampionStartedRepairing) { if (id == EventId.ChampionRepaired) { goto IL_A3; } if (id == EventId.ViewObjectsPurged) { this.HideScaffold((Entity)cookie); return(EatResponse.NotEaten); } if (id == EventId.ContractStarted) { ContractEventData contractEventData2 = (ContractEventData)cookie; DeliveryType deliveryType = contractEventData2.Contract.DeliveryType; if (deliveryType == DeliveryType.Building || deliveryType == DeliveryType.UpgradeBuilding || deliveryType == DeliveryType.SwapBuilding) { this.ShowScaffold(contractEventData2.Entity); } return(EatResponse.NotEaten); } if (id != EventId.ShowScaffolding) { return(EatResponse.NotEaten); } } this.ShowScaffold((Entity)cookie); return(EatResponse.NotEaten); } break; case EventId.BuildingCancelled: this.HideScaffold(((ContractEventData)cookie).Entity); return(EatResponse.NotEaten); case EventId.TroopCancelled: goto IL_A3; } goto IL_18; IL_A3: ContractEventData contractEventData3 = cookie as ContractEventData; SmartEntity entity2 = contractEventData3.Entity; if (entity2.BuildingComp.BuildingType.Type == BuildingType.ChampionPlatform) { this.HideScaffold(contractEventData3.Entity); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.StarshipMobilized: case EventId.HeroMobilized: this.OnUnitMobilized((ContractEventData)cookie); break; case EventId.StarshipMobilizedFromPrize: { Entity entity = Service.BuildingLookupController.FleetCommandNodeList.Head.Entity; this.CreateEffect(entity, (string)cookie, true, false); break; } case EventId.HeroMobilizedFromPrize: { Entity entity2 = Service.BuildingLookupController.TacticalCommandNodeList.Head.Entity; this.CreateEffect(entity2, (string)cookie, false, false); break; } default: { switch (id) { case EventId.BuildingViewReady: { EntityViewParams entityViewParams = (EntityViewParams)cookie; if (this.effectsByEntityId != null && this.effectsByEntityId.ContainsKey(entityViewParams.Entity.ID)) { BuildingHoloEffect buildingHoloEffect = this.effectsByEntityId[entityViewParams.Entity.ID]; if (buildingHoloEffect.WaitingForBuildingView) { buildingHoloEffect.UpdateEffect(); } } if (this.effectsByEntityId != null && entityViewParams.Entity.Has <NavigationCenterComponent>()) { this.AddNavigationCenterHolo(entityViewParams.Entity); } return(EatResponse.NotEaten); } case EventId.BuildingViewFailed: { IL_2D: if (id == EventId.BuildingConstructed) { goto IL_101; } if (id != EventId.BuildingReplaced) { switch (id) { case EventId.WorldLoadComplete: { IState currentState = Service.GameStateMachine.CurrentState; if (currentState is ApplicationLoadState || currentState is HomeState || currentState is WarBoardState) { this.AddAllEffects(false); } return(EatResponse.NotEaten); } case EventId.WorldInTransitionComplete: case EventId.WorldOutTransitionComplete: IL_56: if (id == EventId.ContractStarted || id == EventId.ContractContinued) { this.OnContractStarted((ContractEventData)cookie); return(EatResponse.NotEaten); } if (id != EventId.ContractCanceled) { return(EatResponse.NotEaten); } this.OnContractCanceled((ContractEventData)cookie); return(EatResponse.NotEaten); case EventId.WorldReset: this.RemoveAllEffects(); return(EatResponse.NotEaten); } goto IL_56; } SmartEntity smartEntity = cookie as SmartEntity; if (smartEntity.NavigationCenterComp != null) { this.AddNavigationCenterHolo(smartEntity); } return(EatResponse.NotEaten); } case EventId.BuildingCancelled: goto IL_101; } goto IL_2D; IL_101: ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.BuildingVO.Type == BuildingType.NavigationCenter) { this.AddNavigationCenterHolo(); } break; } } return(EatResponse.NotEaten); }
public virtual EatResponse OnEvent(EventId id, object cookie) { IState currentState = Service.Get <GameStateMachine>().CurrentState; bool flag = currentState is HomeState; bool flag2 = currentState is WarBoardState; bool flag3 = currentState is ApplicationLoadState; if (id <= EventId.BuildingLevelUpgraded) { if (id <= EventId.BuildingStartedUpgrading) { if (id != EventId.BuildingCancelled) { if (id == EventId.BuildingStartedUpgrading) { this.HandleChampionPlatformUpgradeStarted((SmartEntity)cookie); } } else { ContractEventData contractEventData = (ContractEventData)cookie; this.AddChampionToInventoryIfAlive((SmartEntity)contractEventData.Entity, false); } } else if (id != EventId.ChampionRepaired) { if (id != EventId.TroopViewReady) { if (id == EventId.BuildingLevelUpgraded) { ContractEventData contractEventData = (ContractEventData)cookie; this.UpgradeChampionToMatchPlatform((SmartEntity)contractEventData.Entity); } } else if (flag | flag2 | flag3) { EntityViewParams entityViewParams = cookie as EntityViewParams; SmartEntity entity = entityViewParams.Entity; if (entity.ChampionComp != null) { bool underRepair = this.IsChampionBroken(entity.ChampionComp); Service.Get <EntityRenderController>().UpdateChampionAnimationStateInHomeOrWarBoardMode(entity, underRepair); } } } else if (flag && cookie != null) { ContractEventData contractEventData2 = cookie as ContractEventData; SmartEntity smartEntity = contractEventData2.Entity as SmartEntity; TroopTypeVO troopTypeVO = this.FindChampionTypeIfPlatform(smartEntity.BuildingComp.BuildingType); if (troopTypeVO != null) { SmartEntity entity2 = this.FindChampionEntity(troopTypeVO); Service.Get <EntityRenderController>().UpdateChampionAnimationStateInHomeOrWarBoardMode(entity2, false); } } } else { if (id <= EventId.WorldLoadComplete) { if (id != EventId.BuildingConstructed) { if (id != EventId.WorldLoadComplete) { return(EatResponse.NotEaten); } } else { ContractEventData contractEventData = (ContractEventData)cookie; this.AddChampionToInventoryIfAlive((SmartEntity)contractEventData.Entity, flag); if (flag) { Service.Get <BuildingTooltipController>().EnsureBuildingTooltip((SmartEntity)contractEventData.Entity); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.ExitEditMode && id != EventId.ExitBaseLayoutToolMode) { if (id != EventId.TargetedBundleChampionRedeemed) { return(EatResponse.NotEaten); } SmartEntity building = (SmartEntity)cookie; Service.Get <PlayerValuesController>().RecalculateAll(); this.AddChampionToInventoryIfAlive(building, flag); return(EatResponse.NotEaten); } this.CreateChampionsOnPlatforms(); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.BuildingReplaced) { if (id <= EventId.BuildingCancelled) { if (id != EventId.BuildingViewReady) { if (id != EventId.BuildingCancelled) { return(EatResponse.NotEaten); } } else { EntityViewParams entityViewParams = (EntityViewParams)cookie; if (this.effectsByEntityId != null && this.effectsByEntityId.ContainsKey(entityViewParams.Entity.ID)) { BuildingHoloEffect buildingHoloEffect = this.effectsByEntityId[entityViewParams.Entity.ID]; if (buildingHoloEffect.WaitingForBuildingView) { buildingHoloEffect.UpdateEffect(); } } if (this.effectsByEntityId != null && entityViewParams.Entity.Has <NavigationCenterComponent>()) { this.AddNavigationCenterHolo(entityViewParams.Entity); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else { switch (id) { case EventId.StarshipMobilized: case EventId.HeroMobilized: this.OnUnitMobilized((ContractEventData)cookie); return(EatResponse.NotEaten); case EventId.StarshipMobilizedFromPrize: { Entity entity = Service.Get <BuildingLookupController>().FleetCommandNodeList.Head.Entity; this.CreateEffect(entity, (string)cookie, true, false); return(EatResponse.NotEaten); } case EventId.HeroMobilizedFromPrize: { Entity entity2 = Service.Get <BuildingLookupController>().TacticalCommandNodeList.Head.Entity; this.CreateEffect(entity2, (string)cookie, false, false); return(EatResponse.NotEaten); } default: if (id != EventId.BuildingConstructed) { if (id != EventId.BuildingReplaced) { return(EatResponse.NotEaten); } Entity entity3 = cookie as Entity; if (entity3.Has <NavigationCenterComponent>()) { this.AddNavigationCenterHolo(entity3); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } break; } } ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.BuildingVO.Type == BuildingType.NavigationCenter) { this.AddNavigationCenterHolo(); } } else if (id <= EventId.WorldReset) { if (id != EventId.WorldLoadComplete) { if (id == EventId.WorldReset) { this.RemoveAllEffects(); } } else { IState currentState = Service.Get <GameStateMachine>().CurrentState; if (currentState is ApplicationLoadState || currentState is HomeState || currentState is WarBoardState) { this.AddAllEffects(false); } } } else if (id != EventId.ContractStarted && id != EventId.ContractContinued) { if (id == EventId.ContractCanceled) { this.OnContractCanceled((ContractEventData)cookie); } } else { this.OnContractStarted((ContractEventData)cookie); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id <= EventId.BuildingReplaced) { if (id <= EventId.BuildingCancelled) { if (id != EventId.BuildingViewReady) { if (id != EventId.BuildingCancelled) { return(EatResponse.NotEaten); } } else { EntityViewParams entityViewParams = (EntityViewParams)cookie; if (entityViewParams.Entity.Has <ScoutTowerComponent>()) { this.CreateScoutHolo(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.EntityKilled) { if (id != EventId.BuildingConstructed) { if (id != EventId.BuildingReplaced) { return(EatResponse.NotEaten); } Entity entity = cookie as Entity; if (entity.Has <ScoutTowerComponent>()) { this.CreateScoutHolo(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else { SmartEntity smartEntity = (SmartEntity)cookie; if (smartEntity.BuildingComp == null) { return(EatResponse.NotEaten); } BuildingType type = smartEntity.BuildingComp.BuildingType.Type; if (!this.raidDefenseTrainerBindings.Contains(type)) { return(EatResponse.NotEaten); } UXController uXController = Service.Get <UXController>(); Lang lang = Service.Get <Lang>(); switch (type) { case BuildingType.FleetCommand: Service.Get <DeployerController>().SpecialAttackDeployer.ExitMode(); uXController.HUD.DisableSpecialAttacks(); uXController.MiscElementsManager.ShowPlayerInstructions(lang.Get("STARSHIP_TRAINER_DESTROYED", new object[0])); return(EatResponse.NotEaten); case BuildingType.HeroMobilizer: Service.Get <DeployerController>().HeroDeployer.ExitMode(); uXController.HUD.DisableHeroDeploys(); uXController.MiscElementsManager.ShowPlayerInstructions(lang.Get("HERO_TRAINER_DESTROYED", new object[0])); return(EatResponse.NotEaten); case BuildingType.ChampionPlatform: case BuildingType.Housing: return(EatResponse.NotEaten); case BuildingType.Squad: Service.Get <DeployerController>().SquadTroopDeployer.ExitMode(); uXController.HUD.DisableSquadDeploy(); uXController.MiscElementsManager.ShowPlayerInstructions(lang.Get("SQUAD_CENTER_DESTROYED", new object[0])); return(EatResponse.NotEaten); default: return(EatResponse.NotEaten); } } ContractEventData contractEventData = (ContractEventData)cookie; if (contractEventData.BuildingVO.Type == BuildingType.ScoutTower) { this.SendRaidDefenseUpdate(); } } else { if (id <= EventId.ContractStarted) { if (id != EventId.WorldLoadComplete) { if (id == EventId.WorldReset) { this.DestroyScoutHolo(); return(EatResponse.NotEaten); } if (id != EventId.ContractStarted) { return(EatResponse.NotEaten); } } else { IState currentState = Service.Get <GameStateMachine>().CurrentState; if (currentState is HomeState && this.RaidCompleteDidAwardCrate()) { GameUtils.ShowCrateAwardModal(this.lastAwardedCrateUid); this.lastAwardedCrateUid = null; Service.Get <EventManager>().UnregisterObserver(this, EventId.WorldLoadComplete); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } } else if (id != EventId.ContractContinued) { if (id == EventId.HeroDeployed) { EntityController entityController = Service.Get <EntityController>(); NodeList <OffensiveTroopNode> nodeList = entityController.GetNodeList <OffensiveTroopNode>(); TroopAttackController troopAttackController = Service.Get <TroopAttackController>(); for (OffensiveTroopNode offensiveTroopNode = nodeList.Head; offensiveTroopNode != null; offensiveTroopNode = offensiveTroopNode.Next) { troopAttackController.RefreshTarget((SmartEntity)offensiveTroopNode.Entity); } return(EatResponse.NotEaten); } if (id != EventId.PlanetRelocateStarted) { return(EatResponse.NotEaten); } if (this.AreRaidsAccessible()) { this.SendRaidDefenseUpdate(); return(EatResponse.NotEaten); } return(EatResponse.NotEaten); } ContractEventData contractEventData2 = (ContractEventData)cookie; if (contractEventData2.BuildingVO.Type == BuildingType.ScoutTower) { this.DestroyScoutHolo(); } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { IState currentState = Service.GameStateMachine.CurrentState; switch (id) { case EventId.BuildingSelected: { Entity entity = cookie as Entity; if (entity.Has <ShieldGeneratorComponent>() && !GameUtils.IsVisitingBase()) { this.effects.PlayAllEffects(true); Service.AudioManager.PlayAudio("sfx_shields_power_up"); } return(EatResponse.NotEaten); } case EventId.BuildingSelectedSound: IL_20: if (id != EventId.BuildingViewReady) { if (id == EventId.EntityHit) { Bullet bullet = cookie as Bullet; ShieldBorderComponent shieldBorderComp = bullet.Target.ShieldBorderComp; if (shieldBorderComp != null) { this.OnDamageShieldBorder(shieldBorderComp.ShieldGeneratorEntity, bullet); } return(EatResponse.NotEaten); } if (id == EventId.BuildingReplaced) { SmartEntity smartEntity = cookie as SmartEntity; if (smartEntity.ShieldGeneratorComp != null) { this.replacedEntities.Add(cookie as Entity); } return(EatResponse.NotEaten); } if (id == EventId.WorldLoadComplete) { this.effects.Cleanup(); this.replacedEntities.Clear(); if (GameUtils.IsVisitingBase()) { this.effects.PlayAllEffects(true); } return(EatResponse.NotEaten); } if (id != EventId.ShieldBorderDestroyed) { return(EatResponse.NotEaten); } ShieldBorderComponent sbc = cookie as ShieldBorderComponent; this.OnDestroyShieldBorder(sbc); return(EatResponse.NotEaten); } else { if (!(currentState is HomeState) && !(currentState is EditBaseState)) { return(EatResponse.NotEaten); } EntityViewParams entityViewParams = cookie as EntityViewParams; if (this.replacedEntities.Contains(entityViewParams.Entity)) { this.InitializeEffects(entityViewParams.Entity); this.replacedEntities.Remove(entityViewParams.Entity); } return(EatResponse.NotEaten); } break; case EventId.BuildingDeselected: { Entity entity2 = cookie as Entity; if (entity2.Has <ShieldGeneratorComponent>() && !GameUtils.IsVisitingBase()) { this.StopAllEffects(); } return(EatResponse.NotEaten); } } goto IL_20; }
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); }