SceneFreeModeSelectManager.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. using UnityEngine;
  5. public class SceneFreeModeSelectManager : WfScreenManager
  6. {
  7. public void Awake()
  8. {
  9. this.adv_kag_ = GameMain.Instance.ScriptMgr.adv_kag;
  10. this.adv_kag_.kag.AddTagCallBack("freecall", new KagScript.KagTagCallBack(this.TagFreeCall));
  11. this.adv_kag_.kag.AddTagCallBack("freerestorebackupdata", new KagScript.KagTagCallBack(this.TagFreeRestoreBackupData));
  12. }
  13. public override void Start()
  14. {
  15. SceneFreeModeSelectManager.IsFreeMode = true;
  16. base.Start();
  17. GameMain.Instance.MainLight.Reset();
  18. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  19. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  20. GameMain.Instance.SoundMgr.VoiceStopAll();
  21. this.move_screen_ = base.children_dic["Move"].GetComponent<WfScreenMoveChildren>();
  22. string empty = string.Empty;
  23. string empty2 = string.Empty;
  24. if (this.adv_kag_.tag_backup != null && 0 < this.adv_kag_.tag_backup.Count && this.adv_kag_.tag_backup["name"] == "SceneFreeModeSelect")
  25. {
  26. NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("scene_label_everyday"), "SceneFreeModeSelectManagerにscene_label_everydayの設定がされていませんでした");
  27. NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("scene_label_vip"), "SceneFreeModeSelectManagerにscene_label_everydayの設定がされていませんでした");
  28. NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("yotogi_label"), "SceneFreeModeSelectManagerにyotogi_labelの設定がされていませんでした");
  29. NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("cancel_label"), "SceneFreeModeSelectManagerにcancel_labelの設定がされていませんでした");
  30. this.scene_label_mainstory_ = this.adv_kag_.tag_backup["scene_label_mainstory"];
  31. this.scene_label_everyday_ = this.adv_kag_.tag_backup["scene_label_everyday"];
  32. this.scene_label_vip_ = this.adv_kag_.tag_backup["scene_label_vip"];
  33. this.yotogi_label_ = this.adv_kag_.tag_backup["yotogi_label"];
  34. this.cancel_label_ = this.adv_kag_.tag_backup["cancel_label"];
  35. if (this.adv_kag_.tag_backup.ContainsKey("scene_label_life_mode"))
  36. {
  37. this.scene_label_life_mode_ = this.adv_kag_.tag_backup["scene_label_life_mode"];
  38. }
  39. if (this.adv_kag_.tag_backup.ContainsKey("life_mode_chara_select"))
  40. {
  41. this.life_mode_chara_select_label_ = this.adv_kag_.tag_backup["life_mode_chara_select"];
  42. }
  43. this.is_life_mode_init = this.adv_kag_.tag_backup.ContainsKey("start_life_mode");
  44. }
  45. this.init_mgr_ = base.children_dic["Init"].GetComponent<FreeModeInit>();
  46. this.init_mgr_.next_screen = "Select";
  47. if (this.is_life_mode_init)
  48. {
  49. this.init_mgr_.next_screen = "LifeMode";
  50. }
  51. this.StoreBackupData();
  52. this.CallScreen("Init");
  53. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  54. GameObject gameObject = base.gameObject.transform.parent.gameObject;
  55. UIGrid component = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton", false).GetComponent<UIGrid>();
  56. GameObject childObject = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/ストーリー", false);
  57. GameObject childObject2 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/日常", false);
  58. GameObject childObject3 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/夜伽", false);
  59. GameObject childObject4 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP", false);
  60. GameObject childObject5 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP_HEvent", false);
  61. GameObject childObject6 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/ライフモード", false);
  62. if (DailyMgr.IsLegacy)
  63. {
  64. if (childObject != null)
  65. {
  66. childObject.SetActive(false);
  67. }
  68. childObject5.gameObject.SetActive(false);
  69. childObject4.gameObject.SetActive(true);
  70. if (childObject6 != null)
  71. {
  72. childObject6.SetActive(false);
  73. }
  74. }
  75. else
  76. {
  77. if (maid.status.subCharaData != null)
  78. {
  79. if (childObject != null)
  80. {
  81. childObject.SetActive(false);
  82. }
  83. if (childObject3 != null)
  84. {
  85. childObject3.SetActive(false);
  86. }
  87. }
  88. else if (maid.status.mainChara)
  89. {
  90. List<FreeModeItemEveryday> list = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null);
  91. if (list.Count <= 0)
  92. {
  93. UIButton component2 = childObject.GetComponent<UIButton>();
  94. component2.isEnabled = false;
  95. }
  96. }
  97. else if (childObject != null)
  98. {
  99. childObject.SetActive(false);
  100. }
  101. if (childObject6 != null)
  102. {
  103. childObject6.SetActive(FreeModeItemLifeMode.CreateItemList(true).Count > 0);
  104. }
  105. childObject5.gameObject.SetActive(true);
  106. childObject4.gameObject.SetActive(false);
  107. }
  108. if (childObject3.gameObject.activeSelf)
  109. {
  110. UIButton component3 = childObject3.GetComponent<UIButton>();
  111. if (maid.status.playCountYotogi == 0)
  112. {
  113. component3.isEnabled = false;
  114. }
  115. }
  116. if (childObject2.gameObject.activeSelf)
  117. {
  118. List<FreeModeItemEveryday> list2 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, maid.status);
  119. if (list2.Count <= 0)
  120. {
  121. childObject2.gameObject.SetActive(false);
  122. }
  123. }
  124. if (Product.isPublic)
  125. {
  126. childObject3.SetActive(false);
  127. childObject4.SetActive(false);
  128. childObject5.SetActive(false);
  129. }
  130. component.Reposition();
  131. }
  132. public void OnPreFinalize()
  133. {
  134. SceneFreeModeSelectManager.IsFreeMode = false;
  135. this.adv_kag_ = null;
  136. }
  137. public void OnDestroy()
  138. {
  139. SceneFreeModeSelectManager.IsFreeMode = false;
  140. if (this.adv_kag_ != null)
  141. {
  142. if (this.adv_kag_.kag != null)
  143. {
  144. this.adv_kag_.kag.RemoveTagCallBack("freecall");
  145. this.adv_kag_.kag.RemoveTagCallBack("freerestorebackupdata");
  146. }
  147. this.adv_kag_ = null;
  148. }
  149. }
  150. public bool TagFreeCall(KagTagSupport tag_data)
  151. {
  152. this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "freecall", new string[]
  153. {
  154. "name"
  155. });
  156. this.init_mgr_.next_screen = tag_data.GetTagProperty("name").AsString();
  157. this.CallScreen("Init");
  158. return false;
  159. }
  160. public bool TagFreeRestoreBackupData(KagTagSupport tag_data)
  161. {
  162. this.RestoreBackupData();
  163. return false;
  164. }
  165. public void StoreBackupData()
  166. {
  167. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  168. if (maid != null)
  169. {
  170. this.backup_0_maid_guid = maid.status.guid;
  171. }
  172. this.backup_data_dic_.Clear();
  173. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  174. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  175. {
  176. Maid stockMaid = characterMgr.GetStockMaid(i);
  177. Status status = stockMaid.status;
  178. if (stockMaid != null)
  179. {
  180. SceneFreeModeSelectManager.BackupData value = default(SceneFreeModeSelectManager.BackupData);
  181. value.guid = status.guid;
  182. value.maid_flag = new Dictionary<string, int>();
  183. foreach (string key in status.flags.GetKeyArray())
  184. {
  185. value.maid_flag.Add(key, status.flags.Get(key));
  186. }
  187. value.seikeiken = status.seikeiken;
  188. value.init_seikeiken = status.initSeikeiken;
  189. value.relation = status.relation;
  190. value.addRelation = status.additionalRelation;
  191. value.specialRelation = status.specialRelation;
  192. value.feature_set = new HashSet<Feature.Data>();
  193. foreach (int key2 in status.features.GetKeyArray())
  194. {
  195. value.feature_set.Add(status.features.Get(key2));
  196. }
  197. value.propensity_set = new HashSet<Propensity.Data>();
  198. foreach (int key3 in status.propensitys.GetKeyArray())
  199. {
  200. value.propensity_set.Add(status.propensitys.Get(key3));
  201. }
  202. this.backup_data_dic_.Add(value.guid, value);
  203. }
  204. }
  205. }
  206. public void RestoreBackupData()
  207. {
  208. if (!string.IsNullOrEmpty(this.backup_0_maid_guid))
  209. {
  210. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(this.backup_0_maid_guid);
  211. if (stockMaid != null && stockMaid.ActiveSlotNo != 0)
  212. {
  213. GameMain.Instance.CharacterMgr.SetActiveMaid(stockMaid, 0);
  214. }
  215. }
  216. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  217. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  218. {
  219. Maid stockMaid2 = characterMgr.GetStockMaid(i);
  220. Status status = stockMaid2.status;
  221. if (stockMaid2 != null && this.backup_data_dic_.ContainsKey(status.guid))
  222. {
  223. SceneFreeModeSelectManager.BackupData backupData = this.backup_data_dic_[status.guid];
  224. string[] keyArray = status.flags.GetKeyArray();
  225. foreach (string flagName in keyArray)
  226. {
  227. status.RemoveFlag(flagName);
  228. }
  229. foreach (KeyValuePair<string, int> keyValuePair in backupData.maid_flag)
  230. {
  231. status.SetFlag(keyValuePair.Key, keyValuePair.Value);
  232. }
  233. status.seikeiken = backupData.seikeiken;
  234. status.initSeikeiken = backupData.init_seikeiken;
  235. status.relation = backupData.relation;
  236. status.additionalRelation = backupData.addRelation;
  237. status.specialRelation = backupData.specialRelation;
  238. int[] keyArray2 = status.features.GetKeyArray();
  239. foreach (int featureId in keyArray2)
  240. {
  241. status.RemoveFeature(featureId);
  242. }
  243. foreach (Feature.Data data in backupData.feature_set)
  244. {
  245. status.AddFeature(data);
  246. }
  247. keyArray2 = status.propensitys.GetKeyArray();
  248. foreach (int featureId2 in keyArray2)
  249. {
  250. status.RemovePropensity(featureId2);
  251. }
  252. foreach (Propensity.Data data2 in backupData.propensity_set)
  253. {
  254. status.AddPropensity(data2);
  255. }
  256. }
  257. }
  258. }
  259. public void CallScenePlayMainStory()
  260. {
  261. if (string.IsNullOrEmpty(this.scene_label_mainstory_))
  262. {
  263. return;
  264. }
  265. this.move_screen_.SetNextLabel(this.scene_label_mainstory_);
  266. this.CallScreen("Move");
  267. }
  268. public void CallScenePlayEveryday()
  269. {
  270. if (string.IsNullOrEmpty(this.scene_label_everyday_))
  271. {
  272. return;
  273. }
  274. this.move_screen_.SetNextLabel(this.scene_label_everyday_);
  275. this.CallScreen("Move");
  276. }
  277. public void CallScenePlayVip()
  278. {
  279. if (string.IsNullOrEmpty(this.scene_label_vip_))
  280. {
  281. return;
  282. }
  283. this.move_screen_.SetNextLabel(this.scene_label_vip_);
  284. this.CallScreen("Move");
  285. }
  286. public void CallStoryMode()
  287. {
  288. this.CallScreen("Story");
  289. }
  290. public void CallEverydayMode()
  291. {
  292. this.CallScreen("Everyday");
  293. }
  294. public void CallVipMode()
  295. {
  296. this.CallScreen("Vip");
  297. }
  298. public void CallYotogiMode()
  299. {
  300. if (string.IsNullOrEmpty(this.yotogi_label_))
  301. {
  302. return;
  303. }
  304. this.move_screen_.SetNextLabel(this.yotogi_label_);
  305. this.CallScreen("Move");
  306. }
  307. public void CallCharaSelect()
  308. {
  309. if (string.IsNullOrEmpty(this.cancel_label_))
  310. {
  311. return;
  312. }
  313. this.move_screen_.SetNextLabel(this.cancel_label_);
  314. this.CallScreen("Move");
  315. }
  316. public void CallEmpireLifeMode()
  317. {
  318. if (string.IsNullOrEmpty(this.life_mode_chara_select_label_))
  319. {
  320. return;
  321. }
  322. this.move_screen_.SetNextLabel(this.life_mode_chara_select_label_);
  323. this.CallScreen("Move");
  324. }
  325. public void CallScenePlayLifeMode()
  326. {
  327. if (string.IsNullOrEmpty(this.scene_label_life_mode_))
  328. {
  329. return;
  330. }
  331. this.move_screen.SetNextLabel(this.scene_label_life_mode_);
  332. this.CallScreen("Move");
  333. }
  334. protected override void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic)
  335. {
  336. string[] array = new string[]
  337. {
  338. "Select",
  339. "Init",
  340. "Vip",
  341. "Story",
  342. "Everyday",
  343. "LifeMode",
  344. "Move"
  345. };
  346. for (int i = 0; i < array.Length; i++)
  347. {
  348. WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent<WfScreenChildren>();
  349. component.parent_mgr = this;
  350. children_dic.Add(array[i], component);
  351. }
  352. }
  353. public WfScreenMoveChildren move_screen
  354. {
  355. get
  356. {
  357. return this.move_screen_;
  358. }
  359. }
  360. public bool is_life_mode_init { get; private set; }
  361. public FreeModeItemEveryday.ScnearioType ScnearioItemType
  362. {
  363. get
  364. {
  365. return this.itemType;
  366. }
  367. set
  368. {
  369. this.itemType = value;
  370. }
  371. }
  372. public static bool IsFreeMode;
  373. private Dictionary<string, SceneFreeModeSelectManager.BackupData> backup_data_dic_ = new Dictionary<string, SceneFreeModeSelectManager.BackupData>();
  374. private string backup_0_maid_guid;
  375. private WfScreenMoveChildren move_screen_;
  376. private ADVKagManager adv_kag_;
  377. private FreeModeInit init_mgr_;
  378. private string scene_label_mainstory_;
  379. private string scene_label_everyday_;
  380. private string scene_label_vip_;
  381. private string yotogi_label_;
  382. private string cancel_label_;
  383. private string scene_label_life_mode_ = string.Empty;
  384. private string life_mode_chara_select_label_ = string.Empty;
  385. [SerializeField]
  386. private FreeModeItemEveryday.ScnearioType itemType;
  387. private struct BackupData
  388. {
  389. public string guid;
  390. public Dictionary<string, int> maid_flag;
  391. public Seikeiken seikeiken;
  392. public HashSet<Feature.Data> feature_set;
  393. public HashSet<Propensity.Data> propensity_set;
  394. public Seikeiken init_seikeiken;
  395. public Relation relation;
  396. public AdditionalRelation addRelation;
  397. public SpecialRelation specialRelation;
  398. }
  399. }