DescResulteBase.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class DescResulteBase : MonoBehaviour
  5. {
  6. public virtual void Init(ResultWorkMgr resultWorkMgr, ResultWorkCtrl ctrl, GameObject goPanel)
  7. {
  8. this.m_resultWorkMgr = resultWorkMgr;
  9. this.m_resultWorkCtrl = ctrl;
  10. this.m_goPanel = goPanel;
  11. this.viewPanel = base.gameObject;
  12. this.m_goMaidStatus = UTY.GetChildObject(this.viewPanel, "MaidStatus", false);
  13. this.m_goMaidParameterParent = UTY.GetChildObject(this.m_goMaidStatus, "ParameterParent", false);
  14. this.m_spBGOfMaidParameterViewer = UTY.GetChildObject(this.m_goMaidStatus, "BG", false).GetComponent<UISprite>();
  15. this.m_heightOfMaidParameterTitle = UTY.GetChildObject(this.m_goMaidStatus, "Title", false).GetComponent<UISprite>().height;
  16. this.m_lStudyRate = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "StudyRate");
  17. this.m_lReception = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Reception");
  18. this.m_lCare = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Care");
  19. this.m_lLovely = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Lovely");
  20. this.m_lElegance = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Elegance");
  21. this.m_lCharm = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Charm");
  22. this.m_lTeachRate = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "TeachRate");
  23. this.m_lCooking = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Cooking");
  24. this.m_lVocal = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Vocal");
  25. this.m_lDance = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "Dance");
  26. this.m_lAppealPoint = new DescResulteBase.ParamSet(this.m_goMaidParameterParent, "AP");
  27. this.m_listMaidItem = new List<ScheduleCtrl.VariableItem>();
  28. this.m_listMaidItem.Add(this.m_lStudyRate.GetVariableItem());
  29. this.m_listMaidItem.Add(this.m_lReception.GetVariableItem());
  30. this.m_listMaidItem.Add(this.m_lCare.GetVariableItem());
  31. this.m_listMaidItem.Add(this.m_lLovely.GetVariableItem());
  32. this.m_listMaidItem.Add(this.m_lElegance.GetVariableItem());
  33. this.m_listMaidItem.Add(this.m_lCharm.GetVariableItem());
  34. this.m_listMaidItem.Add(this.m_lTeachRate.GetVariableItem());
  35. this.m_listMaidItem.Add(this.m_lCooking.GetVariableItem());
  36. this.m_listMaidItem.Add(this.m_lVocal.GetVariableItem());
  37. this.m_listMaidItem.Add(this.m_lDance.GetVariableItem());
  38. this.m_listMaidItem.Add(this.m_lAppealPoint.GetVariableItem());
  39. this.m_listAnimationTarget = new List<GameObject>();
  40. this.m_listAnimationTarget.Add(this.m_lStudyRate.ValueObj);
  41. this.m_listAnimationTarget.Add(this.m_lReception.ValueObj);
  42. this.m_listAnimationTarget.Add(this.m_lCare.ValueObj);
  43. this.m_listAnimationTarget.Add(this.m_lLovely.ValueObj);
  44. this.m_listAnimationTarget.Add(this.m_lElegance.ValueObj);
  45. this.m_listAnimationTarget.Add(this.m_lCharm.ValueObj);
  46. this.m_listAnimationTarget.Add(this.m_lTeachRate.ValueObj);
  47. this.m_listAnimationTarget.Add(this.m_lCooking.ValueObj);
  48. this.m_listAnimationTarget.Add(this.m_lVocal.ValueObj);
  49. this.m_listAnimationTarget.Add(this.m_lDance.ValueObj);
  50. this.m_listAnimationTarget.Add(this.m_lAppealPoint.ValueObj);
  51. }
  52. public virtual void UpdateView(string buttonName)
  53. {
  54. }
  55. protected virtual void UpdateAddValue(ResultWorkCtrl.UpperMaidStatus maidStatus)
  56. {
  57. this.m_lStudyRate.AddValueText = this.Sign(maidStatus.studyRate);
  58. this.m_lReception.AddValueText = this.Sign(maidStatus.reception);
  59. this.m_lCare.AddValueText = this.Sign(maidStatus.care);
  60. this.m_lLovely.AddValueText = this.Sign(maidStatus.lovely);
  61. this.m_lElegance.AddValueText = this.Sign(maidStatus.elegance);
  62. this.m_lCharm.AddValueText = this.Sign(maidStatus.charm);
  63. this.m_lTeachRate.AddValueText = this.Sign(maidStatus.teach);
  64. this.m_lCooking.AddValueText = this.Sign(maidStatus.cooking);
  65. this.m_lVocal.AddValueText = this.Sign(maidStatus.vocal);
  66. this.m_lDance.AddValueText = this.Sign(maidStatus.dance);
  67. this.m_lAppealPoint.AddValueText = this.Sign(maidStatus.appealPoint);
  68. }
  69. public void ActivePanel(bool active)
  70. {
  71. base.gameObject.SetActive(active);
  72. }
  73. public void SetResultWorkDic(Dictionary<string, ResultWorkCtrl.ResultWork> dicResultWork)
  74. {
  75. this.m_dicResultWork = dicResultWork;
  76. }
  77. protected ResultWorkCtrl.UpperMaidStatus GetMaidStatusBySlotNo(int slotNo)
  78. {
  79. ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.m_resultWorkCtrl.GetResultWorkBySlotNo(slotNo);
  80. if (resultWorkBySlotNo.upperMaidStatus != null)
  81. {
  82. return resultWorkBySlotNo.upperMaidStatus;
  83. }
  84. return null;
  85. }
  86. protected string Sign(int input)
  87. {
  88. if (input > 0)
  89. {
  90. return "+" + input.ToString();
  91. }
  92. return input.ToString();
  93. }
  94. protected string Sign(long input, string format)
  95. {
  96. if (input > 0L)
  97. {
  98. return "+" + input.ToString(format);
  99. }
  100. return input.ToString(format);
  101. }
  102. protected void TweenAnimation(bool play)
  103. {
  104. foreach (GameObject gameObject in this.m_listAnimationTarget)
  105. {
  106. if (!(gameObject == null))
  107. {
  108. GameObject gameObject2 = gameObject.transform.parent.gameObject;
  109. if (gameObject2.activeSelf)
  110. {
  111. TweenScale tweenScale = gameObject.GetComponent<TweenScale>();
  112. if (tweenScale)
  113. {
  114. UnityEngine.Object.Destroy(tweenScale);
  115. }
  116. tweenScale = gameObject.AddComponent<TweenScale>();
  117. TweenColor tweenColor = gameObject.GetComponent<TweenColor>();
  118. if (tweenColor)
  119. {
  120. UnityEngine.Object.Destroy(tweenColor);
  121. }
  122. tweenColor = gameObject.AddComponent<TweenColor>();
  123. if (play)
  124. {
  125. tweenScale.from = Vector2.one;
  126. tweenScale.to = Vector2.one * this.scaleSizeCommuBonus;
  127. tweenScale.duration = this.scaleDurationCommuBonus;
  128. EventDelegate.Set(tweenScale.onFinished, new EventDelegate.Callback(tweenScale.PlayReverse));
  129. tweenScale.PlayForward();
  130. tweenColor.from = Color.white;
  131. tweenColor.to = Color.yellow;
  132. tweenColor.duration = this.colorDurationCommuBonus;
  133. EventDelegate.Set(tweenColor.onFinished, new EventDelegate.Callback(tweenColor.PlayReverse));
  134. tweenColor.PlayForward();
  135. }
  136. else
  137. {
  138. tweenScale.ResetToBeginning();
  139. tweenColor.ResetToBeginning();
  140. }
  141. }
  142. }
  143. }
  144. }
  145. [SerializeField]
  146. protected float scaleSizeCommuBonus = 1.3f;
  147. [SerializeField]
  148. protected float scaleDurationCommuBonus = 0.5f;
  149. [SerializeField]
  150. protected float colorDurationCommuBonus = 0.5f;
  151. public bool m_playedAnimation;
  152. protected ResultWorkMgr m_resultWorkMgr;
  153. protected ResultWorkCtrl m_resultWorkCtrl;
  154. protected GameObject m_goPanel;
  155. protected GameObject viewPanel;
  156. protected GameObject m_goMaidStatus;
  157. protected GameObject m_goMaidParameterParent;
  158. protected UISprite m_spBGOfMaidParameterViewer;
  159. protected List<ScheduleCtrl.VariableItem> m_listMaidItem;
  160. protected List<GameObject> m_listAnimationTarget;
  161. protected int m_heightOfMaidParameterTitle;
  162. protected bool m_bInit;
  163. protected Dictionary<string, ResultWorkCtrl.ResultWork> m_dicResultWork;
  164. protected DescResulteBase.ParamSet m_lCare;
  165. protected DescResulteBase.ParamSet m_lReception;
  166. protected DescResulteBase.ParamSet m_lStudyRate;
  167. protected DescResulteBase.ParamSet m_lTeachRate;
  168. protected DescResulteBase.ParamSet m_lLovely;
  169. protected DescResulteBase.ParamSet m_lElegance;
  170. protected DescResulteBase.ParamSet m_lCharm;
  171. protected DescResulteBase.ParamSet m_lCooking;
  172. protected DescResulteBase.ParamSet m_lVocal;
  173. protected DescResulteBase.ParamSet m_lDance;
  174. protected DescResulteBase.ParamSet m_lAppealPoint;
  175. public class ParamSet
  176. {
  177. public ParamSet(GameObject parent, string childObjName)
  178. {
  179. this.baseObj = UTY.GetChildObject(parent, childObjName, true);
  180. if (this.baseObj == null)
  181. {
  182. return;
  183. }
  184. this.valueObj = UTY.GetChildObject(this.baseObj, "Value", true);
  185. if (this.valueObj != null)
  186. {
  187. this.addValue = this.valueObj.GetComponent<UILabel>();
  188. }
  189. }
  190. public GameObject ValueObj
  191. {
  192. get
  193. {
  194. return this.valueObj;
  195. }
  196. }
  197. public string AddValueText
  198. {
  199. set
  200. {
  201. if (this.addValue != null)
  202. {
  203. this.addValue.text = value;
  204. }
  205. }
  206. }
  207. public ScheduleCtrl.VariableItem GetVariableItem()
  208. {
  209. return new ScheduleCtrl.VariableItem(this.baseObj, this.addValue);
  210. }
  211. private GameObject baseObj;
  212. private GameObject valueObj;
  213. private UILabel addValue;
  214. }
  215. }