ButtonsHandler.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. //public Camera Camera;
  10. private void Start()
  11. {
  12. //Camera = transform.root.GetComponent<Camera>();
  13. CloseAdware.onClick.Add(new EventDelegate(OnCloseAd));
  14. }
  15. internal void Update()
  16. {
  17. //if (Adware.Instance.CurrnentIndex > 0)
  18. //{
  19. VideoAd.transform.localScale = new Vector3(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.height) *1.05f/2, Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width)*1.05f/2, 1);
  20. //}
  21. //else
  22. //{
  23. // VideoAd.transform.localScale = new Vector3(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 0.125f / 2, Screen.height * UIRoot.Instance.GetPixelSizeAdjustment(Screen.height) * 0.125f, 1);
  24. //}
  25. }
  26. private void OnCloseAd()
  27. {
  28. VideoTimer.Instance.Play = false;
  29. //Adware.Instance.onFinished();
  30. AdManager.Instance.Active = false;
  31. Adware.Instance.RequesNextAd();
  32. Adware.Instance.Close();
  33. PlayerPrefs.SetInt("AddLifeStep", 2);
  34. InGameScriptCS.Instance.LifeLost = false;
  35. PlayerPrefs.Save();
  36. SoundManagerCS.Instance.EndVideoAd();
  37. }
  38. }