PrivateEventListUnit.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using PrivateMaidMode;
  3. using UnityEngine;
  4. using wf;
  5. public class PrivateEventListUnit : MonoBehaviour
  6. {
  7. public DataBase.BG.Event.PointData.Information infomation { get; private set; }
  8. public bool isViewMode
  9. {
  10. get
  11. {
  12. return this.isViewMode_;
  13. }
  14. set
  15. {
  16. this.isViewMode_ = value;
  17. this.isEnabled = this.isEnabled;
  18. }
  19. }
  20. public bool isEnabled
  21. {
  22. get
  23. {
  24. return this.button.enabled;
  25. }
  26. set
  27. {
  28. Color color = (!value) ? this.button.disabledColor : this.button.defaultColor;
  29. UIWidget component = this.button.tweenTarget.GetComponent<UIWidget>();
  30. if (component != null)
  31. {
  32. component.color = color;
  33. }
  34. if (this.iconSprite != null)
  35. {
  36. this.iconSprite.color = color;
  37. }
  38. if (this.alreadyReadSprite != null)
  39. {
  40. this.alreadyReadSprite.color = color;
  41. }
  42. bool enabled = value;
  43. if (this.isViewMode_)
  44. {
  45. enabled = false;
  46. }
  47. this.button.enabled = enabled;
  48. UIPlayAnimation component2 = this.button.tweenTarget.GetComponent<UIPlayAnimation>();
  49. if (component2 != null)
  50. {
  51. component2.enabled = enabled;
  52. }
  53. }
  54. }
  55. public bool isAlreadyReaded
  56. {
  57. get
  58. {
  59. return this.alreadyReadSprite.alpha == 0f;
  60. }
  61. set
  62. {
  63. this.alreadyReadSprite.alpha = (float)((!value) ? 1 : 0);
  64. }
  65. }
  66. public void SetInformation(DataBase.BG.Event.PointData.Information infomation, Transform conditonParent, UIWFConditionList conditonPanel)
  67. {
  68. this.infomation = infomation;
  69. this.conditonParent = conditonParent;
  70. this.conditonPanel = conditonPanel;
  71. this.titleLabel.text = infomation.title;
  72. Utility.SetLocalizeTerm(this.titleLabel, infomation.titleTerm, false);
  73. string path = string.Empty;
  74. DataBase.BG.Event.PointData.Information.IconType iconType = infomation.iconType;
  75. if (iconType != DataBase.BG.Event.PointData.Information.IconType.H)
  76. {
  77. if (iconType != DataBase.BG.Event.PointData.Information.IconType.NTR)
  78. {
  79. path = "ScenePrivate/Textures/privatemaid_icon_normal";
  80. }
  81. else
  82. {
  83. path = "ScenePrivate/Textures/privatemaid_icon_ntr";
  84. }
  85. }
  86. else
  87. {
  88. path = "ScenePrivate/Textures/privatemaid_icon_h";
  89. }
  90. this.iconSprite.sprite2D = Resources.Load<Sprite>(path);
  91. }
  92. public void SetEmptyInformation(string title)
  93. {
  94. this.titleLabel.text = title;
  95. this.iconSprite.sprite2D = Resources.Load<Sprite>("ScenePrivate/Textures/privatemaid_icon_normal");
  96. }
  97. public void OnClickButton()
  98. {
  99. if (!this.isEnabled || this.onClickEvent == null)
  100. {
  101. return;
  102. }
  103. this.onClickEvent();
  104. }
  105. public void OnHoverOver()
  106. {
  107. if (this.conditonParent == null || this.conditonPanel == null || this.infomation == null)
  108. {
  109. return;
  110. }
  111. this.conditonParent.gameObject.SetActive(true);
  112. this.conditonPanel.SetTexts(this.infomation.conditions.ToArray(), 500);
  113. if (!this.isEnabled)
  114. {
  115. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Hover);
  116. }
  117. }
  118. public void OnHoverOut()
  119. {
  120. if (this.conditonParent == null || this.conditonPanel == null || this.infomation == null)
  121. {
  122. return;
  123. }
  124. this.conditonParent.gameObject.SetActive(false);
  125. }
  126. [SerializeField]
  127. private UI2DSprite iconSprite;
  128. [SerializeField]
  129. private UI2DSprite alreadyReadSprite;
  130. [SerializeField]
  131. private UILabel titleLabel;
  132. [SerializeField]
  133. private UIButton button;
  134. [SerializeField]
  135. private UIEventTrigger eventTrigger;
  136. public Action onClickEvent;
  137. private UIWFConditionList conditonPanel;
  138. private Transform conditonParent;
  139. private bool isViewMode_;
  140. }