Example #1
0
    void CheckTime()
    {
        //for time get watch video reward
        watchVideo.root.SetActive(true);
        if (FreeRewardController.TimeRemainingWatchVideo() <= 0)
        {
            watchVideo.actionButton.gameObject.GetComponent <BoxCollider2D> ().enabled = true;
            watchVideo.actionButton.SetState(UIButtonColor.State.Normal, true);
            watchVideo.actionButtonLabel.text = "Watch";
        }
        else
        {
            watchVideo.actionButton.gameObject.GetComponent <BoxCollider2D> ().enabled = false;
            watchVideo.actionButton.SetState(UIButtonColor.State.Disabled, true);

            int      secondRemaining = FreeRewardController.TimeRemainingWatchVideo();
            TimeSpan t = TimeSpan.FromSeconds(secondRemaining);

            string timeString = string.Format("{1:D2}:{2:D2}",
                                              t.Hours,
                                              t.Minutes,
                                              t.Seconds);
            watchVideo.actionButtonLabel.text = timeString;
        }

        //for time get sharefacebook reward
        shareFacebook.root.SetActive(true);
        if (FreeRewardController.TimeRemainingShareFacebook() <= 0)
        {
            shareFacebook.actionButton.gameObject.GetComponent <BoxCollider2D> ().enabled = true;
            shareFacebook.actionButton.SetState(UIButtonColor.State.Normal, true);
            shareFacebook.actionButtonLabel.text = "Share";
        }
        else
        {
            shareFacebook.actionButton.gameObject.GetComponent <BoxCollider2D> ().enabled = false;
            shareFacebook.actionButton.SetState(UIButtonColor.State.Disabled, true);

            int      secondRemaining = FreeRewardController.TimeRemainingShareFacebook();
            TimeSpan t = TimeSpan.FromSeconds(secondRemaining);

            string timeString = string.Format("{0:D2}:{1:D2}:{2:D2}",
                                              t.Hours,
                                              t.Minutes,
                                              t.Seconds);

            //int hour = secondRemaining / 3600;
            //int minute = secondRemaining / 60;
            //int second = secondRemaining % 60;
            shareFacebook.actionButtonLabel.text = timeString;
        }
    }
Example #2
0
    public void SetWatchVideoRewardNotification()
    {
        if ((Master.LevelData.lastLevel + 1) < FreeRewardController.levelCanGetFreeReward)
        {
            return;
        }

        string content = "Hurry up! Your free rewards are ready. Let get its now!";

        int secondDelay = 0;

        if (FreeRewardController.TimeRemainingWatchVideo() > 0)
        {
            secondDelay = FreeRewardController.TimeRemainingWatchVideo();
        }
        else
        {
            secondDelay = 5 * 60 * 60;
        }

        SetNotification(NotificationID.GetFreeRewardWatchVideo, secondDelay, title, content, "snd_getrewardnotification");
    }