private void SetupRenderTargetMesh(GameObject rootReward, SupplyCrateTag crateTag) { Transform transform = this.assetMeshDataMonoBehavior.OtherGameObjects[7].transform; GameObject gameObject = transform.Find("datacardscreenmesh").gameObject; Renderer component = gameObject.GetComponent <Renderer>(); component.sharedMaterial.mainTexture = crateTag.RenderTexture; component.sharedMaterial.shader = Shader.Find("Unlit/Transparent Colored"); }
private void SetupShardQualityDisplay(GameObject rootReward, SupplyCrateTag crateTag) { Transform transform = this.assetMeshDataMonoBehavior.OtherGameObjects[7].transform; GameObject gameObject = transform.Find("rarity_star_01").gameObject; GameObject gameObject2 = transform.Find("rarity_star_02").gameObject; GameObject gameObject3 = transform.Find("rarity_star_03").gameObject; GameObject gameObject4 = transform.Find("rarity_star_10").gameObject; gameObject.SetActive(false); gameObject2.SetActive(false); gameObject3.SetActive(false); gameObject4.SetActive(false); GameObject gameObject5 = this.assetMeshDataMonoBehavior.OtherGameObjects[3]; GameObject gameObject6 = this.assetMeshDataMonoBehavior.OtherGameObjects[4]; GameObject gameObject7 = this.assetMeshDataMonoBehavior.OtherGameObjects[5]; GameObject gameObject8 = this.assetMeshDataMonoBehavior.OtherGameObjects[6]; gameObject5.SetActive(false); gameObject6.SetActive(false); gameObject7.SetActive(false); gameObject8.SetActive(false); ShardQuality shardQuailty = crateTag.ShardQuailty; switch (shardQuailty) { case ShardQuality.Basic: gameObject.SetActive(true); gameObject5.SetActive(true); break; case ShardQuality.Advanced: gameObject2.SetActive(true); gameObject6.SetActive(true); break; case ShardQuality.Elite: gameObject3.SetActive(true); gameObject7.SetActive(true); break; default: if (shardQuailty == ShardQuality.Unit) { gameObject4.SetActive(true); gameObject8.SetActive(true); } break; } this.ChangeCrateRayColor(); }
public EatResponse OnEvent(EventId id, object cookie) { bool flag = cookie != null && (bool)cookie; if (id == EventId.PlayCrateAnimVfx && !flag) { if (!this.isSkippingReward && this.rewardIndex >= this.supplyCrateDataList.Count - 1) { this.screen.ChangePrimaryButtonToClose(); } if (this.rewardIndex >= this.supplyCrateDataList.Count) { if (!this.isSkippingReward) { this.rewardIndex++; this.HideAllRewards(); } } else { this.currentCrateItem = this.supplyCrateDataList[this.rewardIndex]; if (!this.isSkippingReward) { this.rewardIndex++; this.SetupCrateRewardItem(this.currentCrateItem); this.crateVfxParticles.Play(); this.PlayVFXTriggerSFX(this.currentCrateItem.CrateSupply.RewardAnimationTierSfx); this.rewardAnimEventReceived = true; } } } else if (id == EventId.CrateRewardAnimDone) { if (this.rewardIndex > this.supplyCrateDataList.Count) { return(EatResponse.NotEaten); } if (this.IsCurrentItemRewardAShard()) { this.HandleShardRewardItemShow(); } else { this.screen.ShowNameAndAmountUI(this.currentCrateItem); } } return(EatResponse.NotEaten); }
private void RenderTextureCompleteCallback(RenderTexture renderTexture, ProjectorConfig config) { int i = 0; int count = this.supplyCrateDataList.Count; while (i < count) { SupplyCrateTag supplyCrateTag = this.supplyCrateDataList[i]; if (config == supplyCrateTag.Config) { supplyCrateTag.RenderTexture = renderTexture; break; } i++; } }
private void SetupCrateRewardItem(SupplyCrateTag crateTag) { CrateSupplyVO crateSupply = crateTag.CrateSupply; this.HideAllRewards(); switch (crateSupply.Type) { case SupplyType.Currency: this.ActivateCurrencyRewardItem(crateSupply.RewardUid); break; case SupplyType.Shard: case SupplyType.ShardTroop: case SupplyType.ShardSpecialAttack: if (this.shardReward != null) { this.shardReward.SetActive(true); if (this.isSkippingReward) { this.shardRewardAnimator.SetTrigger("ShowDiscSpinEnd"); } this.SetupRenderTargetMesh(this.shardReward, crateTag); this.SetupShardQualityDisplay(this.shardReward, crateTag); } if (this.shardBackVfx != null) { this.shardBackVfx.SetActive(true); } break; case SupplyType.Troop: case SupplyType.Hero: case SupplyType.SpecialAttack: if (this.unitReward != null) { this.unitReward.SetActive(true); this.SetupRenderTargetMesh(this.unitReward, crateTag); } if (this.unitBackVfx != null) { this.unitBackVfx.SetActive(true); } break; } }
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); }