GameOverVideoAdsLife.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class GameOverVideoAdsLife : MonoBehaviour {
  6. public UIButton ButtonClose;
  7. public UIButton ButtonNo;
  8. public ScreenBase Screen;
  9. void Start () {
  10. ButtonClose.onClick.Add(new EventDelegate(ClosePanel));
  11. ButtonNo.onClick.Add(new EventDelegate(ClosePanel));
  12. }
  13. private void ClosePanel()
  14. {
  15. Screen.Hide();
  16. Close();
  17. InGameScriptCS.Instance.UpdateScore();
  18. }
  19. // Update is called once per frame
  20. public void Close () {
  21. NGUIMenuScript.Instance.CurStatePopup = NGUIMenuScript.StatesMenuForPopup.GameOver;
  22. NGUIMenuScript.Instance.ShowMenu(NGUIMenuScript.NGUIMenus.GameOver);
  23. NGUIMenuScript.Instance.toggleHUDGroupState(false, false);
  24. }
  25. public void ShowAd()
  26. {
  27. var counter = PlayerPrefs.GetInt("AdCounter");
  28. if (counter < GameConstants.MAX_ADD_LIFE)
  29. {
  30. counter++;
  31. PlayerPrefs.SetInt("AdCounter", counter);
  32. PlayerPrefs.Save();
  33. if (!AdManager.Instance.Active)
  34. {
  35. Debug.Log("Active");
  36. AdManager.Instance.PlayVideoAd();
  37. }
  38. }
  39. Debug.Log("ShowAd");
  40. }
  41. }