void CheckFreeReward() { if ((Master.LevelData.lastLevel + 1) >= FreeRewardController.levelCanGetFreeReward) { freeReward.transform.Find("BG").GetComponent <UITexture> ().color = Color.white; freeReward.transform.Find("BG").GetComponent <BoxCollider2D> ().enabled = true; freeReward.SetActive(true); } else { freeReward.transform.Find("BG").GetComponent <UITexture> ().color = Color.gray; freeReward.SetActive(true); freeReward.transform.Find("BG").GetComponent <BoxCollider2D> ().enabled = false; // freeReward.SetActive (false); } if (FreeRewardController.IsCanGetFreeReward()) { freeRewardTitle.GetComponent <MoveObject> ().enabled = true; } else { freeRewardTitle.GetComponent <MoveObject> ().enabled = false; } }
public void GetFacebookShareRewardButton_OnClick() { if (isGotRewaredDialogShowed()) { return; } Master.PlaySoundButtonClick(); if (Master.instance.CheckInternetConnection()) { FacebookController.Instance.ShareLink("", "", "", "", () => { Master.Stats.Gem += currentShareFacebookReward [0]; Master.Stats.Star += currentShareFacebookReward [1]; Master.QuestData.IncreaseProgressValue("07"); FreeRewardController.SetDatTimeGetShareFacebookReward(); Master.PushNotification.SetShareFacebookRewardNotification(); Master.UIMenu.ShowDialog("GotRewardDialog", 0.3f, new string[] { currentShareFacebookReward [0].ToString(), currentShareFacebookReward [1].ToString() }, null, null, ShowDialogType.Center); SetShareFacebookReward(); // Close(); }, () => { GameObject alert = Master.UIMenu.ShowDialog("Error"); Master.GetChildByName(alert, "Content").GetComponent <UILabel> ().text = "Can not get the reward, please try again!"; }); } }
void SetShareFacebookReward() { if (!FreeRewardController.IsSharedFacebook()) { currentShareFacebookReward = FreeRewardController.GetReward(1); shareFacebookRewardGemLabel.text = currentShareFacebookReward[0].ToString(); shareFacebookRewardStarLabel.text = currentShareFacebookReward[1].ToString(); } }
void SetShareFacebookReward() { //if (!FreeRewardController.IsSharedFacebook()) //{ currentShareFacebookReward = FreeRewardController.GetReward(1); shareFacebook.gemLabel.text = currentShareFacebookReward [0].ToString(); shareFacebook.starLabel.text = currentShareFacebookReward [1].ToString(); // } }
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; } }
private void OnRewardBasedVideoRewarded() { freeReward.SetActive(false); freeRewardTitle.GetComponent <MoveObject>().enabled = false; int randomGem = UnityEngine.Random.Range(1, 3); int randomStar = UnityEngine.Random.Range(15, 25); Master.Stats.Gem += randomGem; Master.Stats.Star += randomStar; FreeRewardController.SetDateTimeGetReward(); Master.QuestData.IncreaseProgressValue("07"); // SetRandomReward(); Master.UIMenu.ShowDialog("GotRewardDialog", 0.3f, new string[] { randomGem.ToString(), randomStar.ToString() }); SetActionTime("rewarded_video"); GoogleAnalyticsV3.instance.LogEvent("Rewarded Video", "On Rewarded", "On Rewarded", 0); }
void CheckTime() { //for time get reward valuesRandomReward.SetActive(true); titleRandomReward.gameObject.SetActive(false); if (FreeRewardController.TimeRemainingFreeReward() <= 0) { getRandomRewardButton.gameObject.GetComponent <BoxCollider2D>().enabled = true; getRandomRewardButton.SetState(UIButtonColor.State.Normal, true); getRandomRewardStatusLabel.text = "Get"; } else { // valuesRandomReward.SetActive(false); //titleRandomReward.gameObject.SetActive(true); getRandomRewardButton.gameObject.GetComponent <BoxCollider2D>().enabled = false; getRandomRewardButton.SetState(UIButtonColor.State.Disabled, true); int secondRemaining = FreeRewardController.TimeRemainingFreeReward(); int minute = secondRemaining / 60; int second = secondRemaining % 60; getRandomRewardStatusLabel.text = ((minute < 10) ? "0" + minute.ToString() : minute.ToString()) + ":" + ((second < 10) ? "0" + second.ToString() : second.ToString()); } //for shared facebook if (FreeRewardController.IsSharedFacebook()) { valuesShareFacebookReward.SetActive(false); titleShareFacbookReward.gameObject.SetActive(true); shareFacebookButton.gameObject.GetComponent <BoxCollider2D>().enabled = false; shareFacebookButton.SetState(UIButtonColor.State.Disabled, true); } else { valuesShareFacebookReward.SetActive(true); titleShareFacbookReward.gameObject.SetActive(false); shareFacebookButton.gameObject.GetComponent <BoxCollider2D>().enabled = true; getRandomRewardButton.SetState(UIButtonColor.State.Normal, true); } }
public void SetShareFacebookRewardNotification() { if ((Master.LevelData.lastLevel + 1) < FreeRewardController.levelCanGetFreeReward) { return; } string content = "Hurry up! Let's share Facebook to get big rewards!"; int secondDelay = 0; if (FreeRewardController.TimeRemainingShareFacebook() > 0) { secondDelay = FreeRewardController.TimeRemainingShareFacebook(); } else { secondDelay = 10 * 60 * 60; } SetNotification(NotificationID.GetFreeRewardShareFacebook, secondDelay, title, content, "snd_getrewardnotification"); }
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"); }
public void showVideoCompleted(bool success) { if (isShowdialog) { return; } Debug.LogError("showVideoCompleted=" + success.ToString()); if (success) { Master.Stats.Gem += currentRandomReward [0]; Master.Stats.Star += currentRandomReward [1]; FreeRewardController.SetDateTimeGetRewardWatchVideo(); Master.QuestData.IncreaseProgressValue("07"); Master.PushNotification.SetWatchVideoRewardNotification(); isShowdialog = true; Invoke("showReward", 0.2f); } else { GameObject alert = Master.UIMenu.ShowDialog1("Error"); Master.GetChildByName(alert, "Content").GetComponent <UILabel> ().text = "Can not get the reward, please try again!"; } }
void SetRandomReward() { currentRandomReward = FreeRewardController.GetReward(0); randomRewardGemLabel.text = currentRandomReward[0].ToString(); randomRewardStarLabel.text = currentRandomReward[1].ToString(); }
void SetRandomReward() { currentRandomReward = FreeRewardController.GetReward(0); watchVideo.gemLabel.text = currentRandomReward [0].ToString(); watchVideo.starLabel.text = currentRandomReward [1].ToString(); }