SceneFreeModeSelectManager.cs 13 KB

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