ButtonsHandler.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. public class ButtonsHandler : MonoBehaviour
  3. {
  4. public UIButton CloseAdware;
  5. public GameObject Header;
  6. public UITexture Placeholder;
  7. public MeshRenderer VideoAd;
  8. public GameObject RootObject;
  9. private PlayerSidesColliderScriptCS hPlayerSidesColliderScriptCS;
  10. private PlayerFrontColliderScriptCS hPlayerFrontColliderScriptCS;
  11. //public Camera Camera;
  12. private void Start()
  13. {
  14. //Camera = transform.root.GetComponent<Camera>();
  15. CloseAdware.onClick.Add(new EventDelegate(OnCloseAd));
  16. CloseAdware.transform.localPosition = new Vector3(CloseAdware.transform.localPosition.x, CloseAdware.transform.localPosition.y, 0);
  17. hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
  18. hPlayerFrontColliderScriptCS = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
  19. }
  20. internal void Update()
  21. {
  22. VideoAd.transform.localScale = new Vector3(Placeholder.width,Placeholder.height,1);
  23. }
  24. private void OnCloseAd()
  25. {
  26. //PlayerPrefs.SetInt("AddLifeStep", 2);
  27. Adware.Instance.Close();
  28. InGameScriptCS.Instance.Resurected = false;
  29. ControllerScriptCS.Instance.RealDeath = true;
  30. NGUIMenuScript.Instance.toggleHUDGroupState(true, false);
  31. UIEnergy.Instance.Restore();
  32. NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.RaceEnd);
  33. PlayerController.Instance.Alive();
  34. InGameScriptCS.Instance.InvokeResurrection();
  35. hPlayerSidesColliderScriptCS.InvokeResurrection();
  36. hPlayerFrontColliderScriptCS.InvokeResurrection();
  37. NGUIMenuScript.Instance.startResumeGameCounter(true);
  38. Text_PauseCounter.Show();
  39. }
  40. }