MaidPlate.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using UnityEngine;
  5. using wf;
  6. public class MaidPlate : MonoBehaviour
  7. {
  8. public void Awake()
  9. {
  10. this.back_plate_ = UTY.GetChildObject(base.gameObject, "Black", false).GetComponent<UISprite>();
  11. this.left_plate_.main = UTY.GetChildObject(base.gameObject, "LeftPlate", false);
  12. this.left_plate_.crown_sprite = new UISprite[3];
  13. for (int i = 0; i < 3; i++)
  14. {
  15. this.left_plate_.crown_sprite[i] = UTY.GetChildObject(this.left_plate_.main, "FrameRankingData/Rank" + (i + 1), false).GetComponent<UISprite>();
  16. this.left_plate_.crown_sprite[i].gameObject.SetActive(false);
  17. }
  18. List<UISprite> list = new List<UISprite>();
  19. int num = 0;
  20. for (;;)
  21. {
  22. GameObject childObject = UTY.GetChildObject(this.left_plate_.main, "FrameThumbnail/Select" + (num + 1), true);
  23. if (childObject == null)
  24. {
  25. break;
  26. }
  27. UISprite component = childObject.GetComponent<UISprite>();
  28. component.gameObject.SetActive(false);
  29. list.Add(component);
  30. num++;
  31. }
  32. this.left_plate_.select_no = list.ToArray();
  33. this.left_plate_.rank_label = UTY.GetChildObject(this.left_plate_.main, "FrameRankingData/RankLabel", false).GetComponent<UILabel>();
  34. this.left_plate_.thumbnail_sprite = UTY.GetChildObject(this.left_plate_.main, "FrameThumbnail/Thum", false).GetComponent<UI2DSprite>();
  35. this.left_plate_.engage_heart = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/Engage", false).GetComponent<UILabel>();
  36. this.left_plate_.leader_plate_sprite = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/LeaderPlate", false).GetComponent<UISprite>();
  37. this.left_plate_.last_name_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextLastName", false).GetComponent<UILabel>();
  38. this.left_plate_.first_name_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextFirstName", false).GetComponent<UILabel>();
  39. this.left_plate_.contract_type_label = UTY.GetChildObject(this.left_plate_.main, "FrameBaseData/TextTypeName", false).GetComponent<UILabel>();
  40. this.right_plate_.main = UTY.GetChildObject(base.gameObject, "RightPlate", false);
  41. this.right_plate_.evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextEvaluation", false).GetComponent<UILabel>();
  42. this.right_plate_.total_evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalEvaluation", false).GetComponent<UILabel>();
  43. this.right_plate_.sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextSales", false).GetComponent<UILabel>();
  44. this.right_plate_.total_sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalSales", false).GetComponent<UILabel>();
  45. this.SetMaidData(GameMain.Instance.CharacterMgr.GetMaid(0));
  46. this.SetRightPlateVisible(false);
  47. }
  48. public void SetRightPlateVisible(bool is_visible)
  49. {
  50. if (this.miniMode)
  51. {
  52. return;
  53. }
  54. BoxCollider component = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<BoxCollider>();
  55. UIWidget component2 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIWidget>();
  56. UIPlayAnimation component3 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIPlayAnimation>();
  57. Vector3 zero = Vector3.zero;
  58. Vector3 zero2 = Vector3.zero;
  59. Vector2 zero3 = Vector2.zero;
  60. Vector3 zero4 = Vector3.zero;
  61. zero2.y = 111f;
  62. zero3.y = 111f;
  63. if (!is_visible)
  64. {
  65. zero.x = -140f;
  66. zero2.x = 419f;
  67. zero3.x = 419f;
  68. component3.target = UTY.GetChildObject(base.gameObject, "LeftPlate", false).GetComponent<Animation>();
  69. UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(false);
  70. }
  71. else
  72. {
  73. zero2.x = 700f;
  74. zero3.x = 700f;
  75. zero4.x = 140f;
  76. component3.target = base.gameObject.GetComponent<Animation>();
  77. UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(true);
  78. }
  79. component.center = zero;
  80. if (component.size != Vector3.zero)
  81. {
  82. component.size = zero2;
  83. }
  84. component2.width = (int)zero2.x;
  85. component2.height = (int)zero2.y;
  86. this.back_plate_.width = (int)zero3.x;
  87. this.back_plate_.height = (int)zero3.y;
  88. this.back_plate_.transform.localPosition = zero4;
  89. }
  90. public void SetSelectNoVisible(int no, bool is_visible)
  91. {
  92. this.left_plate_.select_no[no - 1].gameObject.SetActive(is_visible);
  93. }
  94. public void SetSelectNoVisibleAllOff()
  95. {
  96. foreach (UISprite uisprite in this.left_plate_.select_no)
  97. {
  98. uisprite.gameObject.SetActive(false);
  99. }
  100. }
  101. public void SetMaidData(Maid maid)
  102. {
  103. this.maid_ = maid;
  104. if (this.maid_ == null)
  105. {
  106. return;
  107. }
  108. Status status = this.maid_.status;
  109. for (int i = 0; i < this.left_plate_.crown_sprite.Length; i++)
  110. {
  111. this.left_plate_.crown_sprite[i].gameObject.SetActive(false);
  112. }
  113. if (1 <= status.popularRank && status.popularRank <= 3)
  114. {
  115. this.left_plate_.crown_sprite[status.popularRank - 1].gameObject.SetActive(true);
  116. }
  117. if (1 <= status.popularRank && status.popularRank <= 99)
  118. {
  119. this.left_plate_.rank_label.text = status.popularRank.ToString();
  120. }
  121. else
  122. {
  123. this.left_plate_.rank_label.text = "-";
  124. }
  125. if (status.OldStatus != null && (status.OldStatus.isMarriage || status.OldStatus.isNewWife))
  126. {
  127. this.left_plate_.engage_heart.enabled = true;
  128. }
  129. else
  130. {
  131. this.left_plate_.engage_heart.enabled = false;
  132. }
  133. this.left_plate_.leader_plate_sprite.gameObject.SetActive(status.leader);
  134. this.left_plate_.last_name_label.text = status.lastName;
  135. this.left_plate_.first_name_label.text = status.firstName;
  136. if (status.heroineType != HeroineType.Sub)
  137. {
  138. this.left_plate_.contract_type_label.text = EnumConvert.GetString(status.contract);
  139. }
  140. else
  141. {
  142. this.left_plate_.contract_type_label.text = status.subCharaStatus.contractText;
  143. }
  144. this.right_plate_.evaluation_label.text = status.evaluation.ToString();
  145. this.right_plate_.total_evaluation_label.text = status.totalEvaluations.ToString();
  146. this.right_plate_.sales_label.text = Utility.ConvertMoneyText(status.sales);
  147. this.right_plate_.total_sales_label.text = Utility.ConvertMoneyText(status.totalSales);
  148. Texture2D thumIcon = this.maid_.GetThumIcon();
  149. if (thumIcon != null)
  150. {
  151. Sprite sprite2D = Sprite.Create(thumIcon, new Rect(0f, 0f, (float)thumIcon.width, (float)thumIcon.height), default(Vector2));
  152. this.left_plate_.thumbnail_sprite.sprite2D = sprite2D;
  153. if (this.miniMode)
  154. {
  155. this.left_plate_.thumbnail_sprite.SetDimensions(50, 50);
  156. }
  157. else
  158. {
  159. this.left_plate_.thumbnail_sprite.SetDimensions(thumIcon.width, thumIcon.height);
  160. }
  161. }
  162. else
  163. {
  164. this.left_plate_.thumbnail_sprite.sprite2D = null;
  165. }
  166. }
  167. public Maid maid
  168. {
  169. get
  170. {
  171. return this.maid_;
  172. }
  173. }
  174. [SerializeField]
  175. private bool miniMode;
  176. private Maid maid_;
  177. private UISprite back_plate_;
  178. private MaidPlate.LeftPlate left_plate_;
  179. private MaidPlate.RightPlate right_plate_;
  180. private struct LeftPlate
  181. {
  182. public GameObject main;
  183. public UISprite[] crown_sprite;
  184. public UISprite[] select_no;
  185. public UILabel rank_label;
  186. public UI2DSprite thumbnail_sprite;
  187. public UISprite leader_plate_sprite;
  188. public UILabel engage_heart;
  189. public UILabel last_name_label;
  190. public UILabel first_name_label;
  191. public UILabel contract_type_label;
  192. }
  193. private struct RightPlate
  194. {
  195. public GameObject main;
  196. public UILabel evaluation_label;
  197. public UILabel total_evaluation_label;
  198. public UILabel sales_label;
  199. public UILabel total_sales_label;
  200. }
  201. }