Example #1
0
        private IEnumerator loadPopup()
        {
            AssetRequest <GameObject> assetRequestRewarUI = Content.LoadAsync(halfItemContentKey);

            yield return(assetRequestRewarUI);

            LootTableRewardDefinition       lootDefinition = minigameService.GetLootRewardDefinition(prizeName);
            List <MascotXPRewardDefinition> xp             = ((!(lootDefinition.Reward != null)) ? new List <MascotXPRewardDefinition>() : lootDefinition.Reward.GetDefinitions <MascotXPRewardDefinition>());
            DItemRewardPopup rewardPopupData = new DItemRewardPopup();

            rewardPopupData.HeaderText            = "You fished up an item!";
            rewardPopupData.ItemName              = Service.Get <Localizer>().GetTokenTranslation(lootDefinition.DisplayName);
            rewardPopupData.CoinReward            = CoinRewardableDefinition.Coins(lootDefinition.Reward);
            rewardPopupData.XpReward              = ((xp.Count > 0) ? xp[0].XP : 0);
            rewardPopupData.MascotDefinition      = ((xp.Count > 0) ? xp[0].Mascot : null);
            rewardPopupData.MascotAbbreviatedName = ((xp.Count > 0) ? xp[0].Mascot.AbbreviatedName : "");
            rewardPopupData.RewardCategory        = RewardCategory.genericSprite;
            rewardPopupData.RewardData            = new DReward();
            rewardPopupData.RewardData.UnlockID   = lootDefinition.RewardImage;
            rewardPopupData.IsQuestItem           = isQuestPrize;
            rewardPopupData.RewardIcon            = lootDefinition.RewardImage;
            GameObject popup = UnityEngine.Object.Instantiate(assetRequestRewarUI.Asset);

            itemRewardPopup = popup.GetComponent <ItemRewardPopupHalf>();
            if (itemRewardPopup != null)
            {
                itemRewardPopup.SetData(rewardPopupData);
                itemRewardPopup.DoneClose += onPopupClosed;
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(popup));
        }
        private void onPrefabLoaded(string path, GameObject prefab)
        {
            MinigameService                 minigameService      = Service.Get <MinigameService>();
            LootTableRewardDefinition       lootRewardDefinition = minigameService.GetLootRewardDefinition(PrizeName.Value);
            List <MascotXPRewardDefinition> list             = ((!(lootRewardDefinition.Reward != null)) ? new List <MascotXPRewardDefinition>() : lootRewardDefinition.Reward.GetDefinitions <MascotXPRewardDefinition>());
            DItemRewardPopup                dItemRewardPopup = new DItemRewardPopup();

            dItemRewardPopup.HeaderText            = "You fished up an item!";
            dItemRewardPopup.ItemName              = Service.Get <Localizer>().GetTokenTranslation(lootRewardDefinition.DisplayName);
            dItemRewardPopup.CoinReward            = CoinRewardableDefinition.Coins(lootRewardDefinition.Reward);
            dItemRewardPopup.XpReward              = ((list.Count > 0) ? list[0].XP : 0);
            dItemRewardPopup.MascotDefinition      = ((list.Count > 0) ? list[0].Mascot : null);
            dItemRewardPopup.MascotAbbreviatedName = ((list.Count > 0) ? list[0].Mascot.AbbreviatedName : "");
            dItemRewardPopup.RewardCategory        = RewardCategory.genericSprite;
            dItemRewardPopup.RewardData            = new DReward();
            dItemRewardPopup.RewardData.UnlockID   = lootRewardDefinition.RewardImage;
            popup           = Object.Instantiate(prefab);
            itemRewardPopup = popup.GetComponent <ItemRewardPopup>();
            if (itemRewardPopup != null)
            {
                itemRewardPopup.SetData(dItemRewardPopup);
                itemRewardPopup.DoneClose += onPopupClosed;
            }
            Service.Get <EventDispatcher>().DispatchEvent(new PopupEvents.ShowPopup(popup, destroyPopupOnBackPressed: false, scaleToFit: true, "Accessibility.Popup.Title.FishingReward"));
        }