MaidExaminationCtrl.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MaidStatus;
  5. using UnityEngine;
  6. using wf;
  7. public class MaidExaminationCtrl : BaseCreateViewerCtrl
  8. {
  9. public void Init(MaidExaminationMgr maidExaminationMgr, GameObject goPanel)
  10. {
  11. this.m_mgr = maidExaminationMgr;
  12. this.m_goPanel = goPanel;
  13. }
  14. private void InitViewer()
  15. {
  16. this.m_unitPrefabPath = "SceneCompetitiveShow/Prefab/AcquiredClassUnit";
  17. this.m_goUnitParent = UTY.GetChildObject(this.m_goPanel, "Viewer/AcquiredClassViewer/ListParent/Contents/UnitParent", false);
  18. this.m_goViewer = UTY.GetChildObject(this.m_goPanel, "Viewer", false);
  19. GameObject childObject = UTY.GetChildObject(this.m_goViewer, "ContractType", false);
  20. this.m_lContractType = UTY.GetChildObject(childObject, "Value", false).GetComponent<UILabel>();
  21. GameObject childObject2 = UTY.GetChildObject(this.m_goViewer, "Name", false);
  22. this.m_lLastName = UTY.GetChildObject(childObject2, "LastName", false).GetComponent<UILabel>();
  23. this.m_lFirstName = UTY.GetChildObject(childObject2, "FirstName", false).GetComponent<UILabel>();
  24. this.m_txtMaidIcon = UTY.GetChildObject(this.m_goViewer, "MaidIcon", false).GetComponent<UITexture>();
  25. GameObject childObject3 = UTY.GetChildObject(this.m_goViewer, "AcquiredClassViewer", false);
  26. this.m_lMessageBox = UTY.GetChildObject(childObject3, "MessageBox", false).GetComponent<UILabel>();
  27. this.m_goNext = UTY.GetChildObject(this.m_goViewer, "Next", false);
  28. UIButton component = this.m_goNext.GetComponent<UIButton>();
  29. EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_mgr.ClickNext));
  30. this.m_goOk = UTY.GetChildObject(this.m_goViewer, "Ok", false);
  31. UIButton component2 = this.m_goOk.GetComponent<UIButton>();
  32. EventDelegate.Add(component2.onClick, new EventDelegate.Callback(this.m_mgr.ClickOk));
  33. }
  34. public void CreateMaidExaminationViewer(List<MaidExaminationCtrl.MaidExamination> listData, int maidNo)
  35. {
  36. if (!this.m_init)
  37. {
  38. this.InitViewer();
  39. this.m_init = true;
  40. }
  41. this.bSomeoneGetClass = base.HasListData<MaidExaminationCtrl.MaidExamination>(listData);
  42. if (!this.bSomeoneGetClass)
  43. {
  44. this.m_goViewer.SetActive(false);
  45. if (CompetitiveShowMgr.is_effect_ones)
  46. {
  47. GameMain.Instance.SysDlg.Show("今回は新しいクラスを\n誰も貰えませんでした。", SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.m_mgr.CloseMaidExaminationPanel), null);
  48. }
  49. else
  50. {
  51. GameMain.Instance.SysDlg.Show("新しいクラスを貰えませんでした。", SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.m_mgr.CloseMaidExaminationPanel), null);
  52. }
  53. return;
  54. }
  55. this.m_goViewer.SetActive(true);
  56. bool flag = false;
  57. this.m_data = listData[maidNo];
  58. if (listData.Count - 1 > maidNo)
  59. {
  60. flag = true;
  61. }
  62. this.m_goNext.SetActive(flag);
  63. this.m_goOk.SetActive(!flag);
  64. base.CreateViewer<MaidExaminationCtrl.MaidExamination>(this.m_data);
  65. }
  66. protected override void SetDataForViewer()
  67. {
  68. this.m_lContractType.text = EnumConvert.GetString(this.m_data.contractType);
  69. this.m_lLastName.text = this.m_data.lastName;
  70. this.m_lFirstName.text = this.m_data.firstName;
  71. this.m_txtMaidIcon.mainTexture = this.m_data.maidIcon;
  72. List<string> list = new List<string>();
  73. if (this.m_data.arrayAcquiredMaidClassType != null)
  74. {
  75. foreach (int id in this.m_data.arrayAcquiredMaidClassType)
  76. {
  77. list.Add(JobClass.GetData(id).drawName);
  78. }
  79. }
  80. List<string> list2 = new List<string>();
  81. if (this.m_data.arrayAcquiredYotogiClassType != null)
  82. {
  83. foreach (int id2 in this.m_data.arrayAcquiredYotogiClassType)
  84. {
  85. list2.Add(YotogiClass.GetData(id2).drawName);
  86. }
  87. }
  88. string[] array = list.Concat(list2).ToArray<string>();
  89. if (array == null || array.Count<string>() == 0)
  90. {
  91. this.m_lMessageBox.text = "新しいクラスを貰えませんでした。";
  92. }
  93. else
  94. {
  95. this.m_lMessageBox.text = string.Empty;
  96. foreach (string text in array)
  97. {
  98. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goUnitPrefab);
  99. UILabel component = gameObject.GetComponent<UILabel>();
  100. string arg = text;
  101. component.fontSize = 21;
  102. component.overflowMethod = UILabel.Overflow.ShrinkContent;
  103. component.text = string.Format("{0}を入手", arg);
  104. gameObject.name = string.Format("Msg_Acquired_{0}", arg);
  105. base.SetTransformInfo(gameObject);
  106. }
  107. Utility.ResetNGUI(this.m_goUnitParent.GetComponent<UIGrid>());
  108. Utility.ResetNGUI(this.m_goUnitParent.transform.parent.parent.GetComponentInChildren<UIScrollView>());
  109. }
  110. this.SetScrollBarLineActive(array);
  111. }
  112. private void SetScrollBarLineActive(string[] merge)
  113. {
  114. if (merge != null)
  115. {
  116. bool flag = 4 < merge.Count<string>();
  117. }
  118. }
  119. public void DispSystemDialog()
  120. {
  121. this.m_goViewer.SetActive(false);
  122. if (CompetitiveShowMgr.is_effect_ones)
  123. {
  124. GameMain.Instance.SysDlg.Show("今回新しくクラスを\n獲得したメイドは以上です。", SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.m_mgr.CloseMaidExaminationPanel), null);
  125. }
  126. else
  127. {
  128. this.m_mgr.CloseMaidExaminationPanel();
  129. }
  130. }
  131. private MaidExaminationMgr m_mgr;
  132. private MaidExaminationCtrl.MaidExamination m_data;
  133. private GameObject m_goPanel;
  134. private GameObject m_goViewer;
  135. private GameObject m_goNext;
  136. private GameObject m_goOk;
  137. private UITexture m_txtMaidIcon;
  138. private UILabel m_lContractType;
  139. private UILabel m_lLastName;
  140. private UILabel m_lFirstName;
  141. private UILabel m_lMessageBox;
  142. private bool bSomeoneGetClass;
  143. private bool m_init;
  144. private const string UNIT_PARENT_PATH = "Viewer/AcquiredClassViewer/ListParent/Contents/UnitParent";
  145. private const string UNIT_PREFAB_PATH = "SceneCompetitiveShow/Prefab/AcquiredClassUnit";
  146. private const string SYSTEM_UI_ROOT_PATH = "__GameMain__/SystemUI Root";
  147. private const string TEMPLATE_MSG_ACQUIRED_CLASS = "{0}を入手";
  148. private const string TEMPLATE_NAME = "Msg_Acquired_{0}";
  149. private const string MSG_RESULT_GET_CLASS = "今回新しくクラスを\n獲得したメイドは以上です。";
  150. private const string MSG_DIDNOT_GET_CLASS = "新しいクラスを貰えませんでした。";
  151. private const string MSG_EVERYTHING_DIDNOT_GET_CLASS = "今回は新しいクラスを\n誰も貰えませんでした。";
  152. private const int COUNT_ACQUIRED_CLASS = 4;
  153. public class MaidExamination
  154. {
  155. public MaidExaminationCtrl.MaidExamination Copy()
  156. {
  157. return (MaidExaminationCtrl.MaidExamination)base.MemberwiseClone();
  158. }
  159. public int[] arrayAcquiredMaidClassType;
  160. public int[] arrayAcquiredYotogiClassType;
  161. public Contract contractType;
  162. public Texture2D maidIcon;
  163. public string firstName;
  164. public string lastName;
  165. }
  166. }