private void UpdateCrateAnimState(InventoryCrateAnimationState nextState) { this.crateAnimState = nextState; this.PlayAnimStateSFX(this.crateAnimState); }
private void PlayAnimStateSFX(InventoryCrateAnimationState nextState) { Service.EventManager.SendEvent(EventId.InventoryCrateAnimationStateChange, nextState); }
public InventoryCrateAnimation(List <CrateSupplyVO> supplyTableDataList, CrateData crateData, Dictionary <string, int> shardsOriginal, Dictionary <string, int> equipmentOriginal, Dictionary <string, int> troopUpgradeOriginalCopy, Dictionary <string, int> specialAttackUpgradeOriginalCopy) { List <string> assetNames = new List <string>(); List <object> cookies = new List <object>(); this.assetHandles = new List <AssetHandle>(); this.supplyCrateDataList = new List <SupplyCrateTag>(); this.hq = crateData.HQLevel; this.screen = new InventoryCrateCollectionScreen(this, crateData); StaticDataController staticDataController = Service.StaticDataController; this.crateVO = staticDataController.Get <CrateVO>(crateData.CrateId); this.shardsOriginal = shardsOriginal; this.equipmentOriginal = equipmentOriginal; this.troopUpgradeOrignal = troopUpgradeOriginalCopy; this.specialAttackUpgradeOrignal = specialAttackUpgradeOriginalCopy; this.crateAnimState = InventoryCrateAnimationState.Falling; this.crateLandTimer = 0u; this.playOpenOnLanding = false; this.isSkippingReward = false; this.rewardAnimStarted = false; this.rewardAnimEventReceived = false; this.IsLoaded = false; int i = 0; int count = supplyTableDataList.Count; while (i < count) { SupplyCrateTag supplyCrateTag = new SupplyCrateTag(); CrateSupplyVO crateSupplyVO = supplyTableDataList[i]; SupplyType type = crateSupplyVO.Type; supplyCrateTag.CrateSupply = crateSupplyVO; this.supplyCrateDataList.Add(supplyCrateTag); if (type != SupplyType.Currency) { IGeometryVO iconVOFromCrateSupply = GameUtils.GetIconVOFromCrateSupply(crateSupplyVO, this.hq); this.AddAssetToLoadList(assetNames, cookies, iconVOFromCrateSupply.IconAssetName); ProjectorConfig projectorConfig; if (iconVOFromCrateSupply is EquipmentVO) { EquipmentVO equipmentVO = (EquipmentVO)iconVOFromCrateSupply; supplyCrateTag.Equipment = equipmentVO; supplyCrateTag.ShardQuailty = equipmentVO.Quality; projectorConfig = ProjectorUtils.GenerateEquipmentConfig(iconVOFromCrateSupply as EquipmentVO, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f); } else { if (type == SupplyType.ShardSpecialAttack || type == SupplyType.ShardTroop) { ShardVO shardVO = staticDataController.Get <ShardVO>(crateSupplyVO.RewardUid); supplyCrateTag.ShardQuailty = shardVO.Quality; supplyCrateTag.UnlockShard = shardVO; } projectorConfig = ProjectorUtils.GenerateGeometryConfig(iconVOFromCrateSupply, new Action <RenderTexture, ProjectorConfig>(this.RenderTextureCompleteCallback), 256f, 256f); } projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred; supplyCrateTag.Config = projectorConfig; supplyCrateTag.Projector = ProjectorUtils.GenerateProjector(projectorConfig); } i++; } this.AddAssetToLoadList(assetNames, cookies, this.crateVO.RewardAnimationAssetName); this.AddAssetToLoadList(assetNames, cookies, "crate_controller"); Service.AssetManager.MultiLoad(this.assetHandles, assetNames, new AssetSuccessDelegate(this.LoadSuccess), new AssetFailureDelegate(this.LoadFailed), cookies, new AssetsCompleteDelegate(this.AssetsCompleteDelegate), null); }