SceneFreeModeSelectManager.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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. if (childObject6.activeSelf && !PersonalEventBlocker.IsEnabledLifeMode(maid.status.personal))
  105. {
  106. childObject6.SetActive(false);
  107. }
  108. }
  109. childObject5.gameObject.SetActive(true);
  110. childObject4.gameObject.SetActive(false);
  111. }
  112. if (childObject3.gameObject.activeSelf)
  113. {
  114. UIButton component3 = childObject3.GetComponent<UIButton>();
  115. if (maid.status.playCountYotogi == 0)
  116. {
  117. component3.isEnabled = false;
  118. }
  119. }
  120. if (childObject2.gameObject.activeSelf)
  121. {
  122. List<FreeModeItemEveryday> list2 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, maid.status);
  123. if (list2.Count <= 0)
  124. {
  125. childObject2.gameObject.SetActive(false);
  126. }
  127. }
  128. if (Product.isPublic)
  129. {
  130. childObject3.SetActive(false);
  131. childObject4.SetActive(false);
  132. childObject5.SetActive(false);
  133. }
  134. component.Reposition();
  135. }
  136. public void OnPreFinalize()
  137. {
  138. SceneFreeModeSelectManager.IsFreeMode = false;
  139. this.adv_kag_ = null;
  140. }
  141. public void OnDestroy()
  142. {
  143. SceneFreeModeSelectManager.IsFreeMode = false;
  144. if (this.adv_kag_ != null)
  145. {
  146. if (this.adv_kag_.kag != null)
  147. {
  148. this.adv_kag_.kag.RemoveTagCallBack("freecall");
  149. this.adv_kag_.kag.RemoveTagCallBack("freerestorebackupdata");
  150. }
  151. this.adv_kag_ = null;
  152. }
  153. }
  154. public bool TagFreeCall(KagTagSupport tag_data)
  155. {
  156. this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "freecall", new string[]
  157. {
  158. "name"
  159. });
  160. this.init_mgr_.next_screen = tag_data.GetTagProperty("name").AsString();
  161. this.CallScreen("Init");
  162. return false;
  163. }
  164. public bool TagFreeRestoreBackupData(KagTagSupport tag_data)
  165. {
  166. this.RestoreBackupData();
  167. return false;
  168. }
  169. public void StoreBackupData()
  170. {
  171. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  172. if (maid != null)
  173. {
  174. this.backup_0_maid_guid = maid.status.guid;
  175. }
  176. this.backup_data_dic_.Clear();
  177. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  178. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  179. {
  180. Maid stockMaid = characterMgr.GetStockMaid(i);
  181. Status status = stockMaid.status;
  182. if (stockMaid != null)
  183. {
  184. SceneFreeModeSelectManager.BackupData value = default(SceneFreeModeSelectManager.BackupData);
  185. value.guid = status.guid;
  186. value.maid_flag = new Dictionary<string, int>();
  187. foreach (string key in status.flags.GetKeyArray())
  188. {
  189. value.maid_flag.Add(key, status.flags.Get(key));
  190. }
  191. value.seikeiken = status.seikeiken;
  192. value.init_seikeiken = status.initSeikeiken;
  193. value.relation = status.relation;
  194. value.addRelation = status.additionalRelation;
  195. value.specialRelation = status.specialRelation;
  196. value.feature_set = new HashSet<Feature.Data>();
  197. foreach (int key2 in status.features.GetKeyArray())
  198. {
  199. value.feature_set.Add(status.features.Get(key2));
  200. }
  201. value.propensity_set = new HashSet<Propensity.Data>();
  202. foreach (int key3 in status.propensitys.GetKeyArray())
  203. {
  204. value.propensity_set.Add(status.propensitys.Get(key3));
  205. }
  206. this.backup_data_dic_.Add(value.guid, value);
  207. }
  208. }
  209. }
  210. public void RestoreBackupData()
  211. {
  212. if (!string.IsNullOrEmpty(this.backup_0_maid_guid))
  213. {
  214. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(this.backup_0_maid_guid);
  215. if (stockMaid != null && stockMaid.ActiveSlotNo != 0)
  216. {
  217. GameMain.Instance.CharacterMgr.SetActiveMaid(stockMaid, 0);
  218. }
  219. }
  220. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  221. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  222. {
  223. Maid stockMaid2 = characterMgr.GetStockMaid(i);
  224. Status status = stockMaid2.status;
  225. if (stockMaid2 != null && this.backup_data_dic_.ContainsKey(status.guid))
  226. {
  227. SceneFreeModeSelectManager.BackupData backupData = this.backup_data_dic_[status.guid];
  228. string[] keyArray = status.flags.GetKeyArray();
  229. foreach (string flagName in keyArray)
  230. {
  231. status.RemoveFlag(flagName);
  232. }
  233. foreach (KeyValuePair<string, int> keyValuePair in backupData.maid_flag)
  234. {
  235. status.SetFlag(keyValuePair.Key, keyValuePair.Value);
  236. }
  237. status.seikeiken = backupData.seikeiken;
  238. status.initSeikeiken = backupData.init_seikeiken;
  239. status.relation = backupData.relation;
  240. status.additionalRelation = backupData.addRelation;
  241. status.specialRelation = backupData.specialRelation;
  242. int[] keyArray2 = status.features.GetKeyArray();
  243. foreach (int featureId in keyArray2)
  244. {
  245. status.RemoveFeature(featureId);
  246. }
  247. foreach (Feature.Data data in backupData.feature_set)
  248. {
  249. status.AddFeature(data);
  250. }
  251. keyArray2 = status.propensitys.GetKeyArray();
  252. foreach (int featureId2 in keyArray2)
  253. {
  254. status.RemovePropensity(featureId2);
  255. }
  256. foreach (Propensity.Data data2 in backupData.propensity_set)
  257. {
  258. status.AddPropensity(data2);
  259. }
  260. }
  261. }
  262. }
  263. public void CallScenePlayMainStory()
  264. {
  265. if (string.IsNullOrEmpty(this.scene_label_mainstory_))
  266. {
  267. return;
  268. }
  269. this.move_screen_.SetNextLabel(this.scene_label_mainstory_);
  270. this.CallScreen("Move");
  271. }
  272. public void CallScenePlayEveryday()
  273. {
  274. if (string.IsNullOrEmpty(this.scene_label_everyday_))
  275. {
  276. return;
  277. }
  278. this.move_screen_.SetNextLabel(this.scene_label_everyday_);
  279. this.CallScreen("Move");
  280. }
  281. public void CallScenePlayVip()
  282. {
  283. if (string.IsNullOrEmpty(this.scene_label_vip_))
  284. {
  285. return;
  286. }
  287. this.move_screen_.SetNextLabel(this.scene_label_vip_);
  288. this.CallScreen("Move");
  289. }
  290. public void CallStoryMode()
  291. {
  292. this.CallScreen("Story");
  293. }
  294. public void CallEverydayMode()
  295. {
  296. this.CallScreen("Everyday");
  297. }
  298. public void CallVipMode()
  299. {
  300. this.CallScreen("Vip");
  301. }
  302. public void CallYotogiMode()
  303. {
  304. if (string.IsNullOrEmpty(this.yotogi_label_))
  305. {
  306. return;
  307. }
  308. this.move_screen_.SetNextLabel(this.yotogi_label_);
  309. this.CallScreen("Move");
  310. }
  311. public void CallCharaSelect()
  312. {
  313. if (string.IsNullOrEmpty(this.cancel_label_))
  314. {
  315. return;
  316. }
  317. this.move_screen_.SetNextLabel(this.cancel_label_);
  318. this.CallScreen("Move");
  319. }
  320. public void CallEmpireLifeMode()
  321. {
  322. if (string.IsNullOrEmpty(this.life_mode_chara_select_label_))
  323. {
  324. return;
  325. }
  326. this.move_screen_.SetNextLabel(this.life_mode_chara_select_label_);
  327. this.CallScreen("Move");
  328. }
  329. public void CallScenePlayLifeMode()
  330. {
  331. if (string.IsNullOrEmpty(this.scene_label_life_mode_))
  332. {
  333. return;
  334. }
  335. this.move_screen.SetNextLabel(this.scene_label_life_mode_);
  336. this.CallScreen("Move");
  337. }
  338. protected override void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic)
  339. {
  340. string[] array = new string[]
  341. {
  342. "Select",
  343. "Init",
  344. "Vip",
  345. "Story",
  346. "Everyday",
  347. "LifeMode",
  348. "Move"
  349. };
  350. for (int i = 0; i < array.Length; i++)
  351. {
  352. WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent<WfScreenChildren>();
  353. component.parent_mgr = this;
  354. children_dic.Add(array[i], component);
  355. }
  356. }
  357. public WfScreenMoveChildren move_screen
  358. {
  359. get
  360. {
  361. return this.move_screen_;
  362. }
  363. }
  364. public bool is_life_mode_init { get; private set; }
  365. public FreeModeItemEveryday.ScnearioType ScnearioItemType
  366. {
  367. get
  368. {
  369. return this.itemType;
  370. }
  371. set
  372. {
  373. this.itemType = value;
  374. }
  375. }
  376. public static bool IsFreeMode;
  377. private Dictionary<string, SceneFreeModeSelectManager.BackupData> backup_data_dic_ = new Dictionary<string, SceneFreeModeSelectManager.BackupData>();
  378. private string backup_0_maid_guid;
  379. private WfScreenMoveChildren move_screen_;
  380. private ADVKagManager adv_kag_;
  381. private FreeModeInit init_mgr_;
  382. private string scene_label_mainstory_;
  383. private string scene_label_everyday_;
  384. private string scene_label_vip_;
  385. private string yotogi_label_;
  386. private string cancel_label_;
  387. private string scene_label_life_mode_ = string.Empty;
  388. private string life_mode_chara_select_label_ = string.Empty;
  389. [SerializeField]
  390. private FreeModeItemEveryday.ScnearioType itemType;
  391. private struct BackupData
  392. {
  393. public string guid;
  394. public Dictionary<string, int> maid_flag;
  395. public Seikeiken seikeiken;
  396. public HashSet<Feature.Data> feature_set;
  397. public HashSet<Propensity.Data> propensity_set;
  398. public Seikeiken init_seikeiken;
  399. public Relation relation;
  400. public AdditionalRelation addRelation;
  401. public SpecialRelation specialRelation;
  402. }
  403. }