YotogiParameterViewer.cs 6.1 KB

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