MaidPlate.cs 9.6 KB

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