YotogiParameterViewer.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. this.label_dictionary_[YotogiParameterViewer.LabelType.Contract].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.contract));
  52. this.label_dictionary_[YotogiParameterViewer.LabelType.Name].text = status.lastName + "\n" + status.firstName;
  53. this.label_dictionary_[YotogiParameterViewer.LabelType.YotogiPlayCount].text = status.playCountYotogi.ToString();
  54. this.label_dictionary_[YotogiParameterViewer.LabelType.Seikeiken].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.seikeiken));
  55. this.label_dictionary_[YotogiParameterViewer.LabelType.Relation].GetComponent<Localize>().SetTerm(EnumConvert.GetTerm(status.relation));
  56. this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].GetComponent<Localize>().SetTerm(status.conditionTermText);
  57. UIWidget component = UTY.GetChildObject(this.label_dictionary_[YotogiParameterViewer.LabelType.ConditionText].transform.parent.gameObject, "Line", false).GetComponent<UIWidget>();
  58. }
  59. public void UpdateTextParam()
  60. {
  61. if (this.maid_ == null)
  62. {
  63. return;
  64. }
  65. Status status = this.maid_.status;
  66. this.label_dictionary_[YotogiParameterViewer.LabelType.Likability].text = status.likability.ToString();
  67. this.label_dictionary_[YotogiParameterViewer.LabelType.Hp].text = ((!this.CurrentValueDraw) ? status.maxHp.ToString() : status.currentHp.ToString());
  68. this.label_dictionary_[YotogiParameterViewer.LabelType.Mind].text = ((!this.CurrentValueDraw) ? status.maxMind.ToString() : status.currentMind.ToString());
  69. if (YotogiManager.instans != null && YotogiManager.instans.is_new_yotogi_mode)
  70. {
  71. this.label_dictionary_[YotogiParameterViewer.LabelType.Mind].text = status.maxMind.ToString();
  72. }
  73. this.label_dictionary_[YotogiParameterViewer.LabelType.Inyoku].text = status.inyoku.ToString();
  74. this.label_dictionary_[YotogiParameterViewer.LabelType.MValue].text = status.mvalue.ToString();
  75. this.label_dictionary_[YotogiParameterViewer.LabelType.Hentai].text = status.hentai.ToString();
  76. this.label_dictionary_[YotogiParameterViewer.LabelType.Housi].text = status.housi.ToString();
  77. this.label_dictionary_[YotogiParameterViewer.LabelType.StudyRate].text = (status.studyRate / 10).ToString();
  78. }
  79. public void SetCostumeButtonVisible(bool set_visible)
  80. {
  81. if (set_visible)
  82. {
  83. this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 770);
  84. this.costume_button_obj_.SetActive(true);
  85. }
  86. else
  87. {
  88. this.bg_sprite_.SetDimensions(this.bg_sprite_.width, 710);
  89. this.costume_button_obj_.SetActive(false);
  90. }
  91. }
  92. public void SetAttributeViewer(AttributeViewer obj)
  93. {
  94. this.attributeViewer = obj;
  95. this.attributeViewer.gameObject.SetActive(false);
  96. }
  97. public void OnHoverOver()
  98. {
  99. this.attributeViewer.gameObject.SetActive(true);
  100. }
  101. public void OnHoverOut()
  102. {
  103. this.attributeViewer.gameObject.SetActive(false);
  104. }
  105. public UIButton costume_button
  106. {
  107. get
  108. {
  109. return this.costume_button_obj_.GetComponent<UIButton>();
  110. }
  111. }
  112. public Dictionary<YotogiParameterViewer.LabelType, UILabel> label_dictionary
  113. {
  114. get
  115. {
  116. return this.label_dictionary_;
  117. }
  118. }
  119. public bool CostumeButtonVisible = true;
  120. public AttributeViewer attributeViewer;
  121. public bool CurrentValueDraw;
  122. private Dictionary<YotogiParameterViewer.LabelType, UILabel> label_dictionary_ = new Dictionary<YotogiParameterViewer.LabelType, UILabel>();
  123. private Maid maid_;
  124. private UISprite bg_sprite_;
  125. private GameObject costume_button_obj_;
  126. public enum LabelType
  127. {
  128. Contract,
  129. Name,
  130. YotogiClass,
  131. YotogiClassLv,
  132. YotogiClassCurExp,
  133. YotogiClassNextExp,
  134. YotogiPlayCount,
  135. Seikeiken,
  136. Relation,
  137. ConditionText,
  138. Likability,
  139. Hp,
  140. Mind,
  141. Inyoku,
  142. MValue,
  143. Hentai,
  144. Housi,
  145. StudyRate
  146. }
  147. }