MaidPlate.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. if (this.engModeMoveText && GameUty.supportMultiLanguage)
  42. {
  43. Vector3 localPosition = this.left_plate_.contract_type_label.transform.localPosition;
  44. this.left_plate_.contract_type_label.transform.localPosition = new Vector3(80f, localPosition.y, localPosition.z);
  45. }
  46. this.right_plate_.main = UTY.GetChildObject(base.gameObject, "RightPlate", false);
  47. this.right_plate_.evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextEvaluation", false).GetComponent<UILabel>();
  48. this.right_plate_.total_evaluation_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalEvaluation", false).GetComponent<UILabel>();
  49. this.right_plate_.sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/TextSales", false).GetComponent<UILabel>();
  50. this.right_plate_.total_sales_label = UTY.GetChildObject(this.right_plate_.main, "RankingBGFrame/Frame0/TextTotalSales", false).GetComponent<UILabel>();
  51. this.SetMaidData(GameMain.Instance.CharacterMgr.GetMaid(0));
  52. this.SetRightPlateVisible(false);
  53. }
  54. public void SetRightPlateVisible(bool is_visible)
  55. {
  56. if (this.miniMode)
  57. {
  58. return;
  59. }
  60. BoxCollider component = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<BoxCollider>();
  61. UIWidget component2 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIWidget>();
  62. UIPlayAnimation component3 = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent<UIPlayAnimation>();
  63. Vector3 zero = Vector3.zero;
  64. Vector3 zero2 = Vector3.zero;
  65. Vector2 zero3 = Vector2.zero;
  66. Vector3 zero4 = Vector3.zero;
  67. zero2.y = 111f;
  68. zero3.y = 111f;
  69. if (!is_visible)
  70. {
  71. zero.x = -140f;
  72. zero2.x = 419f;
  73. zero3.x = 419f;
  74. component3.target = UTY.GetChildObject(base.gameObject, "LeftPlate", false).GetComponent<Animation>();
  75. UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(false);
  76. }
  77. else
  78. {
  79. zero2.x = 700f;
  80. zero3.x = 700f;
  81. zero4.x = 140f;
  82. component3.target = base.gameObject.GetComponent<Animation>();
  83. UTY.GetChildObject(base.gameObject, "RightPlate", false).SetActive(true);
  84. }
  85. component.center = zero;
  86. if (component.size != Vector3.zero)
  87. {
  88. component.size = zero2;
  89. }
  90. component2.width = (int)zero2.x;
  91. component2.height = (int)zero2.y;
  92. this.back_plate_.width = (int)zero3.x;
  93. this.back_plate_.height = (int)zero3.y;
  94. this.back_plate_.transform.localPosition = zero4;
  95. }
  96. public void SetSelectNoVisible(int no, bool is_visible)
  97. {
  98. this.left_plate_.select_no[no - 1].gameObject.SetActive(is_visible);
  99. }
  100. public void SetSelectNoVisibleAllOff()
  101. {
  102. foreach (UISprite uisprite in this.left_plate_.select_no)
  103. {
  104. uisprite.gameObject.SetActive(false);
  105. }
  106. }
  107. public void SetMaidData(Maid maid)
  108. {
  109. this.maid_ = maid;
  110. if (this.maid_ == null)
  111. {
  112. return;
  113. }
  114. Status status = this.maid_.status;
  115. for (int i = 0; i < this.left_plate_.crown_sprite.Length; i++)
  116. {
  117. this.left_plate_.crown_sprite[i].gameObject.SetActive(false);
  118. }
  119. if (1 <= status.popularRank && status.popularRank <= 3)
  120. {
  121. this.left_plate_.crown_sprite[status.popularRank - 1].gameObject.SetActive(true);
  122. }
  123. if (1 <= status.popularRank && status.popularRank <= 99)
  124. {
  125. this.left_plate_.rank_label.text = status.popularRank.ToString();
  126. }
  127. else
  128. {
  129. this.left_plate_.rank_label.text = "-";
  130. }
  131. if (status.OldStatus != null && (status.OldStatus.isMarriage || status.OldStatus.isNewWife))
  132. {
  133. this.left_plate_.engage_heart.enabled = true;
  134. }
  135. else
  136. {
  137. this.left_plate_.engage_heart.enabled = false;
  138. }
  139. this.left_plate_.leader_plate_sprite.gameObject.SetActive(status.leader);
  140. this.left_plate_.last_name_label.text = status.lastName;
  141. this.left_plate_.first_name_label.text = status.firstName;
  142. if (status.heroineType != HeroineType.Sub)
  143. {
  144. this.left_plate_.contract_type_label.text = EnumConvert.GetString(status.contract);
  145. Localize component = this.left_plate_.contract_type_label.GetComponent<Localize>();
  146. if (component != null)
  147. {
  148. component.SetTerm(EnumConvert.GetTerm(status.contract));
  149. }
  150. }
  151. else
  152. {
  153. this.left_plate_.contract_type_label.text = status.subCharaStatus.contractText;
  154. Localize component2 = this.left_plate_.contract_type_label.GetComponent<Localize>();
  155. if (component2 != null)
  156. {
  157. component2.SetTerm("MaidStatus/契約タイプ/" + status.subCharaStatus.contractText);
  158. }
  159. }
  160. this.right_plate_.evaluation_label.text = status.evaluation.ToString();
  161. this.right_plate_.total_evaluation_label.text = status.totalEvaluations.ToString();
  162. this.right_plate_.sales_label.text = Utility.ConvertMoneyText(status.sales);
  163. this.right_plate_.total_sales_label.text = Utility.ConvertMoneyText(status.totalSales);
  164. Texture2D thumIcon = this.maid_.GetThumIcon();
  165. if (thumIcon != null)
  166. {
  167. Sprite sprite2D = Sprite.Create(thumIcon, new Rect(0f, 0f, (float)thumIcon.width, (float)thumIcon.height), default(Vector2));
  168. this.left_plate_.thumbnail_sprite.sprite2D = sprite2D;
  169. if (this.miniMode)
  170. {
  171. this.left_plate_.thumbnail_sprite.SetDimensions(50, 50);
  172. }
  173. else
  174. {
  175. this.left_plate_.thumbnail_sprite.SetDimensions(thumIcon.width, thumIcon.height);
  176. }
  177. }
  178. else
  179. {
  180. this.left_plate_.thumbnail_sprite.sprite2D = null;
  181. }
  182. }
  183. public void SetEmpty()
  184. {
  185. this.maid_ = null;
  186. this.left_plate_.first_name_label.text = string.Empty;
  187. this.left_plate_.last_name_label.text = string.Empty;
  188. this.left_plate_.leader_plate_sprite.gameObject.SetActive(false);
  189. this.left_plate_.engage_heart.gameObject.SetActive(false);
  190. this.left_plate_.contract_type_label.text = string.Empty;
  191. this.left_plate_.thumbnail_sprite.sprite2D = null;
  192. }
  193. public Maid maid
  194. {
  195. get
  196. {
  197. return this.maid_;
  198. }
  199. }
  200. [SerializeField]
  201. private bool miniMode;
  202. [SerializeField]
  203. private bool engModeMoveText;
  204. private Maid maid_;
  205. private UISprite back_plate_;
  206. private MaidPlate.LeftPlate left_plate_;
  207. private MaidPlate.RightPlate right_plate_;
  208. private struct LeftPlate
  209. {
  210. public GameObject main;
  211. public UISprite[] crown_sprite;
  212. public UISprite[] select_no;
  213. public UILabel rank_label;
  214. public UI2DSprite thumbnail_sprite;
  215. public UISprite leader_plate_sprite;
  216. public UILabel engage_heart;
  217. public UILabel last_name_label;
  218. public UILabel first_name_label;
  219. public UILabel contract_type_label;
  220. }
  221. private struct RightPlate
  222. {
  223. public GameObject main;
  224. public UILabel evaluation_label;
  225. public UILabel total_evaluation_label;
  226. public UILabel sales_label;
  227. public UILabel total_sales_label;
  228. }
  229. }