ButtonsHandler.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. public void Update()
  16. {
  17. if(Adware.Instance.CurrnentIndex > 0)
  18. {
  19. VideoAd.transform.localScale = new Vector3(Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.height) * 0.125f, Screen.width * UIRoot.Instance.GetPixelSizeAdjustment(Screen.width) * 0.125f / 3, 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. }