YotogiParameterViewer.cs 6.8 KB

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