UIComponent.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using Fort23.Core;
  3. using Fort23.UTool;
  4. using UnityEngine;
  5. namespace Fort23.Mono
  6. {
  7. public class UIComponent : UIBase, IGObjectPoolInterface
  8. {
  9. private bool _isActivePool;
  10. public virtual async void Show()
  11. {
  12. await base.Show();
  13. }
  14. public virtual void Close()
  15. {
  16. }
  17. public string poolObjName { get; set; }
  18. public bool isUse { get; set; }
  19. public bool isDestroy { get; }
  20. public AssetHandle AssetHandle { get; set; }
  21. public TimerEntity DestroyTimer { get; set; }
  22. public GameObject own
  23. {
  24. get { return _own; }
  25. }
  26. private GameObject _own;
  27. public virtual void ResetData()
  28. {
  29. }
  30. /// <summary>
  31. /// 池子激活的时候
  32. /// </summary>
  33. public virtual void ActiveObj()
  34. {
  35. _isActivePool = true;
  36. own.SetActive(true);
  37. }
  38. /// <summary>
  39. /// 对方放回池子的时候
  40. /// </summary>
  41. public virtual void DormancyObj()
  42. {
  43. own.SetActive(false);
  44. if (!_isActivePool)
  45. {
  46. return;
  47. }
  48. DelEvent();
  49. }
  50. public void SetPosition(Vector3 pos)
  51. {
  52. #if !COMBAT_SERVER
  53. _own.transform.position = pos;
  54. #endif
  55. }
  56. public void SetScale(Vector3 scale)
  57. {
  58. #if !COMBAT_SERVER
  59. _own.transform.localScale = scale;
  60. #endif
  61. }
  62. public void SetRotation(Vector3 rotation)
  63. {
  64. #if !COMBAT_SERVER
  65. _own.transform.eulerAngles = rotation;
  66. #endif
  67. }
  68. public Vector3 GetPosition()
  69. {
  70. throw new System.NotImplementedException();
  71. }
  72. public Vector3 GetScale()
  73. {
  74. throw new System.NotImplementedException();
  75. }
  76. public Vector3 GettRotation()
  77. {
  78. throw new System.NotImplementedException();
  79. }
  80. public void SetActive(bool isActive)
  81. {
  82. #if !COMBAT_SERVER
  83. _own.SetActive(isActive);
  84. #endif
  85. }
  86. public async CTask DelayHide()
  87. {
  88. }
  89. /// <summary>
  90. /// 对象被销毁的时候
  91. /// </summary>
  92. public virtual void DestroyObj()
  93. {
  94. if (!_isActivePool)
  95. {
  96. return;
  97. }
  98. DelEvent();
  99. }
  100. public virtual void Preset()
  101. {
  102. }
  103. public virtual void AddEvent()
  104. {
  105. }
  106. public virtual void DelEvent()
  107. {
  108. }
  109. public void SetGameObject(GameObject gameObject)
  110. {
  111. _own = gameObject;
  112. }
  113. }
  114. }