コード例 #1
0
        private IEnumerator showPopupScreen(DRewardPopupScreen screenData)
        {
            PrefabContentKey screenContentKey = RewardPopupConstants.ScreenSplashContentKey;

            switch (screenData.ScreenType)
            {
            case DRewardPopupScreen.RewardScreenPopupType.splash:
                screenContentKey = RewardPopupConstants.ScreenSplashContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.splash_levelup:
                screenContentKey = RewardPopupConstants.ScreenLevelUpContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.splash_replay:
                screenContentKey = RewardPopupConstants.ScreenReplayContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.items:
                screenContentKey = RewardPopupConstants.ScreenItemContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.count:
                screenContentKey = RewardPopupConstants.ScreenCountContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.coinsxp:
                screenContentKey = RewardPopupConstants.ScreenCoinsXPContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.quests:
                screenContentKey = RewardPopupConstants.ScreenQuestsContentKey;
                break;

            case DRewardPopupScreen.RewardScreenPopupType.custom:
            {
                DRewardPopupScreenCustom dRewardPopupScreenCustom = screenData as DRewardPopupScreenCustom;
                if (dRewardPopupScreenCustom != null)
                {
                    screenContentKey = dRewardPopupScreenCustom.ScreenKey;
                }
                break;
            }
            }
            AssetRequest <GameObject> assetRequest = Content.LoadAsync(screenContentKey);

            yield return(assetRequest);

            GameObject screenGO = UnityEngine.Object.Instantiate(assetRequest.Asset);

            screenGO.transform.SetParent(ScreenParentTransform, worldPositionStays: false);
            screenGO.GetComponent <RectTransform>().localPosition += new Vector3(0f, 0f, -100f);
            currentScreen = screenGO.GetComponent <RewardPopupScreen>();
            currentScreen.ScreenCompleteAction += onCurrentScreenComplete;
            currentScreen.Init(screenData, this);
        }
コード例 #2
0
        private static List <DRewardPopupScreen> buildCustomScreens(DRewardPopup popupData)
        {
            List <DRewardPopupScreen> list = new List <DRewardPopupScreen>();

            if (popupData.CustomScreenKeys != null)
            {
                for (int i = 0; i < popupData.CustomScreenKeys.Count; i++)
                {
                    DRewardPopupScreenCustom item = new DRewardPopupScreenCustom(popupData.CustomScreenKeys[i]);
                    list.Add(item);
                }
            }
            return(list);
        }