コード例 #1
0
 private void OnAdClosed(bool isCloseSuccess)
 {
     if (isCloseSuccess)
     {
         OnBack();
     }
     else
     {
         PopupInstanceMsg.ShowPopupInstanceMsg(GameConstants.AD_FAIL_MSG, 2f, InstanceMsgType.WARNING);
     }
 }
コード例 #2
0
 private void OnAdClosed(bool isNormalClose)
 {
     if (!isNormalClose)
     {
         PopupInstanceMsg.ShowPopupInstanceMsg(
             GameConstants.AD_FAIL_MSG,
             2.0f,
             InstanceMsgType.WARNING
             );
     }
     else
     {
         StartCoroutine(OnAdClosedProcess());
     }
 }
コード例 #3
0
    IEnumerator ProcessDoubleCoin()
    {
        ShowWatchButton(false);

        _shareButton.interactable  = false;
        _rePlayButton.interactable = false;

        bool isClosedResult = false;
        bool closed         = false;
        bool rewarded       = false;

        Action <Reward> onRewarded = (reward) => rewarded = true;
        Action <bool>   onCanceled = (close) => {
            closed         = true;
            isClosedResult = close;
        };

        NetworkManager.Instance.ShowRewardVideoAd(
            GameConstants.ADUNIT_REWARD,
            onRewarded,
            onCanceled
            );

        while (!closed)
        {
            yield return(new WaitForEndOfFrame());
        }

        //광고 실패(로드, 호출 등)
        if (!isClosedResult)
        {
            PopupInstanceMsg.ShowPopupInstanceMsg(GameConstants.AD_FAIL_MSG, 2f, InstanceMsgType.WARNING);
        }

        if (rewarded)
        {
            _coinEffect.SetActive(true);

            LeanTween.value(_rewardedCoin, _rewardedCoin * 2, 0.5f).
            setOnUpdate(val => _resultCoinText.text = SystemUtil.GetCommaText((int)val));

            DataManager.Instance.UserData.AddCoin(_rewardedCoin);
        }

        _shareButton.interactable  = true;
        _rePlayButton.interactable = true;
    }
コード例 #4
0
    public override IEnumerator OnInitialize()
    {
        yield return(base.OnInitialize());

        Action <Reward> onRewarded = reward => {
            if (_onRewardComplete != null)
            {
                _onRewardComplete();
            }
        };

        Action <bool> onClosed = state => {
            if (state)
            {
                OnBack();
            }
            else
            {
                PopupInstanceMsg.ShowPopupInstanceMsg(
                    GameConstants.AD_FAIL_MSG,
                    2.0f,
                    InstanceMsgType.WARNING
                    );
            }
        };

        _closeButton.onClick.AddListener(OnBack);
        _watchButton.onClick.AddListener(() => {
            AnalyticsManager.Instance.EventLog(GameConstants.EVENTLOG_BASICMODE_CONTINUE);
            _closeButton.interactable = false;
            _watchButton.interactable = false;
            NetworkManager.Instance.ShowRewardVideoAd(
                GameConstants.ADUNIT_REWARD,
                onRewarded,
                onClosed);
        });
    }