CurvedUIInfo.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class CurvedUIInfo : MonoBehaviour
  5. {
  6. public Transform _centerPoint;
  7. public float _redio;
  8. public float _widthValue;
  9. public CurvedUIBaseController.ShowInfoType _showInfoType;
  10. public string _distanceText;
  11. public string _descriptsText;
  12. [HideInInspector]
  13. public bool opening;
  14. [HideInInspector]
  15. public CurvedUIBaseController uiBase;
  16. public void ReloadInfo()
  17. {
  18. Transform chackTool = this.transform.GetChild(0);
  19. _redio = chackTool.localScale.x / 2;
  20. _widthValue = chackTool.localScale.y * 2;
  21. UpdateUIInfo();
  22. }
  23. public void OpenUIInfo()
  24. {
  25. if (uiBase == null)
  26. {
  27. uiBase = CurvedUIPool.Instance.GetCUIBaseController();
  28. }
  29. uiBase.ReSetCurvedUIInfo(this);
  30. if (Application.isPlaying)
  31. {
  32. uiBase.OpenCurvedUI();
  33. }
  34. else
  35. {
  36. uiBase.InitCurvedOpenState(true);
  37. }
  38. opening = true;
  39. }
  40. public void UpdateUIInfo()
  41. {
  42. if (uiBase != null)
  43. {
  44. uiBase.ReSetCurvedUIInfo(this);
  45. }
  46. }
  47. public void CloseUIInfo()
  48. {
  49. if (uiBase != null)
  50. {
  51. if (Application.isPlaying)
  52. {
  53. uiBase.CloseCurvedUI(() =>
  54. {
  55. CurvedUIPool.Instance.PutCUIBaseController(uiBase);
  56. uiBase = null;
  57. });
  58. }
  59. else
  60. {
  61. uiBase.InitCurvedOpenState(false);
  62. CurvedUIPool.Instance.PutCUIBaseController(uiBase);
  63. uiBase = null;
  64. }
  65. }
  66. opening = false;
  67. }
  68. }