PrivateEventListUnit.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 OnClickButton()
  93. {
  94. if (!this.isEnabled || this.onClickEvent == null)
  95. {
  96. return;
  97. }
  98. this.onClickEvent();
  99. }
  100. public void OnHoverOver()
  101. {
  102. if (this.conditonParent == null || this.conditonPanel == null || this.infomation == null)
  103. {
  104. return;
  105. }
  106. this.conditonParent.gameObject.SetActive(true);
  107. this.conditonPanel.SetTexts(this.infomation.conditions.ToArray(), 500);
  108. if (!this.isEnabled)
  109. {
  110. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.Hover);
  111. }
  112. }
  113. public void OnHoverOut()
  114. {
  115. if (this.conditonParent == null || this.conditonPanel == null || this.infomation == null)
  116. {
  117. return;
  118. }
  119. this.conditonParent.gameObject.SetActive(false);
  120. }
  121. [SerializeField]
  122. private UI2DSprite iconSprite;
  123. [SerializeField]
  124. private UI2DSprite alreadyReadSprite;
  125. [SerializeField]
  126. private UILabel titleLabel;
  127. [SerializeField]
  128. private UIButton button;
  129. [SerializeField]
  130. private UIEventTrigger eventTrigger;
  131. public Action onClickEvent;
  132. private UIWFConditionList conditonPanel;
  133. private Transform conditonParent;
  134. private bool isViewMode_;
  135. }