private void OnLevelLoaded(GameLevelLoaded data) { LevelManager levelManager = WPFMonoBehaviour.levelManager; if (levelManager != null && levelManager.CurrentGameMode is BaseGameMode && !levelManager.m_sandbox && !levelManager.m_raceLevel) { int index = 0; if (this.IsDailyChallenge(data.episodeIndex, data.levelIndex, out index) && !this.dailyChallenges[index].collected) { DailyLevel daily = Singleton <GameManager> .instance.gameData.m_dailyChallengeData.GetDaily(this.dailyChallenges[index].DailyKey); Vector3 position; if (daily != null && daily.GetPosition(this.dailyChallenges[index].positionIndex, out position)) { GameObject gameObject = WPFMonoBehaviour.gameData.m_lootCrates[(int)this.TodaysLootCrate(index)]; GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject, position, Quaternion.identity); LootCrate component = gameObject2.GetComponent <LootCrate>(); LootCrate lootCrate = component; lootCrate.OnCollect = (Action)Delegate.Combine(lootCrate.OnCollect, new Action(delegate() { this.OnDailyRewardCollected(index); })); LootCrate lootCrate2 = component; lootCrate2.RewardExperience = (Func <int>)Delegate.Combine(lootCrate2.RewardExperience, new Func <int>(this.RewardExperience)); component.SetAnalyticData(index, this.dailyChallenges[index].adRevealed); this.dailyChallenges[index].revealed = true; UnityEngine.Debug.LogWarning("Instantiated " + gameObject.name + " at position " + position.ToString()); } } } }