コード例 #1
0
        //--------------------------OTHER METHODS---------->
        void AdCallbackhandler(ShowResult result)
        {
            switch (result)
            {
            case ShowResult.Finished:
                if (AdFinished != null)
                {
                    AdFinished.Invoke();
                }
                Debug.Log("Ad Finished. Rewarding player...");
                break;

            case ShowResult.Skipped:
                if (AdSkipped != null)
                {
                    AdSkipped.Invoke();
                }
                Debug.Log("Ad skipped. Son, I am dissapointed in you");
                break;

            case ShowResult.Failed:
                if (AdFailed != null)
                {
                    AdFailed.Invoke();
                }
                Debug.Log("I swear this has never happened to me before");
                break;
            }

            AdFinished = null;
            AdSkipped  = null;
            AdFailed   = null;
        }
コード例 #2
0
    private static void HandleShowResult(ShowResult result)
    {
        Result = result;

        if (result == ShowResult.Finished)
        {
            Debug.Log("Video completed - Offer a reward to the player");
            AdFinished.Invoke();

            if (GameAdvert)
            {
                GameAdvert       = false;
                GamesSinceAdvert = 0;
                SaveGameData();
            }
        }
        else if (result == ShowResult.Skipped)
        {
            Debug.LogWarning("Video was skipped - Do NOT reward the player");
            AdSkipped.Invoke();

            if (GameAdvert)
            {
                GameAdvert       = false;
                GamesSinceAdvert = 0;
                SaveGameData();
            }
        }
        else if (result == ShowResult.Failed)
        {
            Debug.LogError("Video failed to show");
            AdFailed.Invoke();
        }
    }