Example #1
0
    private void Start()
    {
        Debug.Log("Finish Start");


        obj_Next.SetActive(PlayerPrefs.GetInt("conti", 0) == 0);
        obj_gold.SetActive(PlayerPrefs.GetInt("conti", 0) != 0);

        if (AdsUtil.isRewardAdsLoaded() || AdsUtil.isRewardISAdsLoaded())
        {
            this.m_type = 1;
        }
        else
        {
            this.m_type = 2;
        }

        Debug.Log("Btn Start");


        Debug.Log("Teween Start");

        Sequence sequence = DOTween.Sequence();
        int      type     = this.m_type;

        Debug.Log("Teween 2 Start");

        sequence = DOTween.Sequence();
        sequence.AppendInterval(2f);
        GM.GetInstance().SetFirstFinishGame();

        Debug.Log("Finish End");

        EventTrigger eventTrigger = Btn_Ok.gameObject.AddComponent <EventTrigger>();

        EventTrigger.Entry entry_PointerDown = new EventTrigger.Entry();
        entry_PointerDown.eventID = EventTriggerType.PointerDown;
        entry_PointerDown.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Down(Btn_Ok.transform); });
        eventTrigger.triggers.Add(entry_PointerDown);

        EventTrigger.Entry entry_PointerUp = new EventTrigger.Entry();
        entry_PointerUp.eventID = EventTriggerType.PointerUp;
        entry_PointerUp.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Up(Btn_Ok.transform); });
        eventTrigger.triggers.Add(entry_PointerUp);

        eventTrigger = Btn_conti.gameObject.AddComponent <EventTrigger>();

        entry_PointerDown         = new EventTrigger.Entry();
        entry_PointerDown.eventID = EventTriggerType.PointerDown;
        entry_PointerDown.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Down(Btn_conti.transform); });
        eventTrigger.triggers.Add(entry_PointerDown);

        entry_PointerUp         = new EventTrigger.Entry();
        entry_PointerUp.eventID = EventTriggerType.PointerUp;
        entry_PointerUp.callback.AddListener((data) => { FindObjectOfType <MainScene>().Pointer_Up(Btn_conti.transform); });
        eventTrigger.triggers.Add(entry_PointerUp);
    }
        public void Play(AdsManager.AdType type, Action finishCallback = null, Action cancelCallback = null, int awardValue = 5, Action unLoadCallfunc = null)
        {
            switch (type)
            {
            case AdsManager.AdType.Stimulate:

                //이미 시청줌
                if (!this.m_isWatch)
                {
                    //ToastManager.Show("TXT_NO_50013", true);
                    Debug.Log("이미시청");
                    return;
                }

                if (!AdsControl.Instance.Check_Rewaed())
                {
                    //ToastManager.Show("TXT_NO_50013", true);
                    Debug.Log("아 없다고....");
                    return;
                }

                Debug.Log("아님 뭐냐....");

                GM.GetInstance().IsPlayVedioAds = true;

                this.m_isWatch = false;

                AdsControl.Instance.reward_Type = Reward_Type.stimulate;
                AdsControl.Instance.awardValue  = awardValue;

                AdsControl.Instance.ShowRewardedAd();

                TaskData.GetInstance().Add(100105, 1, true);
                AdsManager.GetInstance().SaveVedioTime();
                AdsManager.GetInstance().M_preVedioTime = AdsManager.GetInstance().GetPreVedioTime();

                GM.GetInstance().IsPlayVedioAds = false;
                Debug.Log("끝....");

                //AppsflyerUtils.TrackVedioError((int)type);
                if (unLoadCallfunc != null)
                {
                    unLoadCallfunc();
                    return;
                }
                break;

            case AdsManager.AdType.GotoMainPage:
            case AdsManager.AdType.GetTask:
            case AdsManager.AdType.GetAchiev:
            case AdsManager.AdType.Refresh:
            case AdsManager.AdType.Continue:
            case AdsManager.AdType.Finish:
            case AdsManager.AdType.ForceGround:
                if (!this.isShowAds())
                {
                    Action expr_2F6 = finishCallback;
                    if (expr_2F6 == null)
                    {
                        return;
                    }
                    expr_2F6();
                    return;
                }
                else
                {
                    if (AdsUtil.isInsertISAdsLoaded())
                    {
                        AdsUtil.showInsertISAds(delegate
                        {
                            Action expr_06 = finishCallback;
                            if (expr_06 == null)
                            {
                                return;
                            }
                            expr_06();
                        }, null);
                        return;
                    }
                    if (AdsUtil.isInsertAdsLoaded())
                    {
                        AdsUtil.showInsertAds(delegate
                        {
                            Action expr_06 = finishCallback;
                            if (expr_06 == null)
                            {
                                return;
                            }
                            expr_06();
                        }, null);
                        return;
                    }
                    Action expr_33D = finishCallback;
                    if (expr_33D == null)
                    {
                        return;
                    }
                    expr_33D();
                }
                break;

            case AdsManager.AdType.ResetLife:
            case AdsManager.AdType.UseProp:
            case AdsManager.AdType.ResetLife2:
                //AppsflyerUtils.TrackClickVedio((int)type);
                GM.GetInstance().IsPlayVedioAds = true;
                if (AdsUtil.isRewardAdsLoaded())
                {
                    AdsUtil.showRewardAds(delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = finishCallback;
                        if (expr_11 != null)
                        {
                            expr_11();
                        }
                        //AppsflyerUtils.TrackVedio((int)type);
                    }, delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = cancelCallback;
                        if (expr_11 == null)
                        {
                            return;
                        }
                        expr_11();
                    });
                    return;
                }
                if (AdsUtil.isRewardISAdsLoaded())
                {
                    AdsUtil.showRewardISAds(delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = finishCallback;
                        if (expr_11 != null)
                        {
                            expr_11();
                        }
                        //AppsflyerUtils.TrackVedio((int)type);
                    }, delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = cancelCallback;
                        if (expr_11 == null)
                        {
                            return;
                        }
                        expr_11();
                    });
                    return;
                }
                ToastManager.Show("TXT_NO_50014", true);
                GM.GetInstance().IsPlayVedioAds = false;
                ///AppsflyerUtils.TrackVedioError((int)type);
                if (unLoadCallfunc != null)
                {
                    unLoadCallfunc();
                    return;
                }
                break;

            case AdsManager.AdType.MultiAwards:
                //AppsflyerUtils.TrackClickVedio((int)type);
                GM.GetInstance().IsPlayVedioAds = true;

                AdsControl.Instance.ShowRewardedAd();

                GM.GetInstance().AddDiamond(awardValue * 2, true);

                DialogManager.GetInstance().Close(null);

                GM.GetInstance().IsPlayVedioAds = false;
                return;

            case AdsManager.AdType.Skin:
                ///AppsflyerUtils.TrackClickVedio((int)type);
                GM.GetInstance().IsPlayVedioAds = true;
                if (AdsUtil.isRewardAdsLoaded())
                {
                    AdsUtil.showRewardAds(delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = finishCallback;
                        if (expr_11 != null)
                        {
                            expr_11();
                        }
                        ///	AppsflyerUtils.TrackVedio((int)type);
                    }, delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = cancelCallback;
                        if (expr_11 == null)
                        {
                            return;
                        }
                        expr_11();
                    });
                    return;
                }
                if (AdsUtil.isRewardISAdsLoaded())
                {
                    AdsUtil.showRewardISAds(delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = finishCallback;
                        if (expr_11 != null)
                        {
                            expr_11();
                        }
                        ///	AppsflyerUtils.TrackVedio((int)type);
                    }, delegate
                    {
                        GM.GetInstance().IsPlayVedioAds = false;
                        Action expr_11 = cancelCallback;
                        if (expr_11 == null)
                        {
                            return;
                        }
                        expr_11();
                    });
                    return;
                }
                ToastManager.Show("TXT_NO_50014", true);
                GM.GetInstance().IsPlayVedioAds = false;
                ////AppsflyerUtils.TrackVedioError((int)type);
                if (unLoadCallfunc != null)
                {
                    unLoadCallfunc();
                    return;
                }
                break;

            default:
                return;
            }
        }