Beispiel #1
0
    public void NextLevelButton()
    {
        if (showSkippableAd)
        {
            UnityAd.ShowSkippableAd();
            showSkippableAd = false;
            return;
        }

        if (showForceAd)
        {
            UnityAd.ShowForceAd();
            showForceAd = false;
            return;
        }

        if (SceneManager.GetActiveScene().name == "Multiplayer")
        {
            SceneManager.LoadScene("MainMenu");
            return;
        }

        //Not only checks, but also increases the current sub chapter, it is a unique chunk of codes.
        ChapterSelectManager.currentLevel += 1;
        string nextSubLevelName = ChapterSelectManager.selectedChapter + "_" + ChapterSelectManager.currentLevel.ToString();
        bool   nextExists       = Application.CanStreamedLevelBeLoaded(nextSubLevelName);

        if (!nextExists)
        {
            SceneManager.LoadScene("Level Select");
            if (ChapterSelectManager.currentChapterSelected == null)
            {
                Debug.Log("Game does not work as intended if not played through LevelSelection scene at least");
            }
            else
            {
                PlayerPrefs.SetInt(ChapterSelectManager.saveDataName, ChapterSelectManager.currentChapterSelected.chapter);
                PlayerPrefs.Save();
            }
        }
        else
        {
            SceneManager.LoadScene(nextSubLevelName);
        }
    }
Beispiel #2
0
        public static void Request(Segment segment, System.Action <bool> callback)
        {
            var zone = segment.ZoneId;

            Debug.Log("FunAd.Rewarded.Request: " + zone);

            if (zone.IsNullOrEmpty())
            {
                admono.Call(callback, false);
                return;
            }

            if (segment.IsReady)
            {
                admono.Call(callback, true);
                return;
            }

#if ABR || TAPSELL
            TapsellPlus.RequestRewardedVideoAd(zone,
                                               zoneId =>
            {
                segment.ResponseZone = zoneId.zoneId;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                               error =>
            {
                Debug.Log("Tapsell.RequestRewardedVideo.Error: " + error.message);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#elif UAD
            UnityAd.Load(zone, success =>
            {
                if (success)
                {
                    segment.ResponseZone = zone;
                    callback?.Invoke(true);
                    OnLoaded?.Invoke(segment);
                }
                else
                {
                    OnError?.Invoke(segment);
                    callback?.Invoke(false);
                }
            });
#elif ADMOB
            AdMob.RequestRewarded(zone,
                                  zid =>
            {
                segment.ResponseZone = zone;
                callback?.Invoke(true);
                OnLoaded?.Invoke(segment);
            },
                                  error =>
            {
                Debug.Log("AdMob.RequestRewarded.Error: " + error);
                callback?.Invoke(false);
                OnError?.Invoke(segment);
            });
#else
            callback?.Invoke(false);
#endif
        }