MaidExaminationMgr.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using MaidStatus.CsvData;
  5. using PlayerStatus;
  6. using UnityEngine;
  7. public class MaidExaminationMgr : BaseCreatePanel
  8. {
  9. public override void Init()
  10. {
  11. this.m_goPanel = base.GetPanel("MaidExaminationPanel");
  12. this.m_ctrl = base.GetCtrl<MaidExaminationCtrl>();
  13. this.m_ctrl.Init(this, this.m_goPanel);
  14. this.m_api = new CompetitiveShowAPI();
  15. this.m_goPanel.SetActive(false);
  16. }
  17. public void OpenMaidExaminationPanel(Maid visible_maid, List<Maid> check_maid_list, CompetitiveShowAPI.dgOnSceneStartCallBack call_back = null)
  18. {
  19. if (call_back == null)
  20. {
  21. call_back = new CompetitiveShowAPI.dgOnSceneStartCallBack(this.OpenMaidExaminationCallBack);
  22. }
  23. this.m_check_maid_list.Clear();
  24. if (check_maid_list != null)
  25. {
  26. for (int i = 0; i < check_maid_list.Count; i++)
  27. {
  28. this.m_check_maid_list.Add(check_maid_list[i]);
  29. }
  30. }
  31. this.m_api.SceneStart(this, visible_maid, call_back);
  32. }
  33. protected void OpenMaidExaminationCallBack()
  34. {
  35. }
  36. protected override void OpenPanel()
  37. {
  38. this.m_currentMaidNo = 0;
  39. this.m_listData = this.LoadData();
  40. this.m_ctrl.CreateMaidExaminationViewer(this.m_listData, this.m_currentMaidNo);
  41. }
  42. private List<MaidExaminationCtrl.MaidExamination> LoadData()
  43. {
  44. List<MaidExaminationCtrl.MaidExamination> list = new List<MaidExaminationCtrl.MaidExamination>();
  45. CompetitiveShowMgr component = UTY.GetChildObject(GameObject.Find("UI Root"), "Manager/CompetitiveShowMgr", false).GetComponent<CompetitiveShowMgr>();
  46. bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay;
  47. for (int i = 0; i < this.m_check_maid_list.Count; i++)
  48. {
  49. Maid maid = this.m_check_maid_list[i];
  50. if (maid == null)
  51. {
  52. Debug.LogWarning(string.Format("GameMain.Instance.CharacterMgr.GetMaid({0})でmaidがNULLでした。", i));
  53. }
  54. else
  55. {
  56. MaidExaminationCtrl.MaidExamination maidExamination = new MaidExaminationCtrl.MaidExamination();
  57. maidExamination.maidIcon = maid.GetThumCard();
  58. PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status;
  59. AbstractClassData.ClassType classType = AbstractClassData.ClassType.Share;
  60. classType |= ((!CompetitiveShowMgr.compatibilityMode) ? AbstractClassData.ClassType.New : AbstractClassData.ClassType.Old);
  61. List<JobClass.Data> learnPossibleClassDatas = maid.status.jobClass.GetLearnPossibleClassDatas(false, classType);
  62. List<int> list2 = new List<int>();
  63. foreach (JobClass.Data data in learnPossibleClassDatas)
  64. {
  65. bool flag = !maid.status.jobClass.Contains(data.id);
  66. maid.status.jobClass.Add(data, true, true);
  67. if (flag)
  68. {
  69. list2.Add(data.id);
  70. }
  71. }
  72. maidExamination.arrayAcquiredMaidClassType = list2.ToArray();
  73. List<YotogiClass.Data> learnPossibleClassDatas2 = maid.status.yotogiClass.GetLearnPossibleClassDatas(false, classType);
  74. if (lockNTRPlay)
  75. {
  76. List<YotogiClass.Data> list3 = new List<YotogiClass.Data>();
  77. foreach (YotogiClass.Data data2 in learnPossibleClassDatas2)
  78. {
  79. if (YotogiClass.IsNTRClass(data2.id, CompetitiveShowMgr.compatibilityMode))
  80. {
  81. list3.Add(data2);
  82. }
  83. }
  84. foreach (YotogiClass.Data item in list3)
  85. {
  86. learnPossibleClassDatas2.Remove(item);
  87. }
  88. }
  89. list2.Clear();
  90. foreach (YotogiClass.Data data3 in learnPossibleClassDatas2)
  91. {
  92. bool flag2 = !maid.status.yotogiClass.Contains(data3.id);
  93. maid.status.yotogiClass.Add(data3, true, true);
  94. if (flag2)
  95. {
  96. list2.Add(data3.id);
  97. }
  98. }
  99. maidExamination.arrayAcquiredYotogiClassType = list2.ToArray();
  100. maidExamination.firstName = maid.status.firstName;
  101. maidExamination.lastName = maid.status.lastName;
  102. maidExamination.contractType = maid.status.contract;
  103. bool flag3 = maidExamination.arrayAcquiredMaidClassType != null && maidExamination.arrayAcquiredMaidClassType.Length > 0;
  104. bool flag4 = maidExamination.arrayAcquiredYotogiClassType != null && maidExamination.arrayAcquiredYotogiClassType.Length > 0;
  105. if (flag3 || flag4)
  106. {
  107. list.Add(maidExamination);
  108. }
  109. if (!CompetitiveShowMgr.compatibilityMode)
  110. {
  111. GameMain.Instance.CharacterMgr.status.CheckTrophyJobClassAndYotogiClass(maid);
  112. }
  113. }
  114. }
  115. return list;
  116. }
  117. public void ClickNext()
  118. {
  119. int maidNo = ++this.m_currentMaidNo;
  120. this.m_ctrl.CreateMaidExaminationViewer(this.m_listData, maidNo);
  121. }
  122. public void ClickOk()
  123. {
  124. this.m_ctrl.DispSystemDialog();
  125. }
  126. public void CloseMaidExaminationPanel()
  127. {
  128. GameMain.Instance.SysDlg.Close();
  129. base.BaseClosePanel();
  130. }
  131. protected override void AfterClose()
  132. {
  133. if (this.sceneMgr != null)
  134. {
  135. this.m_api.EndNextScene(new CompetitiveShowAPI.dgOnSceneFinalCallBack(this.OnAfterCloseEnd));
  136. }
  137. }
  138. private void OnAfterCloseEnd()
  139. {
  140. GameMain.Instance.BgMgr.DeleteBg();
  141. GameMain.Instance.MainCamera.SetControl(true);
  142. GameMain.Instance.ScriptMgr.StopMotionScript();
  143. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  144. maid.FaceAnime("通常", 0f, 0);
  145. maid.FaceBlend("無し");
  146. maid.Visible = false;
  147. this.sceneMgr.CloseScene();
  148. }
  149. protected override void SetFadeTargetPanel()
  150. {
  151. this.fadeTargetPanel = this.m_goPanel;
  152. }
  153. private List<MaidExaminationCtrl.MaidExamination> MakeDummyData()
  154. {
  155. List<MaidExaminationCtrl.MaidExamination> list = new List<MaidExaminationCtrl.MaidExamination>();
  156. MaidExaminationCtrl.MaidExamination maidExamination = new MaidExaminationCtrl.MaidExamination();
  157. maidExamination.arrayAcquiredMaidClassType = new int[]
  158. {
  159. JobClass.uniqueNameToId("Charm"),
  160. JobClass.uniqueNameToId("Innocent")
  161. };
  162. maidExamination.arrayAcquiredYotogiClassType = new int[]
  163. {
  164. YotogiClass.uniqueNameToId("Escort"),
  165. YotogiClass.uniqueNameToId("Rudeness")
  166. };
  167. maidExamination.contractType = Contract.Free;
  168. int num = 5;
  169. for (int i = 0; i < num; i++)
  170. {
  171. MaidExaminationCtrl.MaidExamination maidExamination2 = maidExamination.Copy();
  172. if (i % 2 == 0)
  173. {
  174. maidExamination2.arrayAcquiredMaidClassType = null;
  175. maidExamination2.arrayAcquiredYotogiClassType = null;
  176. }
  177. maidExamination2.firstName = "メイド名_" + i;
  178. maidExamination2.lastName = "メイド姓_" + i;
  179. bool flag = maidExamination2.arrayAcquiredMaidClassType != null && maidExamination2.arrayAcquiredMaidClassType.Length > 0;
  180. bool flag2 = maidExamination2.arrayAcquiredYotogiClassType != null && maidExamination2.arrayAcquiredYotogiClassType.Length > 0;
  181. if (flag || flag2)
  182. {
  183. list.Add(maidExamination2);
  184. }
  185. }
  186. return list;
  187. }
  188. private List<MaidExaminationCtrl.MaidExamination> m_listData;
  189. private List<Maid> m_check_maid_list = new List<Maid>();
  190. private MaidExaminationCtrl m_ctrl;
  191. private CompetitiveShowAPI m_api;
  192. private int m_currentMaidNo;
  193. private const int FIRST_MAID_NO = 0;
  194. }