MaidPlate.cs 7.5 KB

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