private void Start()
    {
        if (timerText != null)
        {
            timerText.onCountDownComplete += OnCountDownComplete;
        }

#if UNITY_ANDROID || UNITY_IOS
        Timer.Schedule(this, 0.1f, AddEvents);

        if (!IsAvailableToShow())
        {
            buttonGroup.SetActive(false);
            if (IsAdAvailable() && !IsActionAvailable())
            {
                int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
                ShowTimerText(remainTime);
            }
        }

        InvokeRepeating("IUpdate", 1, 1);
#else
        buttonGroup.SetActive(false);
#endif
    }
Ejemplo n.º 2
0
 private void OnApplicationPause(bool pause)
 {
     if (!pause)
     {
         if (adAvailableTextHolder.activeSelf)
         {
             int remainTime = (int)(ConfigController.Config.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
             ShowTimerText(remainTime);
         }
     }
 }
 private void OnApplicationPause(bool pause)
 {
     if (!pause)
     {
         if (textGroup != null && textGroup.activeSelf)
         {
             int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
             ShowTimerText(remainTime);
         }
     }
 }
    public void OnClick()
    {
        if (IsAvailableToShow())
        {
            AdmobController.instance.ShowRewardBasedVideo();
        }
        else if (!IsActionAvailable())
        {
            int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
            Toast.instance.ShowMessage("Please wait " + remainTime + " seconds for the next ad");
        }
        else
        {
            Toast.instance.ShowMessage("Ad is not available now, please wait..");
        }

        Sound.instance.PlayButton();
    }
Ejemplo n.º 5
0
    public void OnClick()
    {
#if UNITY_ANDROID || UNITY_IOS
        if (IsAvailableToShow())
        {
            AdmobController.instance.ShowRewardBasedVideo();
        }
        else if (!IsAdAvailable())
        {
            Toast.instance.ShowMessage("Ad is not available now");
        }
        else
        {
            int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
            Toast.instance.ShowMessage("Please wait " + remainTime + "seconds for the next ad");
        }
#endif
    }
    public void OnClick()
    {
        if (IsAvailableToShow())
        {
            //TODO: ADD UNITY ADS CALL HERE
            //AdmobController.instance.ShowRewardBasedVideo();
        }
        else if (!IsActionAvailable())
        {
            int remainTime = (int)(ConfigController.Config.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));

            int minute = remainTime / 60;
            int second = remainTime % 60;

            string m = minute == 1 ? "minute" : "minutes";
            string s = second == 1 ? "second" : "seconds";

            string m2 = minute == 1 ? "min" : "mins";
            string s2 = second == 1 ? "sec" : "secs";

            if (minute == 0)
            {
                Toast.instance.ShowMessage("Please wait " + second + " " + s + " for the next ad");
            }
            else if (second == 0)
            {
                Toast.instance.ShowMessage("Please wait " + minute + " " + m + " for the next ad");
            }
            else
            {
                Toast.instance.ShowMessage("Please wait " + minute + " " + m2 + " " + second + " " + s2 + " for the next ad");
            }
        }
        else
        {
            Toast.instance.ShowMessage("Ad is not available at the moment, please wait..");
        }

        Sound.instance.PlayButton();
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Displays one letter in the WordGrid as a hint.
    /// </summary>
    public void DisplayNextHint()
    {
        if (CurrentHints == 0)
        {
            if (rewardedButton.IsAvailableToShow())
            {
                rewardedButton.OnClick();
            }
            else if (!rewardedButton.IsActionAvailable())
            {
                int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime("rewarded_video"));
                Toast.instance.ShowMessage("Ad is not available now. Please wait " + remainTime + " seconds");
            }
            else
            {
                Toast.instance.ShowMessage("Ad is not available now. Please wait");
            }
        }
        else if (ActiveBoardState != null && CurrentHints > 0)
        {
            // Call DisplayNextHint in wordGrid, giving it the last hint index that was displayed. DisplayNextHint will return the word and letter that was displayed
            int  hintWordIndex;
            int  hintLetterIndex;
            bool hintDisplayed = wordGrid.DisplayNextHint(ref ActiveBoardState.nextHintIndex, out hintWordIndex, out hintLetterIndex);

            // Check if a hint was actually displayed
            if (hintDisplayed)
            {
                // Decrement the amount of hints
                CurrentHints--;

                // Update the board state so we know what letters where shown because of hints (so if the board is loaded from save we can lpace the hint words)
                ActiveBoardState.hintLettersShown.Add(new int[] { hintWordIndex, hintLetterIndex });

                // Save the game
                Save();
            }
        }
    }
    public void OnClick()
    {
        adsbtn = true;
        if (IsAvailableToShow())
        {
            AdmobController.instance.ShowRewardBasedVideo();
        }
        else if (!IsActionAvailable())
        {
            int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
            Toast.instance.ShowMessage("Please wait " + remainTime + " seconds for the next ad");
        }
        else
        {
            Toast.instance.ShowMessage("Ad is not available now, please wait..");
        }
#if UNITY_ANDROID && !UNITY_EDITOR
        SoundManager.instance.PlaybtnSfx();
#else
        Sound.instance.PlayButton();
#endif
    }
Ejemplo n.º 9
0
    public void OnShareGameClick()
    {
        float remain = (float)(SHARE_PERIOD - CUtils.GetActionDeltaTime("share_facebook"));

        if (remain > 0 && remain < SHARE_PERIOD)
        {
            string message;
            if (remain > 3600)
            {
                float value = Mathf.Round(remain / 3600);
                message = value == 1 ? "an hour" : value + " hours";
            }
            else if (remain > 60)
            {
                float value = Mathf.Round(remain / 60);
                message = value == 1 ? "a minute" : value + " minutes";
            }
            else
            {
                float value = Mathf.Round(remain);
                message = value == 1 ? "a second" : value + " seconds";
            }

            Toast.instance.ShowMessage("Please wait " + message + " for the next share");
            return;
        }

        if (FB.IsLoggedIn)
        {
            FacebookController.instance.ShareLink();
        }
        else
        {
            FacebookController.instance.LoginFacebook();
            pendingAction = "share";
        }
    }
Ejemplo n.º 10
0
    public void OnClick()
    {
#if ADMOB
#if UNITY_EDITOR
        HandleRewardBasedVideoRewarded(null, null);
#else
        if (IsAvailableToShow())
        {
            AdmobController.instance.ShowRewardBasedVideo();
        }
        else if (!IsActionAvailable())
        {
            int remainTime = (int)(GameConfig.instance.rewardedVideoPeriod - CUtils.GetActionDeltaTime(ACTION_NAME));
            Toast.instance.ShowMessage("Please wait " + remainTime + " seconds for the next ad");
        }
        else
        {
            Toast.instance.ShowMessage("Ad is not available now, please wait..");
        }
#endif
#else
        Debug.LogError("You need to install Admob plugin to use this feature");
#endif
    }