YotogiParameterViewer.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using UnityEngine;
  5. public class YotogiParameterViewer : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. GameObject childObject = UTY.GetChildObject(base.gameObject, string.Empty, false);
  10. GameObject find_target = null;
  11. Func<string, UILabel> func = (string find_name) => UTY.GetChildObject(find_target, find_name, false).GetComponent<UILabel>();
  12. find_target = childObject;
  13. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Contract, func("ContractType/Name"));
  14. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Name, func("MaidName/Name"));
  15. find_target = UTY.GetChildObject(childObject, "YotogiClass", false);
  16. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClass, func("Name"));
  17. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassLv, func("Level/Value"));
  18. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassCurExp, func("Exp/Exp"));
  19. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiClassNextExp, func("Exp/RequiredExp"));
  20. find_target = UTY.GetChildObject(childObject, "NumberGroup", false);
  21. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Seikeiken, func("Seikeiken/Value"));
  22. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Relation, func("Grid1/Relation/Value"));
  23. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.ConditionText, func("Grid1/conditionText/Value"));
  24. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Likability, func("Grid1/Likability/Value"));
  25. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.StudyRate, func("Grid1/StudyRate/Value"));
  26. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Hp, func("Grid2/Hp/Value"));
  27. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Mind, func("Grid2/Mind/Value"));
  28. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Inyoku, func("Grid2/Inyoku/Value"));
  29. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.MValue, func("Grid2/MValue/Value"));
  30. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Hentai, func("Grid2/Hentai/Value"));
  31. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.Housi, func("Grid2/Housi/Value"));
  32. this.label_dictionary_.Add(YotogiParameterViewer.LabelType.YotogiPlayCount, func("YotogiPlayCount/Value"));
  33. this.bg_sprite_ = UTY.GetChildObject(base.gameObject, "BG", false).GetComponent<UISprite>();
  34. this.costume_button_obj_ = UTY.GetChildObject(base.gameObject, "ChangeCostume", false);
  35. this.SetCostumeButtonVisible(this.CostumeButtonVisible);
  36. }
  37. public void SetMaid(Maid maid)
  38. {
  39. this.maid_ = maid;
  40. }
  41. public void UpdateTextCommon()
  42. {
  43. if (this.maid_ == null)
  44. {
  45. return;
  46. }
  47. Status status = this.maid_.status;
  48. this.label_dictionary_[YotogiParameterViewer.LabelType.Contract].text = EnumConvert.GetString(status.contract);
  49. this.label_dictionary_[YotogiParameterViewer.LabelType.Name].text = status.lastName + "\n" + status.firstName;
  50. this.label_dictionary_[YotogiParameterViewer.LabelType.YotogiPlayCount].text = status.playCountYotogi.ToString();
  51. this.label_dictionary_[YotogiParameterViewer.LabelType.Seikeiken].text = EnumConvert.GetString(status.seikeiken);
  52. this.label_dictionary_[YotogiParameterViewer.LabelType.Relation].text = EnumConvert.GetString(status.relation);
  53. this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].text = status.conditionText;
  54. UIWidget component = UTY.GetChildObject(this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].transform.parent.gameObject, "Line", false).GetComponent<UIWidget>();
  55. int num = 175 - 20 * this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].text.Length;
  56. component.width = ((90 >= num) ? num : 90);
  57. }
  58. public void UpdateTextParam()
  59. {
  60. if (this.maid_ == null)
  61. {
  62. return;
  63. }
  64. Status status = this.maid_.status;
  65. this.label_dictionary_[YotogiParameterViewer.LabelType.Likability].text = status.likability.ToString();
  66. this.label_dictionary_[YotogiParameterViewer.LabelType.Hp].text = ((!this.CurrentValueDraw) ? status.maxHp.ToString() : status.currentHp.ToString());
  67. this.label_dictionary_[YotogiParameterViewer.LabelType.Mind].text = ((!this.CurrentValueDraw) ? status.maxMind.ToString() : status.currentMind.ToString());
  68. this.label_dictionary_[YotogiParameterViewer.LabelType.Inyoku].text = status.inyoku.ToString();
  69. this.label_dictionary_[YotogiParameterViewer.LabelType.MValue].text = status.mvalue.ToString();
  70. this.label_dictionary_[YotogiParameterViewer.LabelType.Hentai].text = status.hentai.ToString();
  71. this.label_dictionary_[YotogiParameterViewer.LabelType.Housi].text = status.housi.ToString();
  72. this.label_dictionary_[YotogiParameterViewer.LabelType.StudyRate].text = (status.studyRate / 10).ToString();
  73. }
  74. public void SetCostumeButtonVisible(bool set_visible)
  75. {
  76. if (set_visible)
  77. {
  78. this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 770);
  79. this.costume_button_obj_.SetActive(true);
  80. }
  81. else
  82. {
  83. this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 710);
  84. this.costume_button_obj_.SetActive(false);
  85. }
  86. }
  87. public void SetAttributeViewer(GameObject obj)
  88. {
  89. this.AttributeViewer = obj;
  90. this.AttributeViewer.SetActive(false);
  91. }
  92. public void OnHoverOver()
  93. {
  94. this.AttributeViewer.SetActive(true);
  95. }
  96. public void OnHoverOut()
  97. {
  98. this.AttributeViewer.SetActive(false);
  99. }
  100. public UIButton costume_button
  101. {
  102. get
  103. {
  104. return this.costume_button_obj_.GetComponent<UIButton>();
  105. }
  106. }
  107. public Dictionary<YotogiParameterViewer.LabelType, UILabel> label_dictionary
  108. {
  109. get
  110. {
  111. return this.label_dictionary_;
  112. }
  113. }
  114. public bool CostumeButtonVisible = true;
  115. public GameObject AttributeViewer;
  116. public bool CurrentValueDraw;
  117. private Dictionary<YotogiParameterViewer.LabelType, UILabel> label_dictionary_ = new Dictionary<YotogiParameterViewer.LabelType, UILabel>();
  118. private Maid maid_;
  119. private UISprite bg_sprite_;
  120. private GameObject costume_button_obj_;
  121. public enum LabelType
  122. {
  123. Contract,
  124. Name,
  125. YotogiClass,
  126. YotogiClassLv,
  127. YotogiClassCurExp,
  128. YotogiClassNextExp,
  129. YotogiPlayCount,
  130. Seikeiken,
  131. Relation,
  132. ConditionText,
  133. Likability,
  134. Hp,
  135. Mind,
  136. Inyoku,
  137. MValue,
  138. Hentai,
  139. Housi,
  140. StudyRate
  141. }
  142. }