public void ForceReInit() { this.initialized = false; if (this.rewards.Initialized) { this.Initialize(); } else { LootWheelRewards lootWheelRewards = this.rewards; lootWheelRewards.OnInitialized = (Action)Delegate.Combine(lootWheelRewards.OnInitialized, new Action(this.Initialize)); } }
private void OnDestroy() { if (this.epicStarAnim != null && this.epicStarAnim.state != null) { this.epicStarAnim.state.Complete -= this.OnStarAnimationComplete; } if (this.rareStarAnim != null && this.rareStarAnim.state != null) { this.rareStarAnim.state.Complete -= this.OnStarAnimationComplete; } if (this.commonStarAnim != null && this.commonStarAnim.state != null) { this.commonStarAnim.state.Complete -= this.OnStarAnimationComplete; } if (this.rewards != null) { LootWheelRewards lootWheelRewards = this.rewards; lootWheelRewards.OnInitialized = (Action)Delegate.Remove(lootWheelRewards.OnInitialized, new Action(this.Initialize)); } }
public LootWheelRewards.LootWheelReward[] InitReward(LootWheelRewards rewards) { this.m_rewardIndex = 0; switch (this.m_slotType) { case LootWheel.WheelSlotType.Part: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.CommonPart), rewards.GetReward(LootWheelRewards.WheelReward.RarePart), rewards.GetReward(LootWheelRewards.WheelReward.EpicPart) }; break; case LootWheel.WheelSlotType.Scrap1: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Scrap1) }; break; case LootWheel.WheelSlotType.Scrap2: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Scrap2) }; break; case LootWheel.WheelSlotType.Dessert1: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Dessert1) }; break; case LootWheel.WheelSlotType.Dessert2: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Dessert2) }; break; case LootWheel.WheelSlotType.Dessert3: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Dessert3) }; break; case LootWheel.WheelSlotType.Powerup: this.m_rewards = new LootWheelRewards.LootWheelReward[] { rewards.GetReward(LootWheelRewards.WheelReward.Powerup) }; break; } this.m_probabilities = new float[this.m_rewards.Length]; for (int i = 0; i < this.m_probabilities.Length; i++) { float num = (float)rewards.TotalRewardValues / (float)this.m_rewards[i].TotalValue; this.m_probabilities[i] = num / rewards.TotalRewardInverseValues; } if (this.m_countIndicator != null && this.m_rewards.Length > 0) { TextMesh[] componentsInChildren = this.m_countIndicator.gameObject.GetComponentsInChildren <TextMesh>(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].text = this.m_rewards[0].Amount.ToString(); } } if (this.m_slotType == LootWheel.WheelSlotType.Part) { this.CheckDuplicateParts(); } if (this.m_slotType == LootWheel.WheelSlotType.Powerup && this.m_rewards.Length > 0) { this.CreatePowerupIcon(this.m_rewards[0].PowerupReward); } this.m_collectedIndicator.SetActive(false); return(this.m_rewards); }