NoteBase.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using UnityEngine;
  3. public class NoteBase : UI_ScreenFitBase
  4. {
  5. protected override void Start()
  6. {
  7. if (Application.isPlaying && GameMain.Instance.VRMode)
  8. {
  9. this.m_CheckFirstOnly = true;
  10. }
  11. base.Start();
  12. }
  13. protected override void FitAction()
  14. {
  15. Vector3 zero = Vector3.zero;
  16. Vector2 zero2 = Vector2.zero;
  17. if (Application.isPlaying)
  18. {
  19. if (GameMain.Instance.VRMode)
  20. {
  21. zero2.x = (float)Note_Mgr.Instance.UIRootWidth / (float)Note_Mgr.Instance.CellX;
  22. zero2.y = (float)Note_Mgr.Instance.UIRootHeight / (float)Note_Mgr.Instance.CellY;
  23. zero = new Vector3((float)(this.m_MyDotX - (Note_Mgr.Instance.CellX + 1) / 2) * zero2.x, (float)(this.m_MyDotY - (Note_Mgr.Instance.CellY + 1) / 2) * -zero2.y);
  24. base.transform.localPosition = zero;
  25. }
  26. else
  27. {
  28. zero2.x = (float)Screen.width / (float)Note_Mgr.Instance.CellX;
  29. zero2.y = (float)Screen.height / (float)Note_Mgr.Instance.CellY;
  30. zero.x = zero2.x * (float)(this.m_MyDotX - 1) + zero2.x / 2f;
  31. zero.y = (float)Screen.height - (zero2.y * (float)(this.m_MyDotY - 1) + zero2.y / 2f);
  32. base.transform.localPosition = UI_ScreenFitBase.PointToScreenPos(zero);
  33. }
  34. }
  35. }
  36. protected int m_MyDotX;
  37. protected int m_MyDotY;
  38. }