SceneFreeModeSelectManager.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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. }
  36. this.init_mgr_ = base.children_dic["Init"].GetComponent<FreeModeInit>();
  37. this.init_mgr_.next_screen = "Select";
  38. this.StoreBackupData();
  39. this.CallScreen("Init");
  40. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
  41. GameObject gameObject = base.gameObject.transform.parent.gameObject;
  42. UIGrid component = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton", false).GetComponent<UIGrid>();
  43. GameObject childObject = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/ストーリー", false);
  44. GameObject childObject2 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/日常", false);
  45. GameObject childObject3 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/夜伽", false);
  46. GameObject childObject4 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP", false);
  47. GameObject childObject5 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP_HEvent", false);
  48. if (DailyMgr.IsLegacy)
  49. {
  50. if (childObject != null)
  51. {
  52. childObject.SetActive(false);
  53. }
  54. childObject5.gameObject.SetActive(false);
  55. childObject4.gameObject.SetActive(true);
  56. }
  57. else
  58. {
  59. if (maid.status.subCharaData != null)
  60. {
  61. if (childObject != null)
  62. {
  63. childObject.SetActive(false);
  64. }
  65. if (childObject3 != null)
  66. {
  67. childObject3.SetActive(false);
  68. }
  69. }
  70. else if (maid.status.mainChara)
  71. {
  72. List<FreeModeItemEveryday> list = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null);
  73. if (list.Count <= 0)
  74. {
  75. UIButton component2 = childObject.GetComponent<UIButton>();
  76. component2.isEnabled = false;
  77. }
  78. }
  79. else if (childObject != null)
  80. {
  81. childObject.SetActive(false);
  82. }
  83. childObject5.gameObject.SetActive(true);
  84. childObject4.gameObject.SetActive(false);
  85. }
  86. if (childObject3.gameObject.activeSelf)
  87. {
  88. UIButton component3 = childObject3.GetComponent<UIButton>();
  89. if (maid.status.playCountYotogi == 0)
  90. {
  91. component3.isEnabled = false;
  92. }
  93. }
  94. if (childObject2.gameObject.activeSelf)
  95. {
  96. List<FreeModeItemEveryday> list2 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, maid.status);
  97. if (list2.Count <= 0)
  98. {
  99. childObject2.gameObject.SetActive(false);
  100. }
  101. }
  102. component.Reposition();
  103. }
  104. public void OnPreFinalize()
  105. {
  106. SceneFreeModeSelectManager.IsFreeMode = false;
  107. this.adv_kag_ = null;
  108. }
  109. public void OnDestroy()
  110. {
  111. SceneFreeModeSelectManager.IsFreeMode = false;
  112. if (this.adv_kag_ != null)
  113. {
  114. if (this.adv_kag_.kag != null)
  115. {
  116. this.adv_kag_.kag.RemoveTagCallBack("freecall");
  117. this.adv_kag_.kag.RemoveTagCallBack("freerestorebackupdata");
  118. }
  119. this.adv_kag_ = null;
  120. }
  121. }
  122. public bool TagFreeCall(KagTagSupport tag_data)
  123. {
  124. this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "freecall", new string[]
  125. {
  126. "name"
  127. });
  128. this.init_mgr_.next_screen = tag_data.GetTagProperty("name").AsString();
  129. this.CallScreen("Init");
  130. return false;
  131. }
  132. public bool TagFreeRestoreBackupData(KagTagSupport tag_data)
  133. {
  134. this.RestoreBackupData();
  135. return false;
  136. }
  137. public void StoreBackupData()
  138. {
  139. this.backup_data_dic_.Clear();
  140. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  141. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  142. {
  143. Maid stockMaid = characterMgr.GetStockMaid(i);
  144. Status status = stockMaid.status;
  145. if (stockMaid != null)
  146. {
  147. SceneFreeModeSelectManager.BackupData value = default(SceneFreeModeSelectManager.BackupData);
  148. value.guid = status.guid;
  149. value.maid_flag = new Dictionary<string, int>();
  150. foreach (string key in status.flags.GetKeyArray())
  151. {
  152. value.maid_flag.Add(key, status.flags.Get(key));
  153. }
  154. value.seikeiken = status.seikeiken;
  155. value.init_seikeiken = status.initSeikeiken;
  156. value.relation = status.relation;
  157. value.feature_set = new HashSet<Feature.Data>();
  158. foreach (int key2 in status.features.GetKeyArray())
  159. {
  160. value.feature_set.Add(status.features.Get(key2));
  161. }
  162. value.propensity_set = new HashSet<Propensity.Data>();
  163. foreach (int key3 in status.propensitys.GetKeyArray())
  164. {
  165. value.propensity_set.Add(status.propensitys.Get(key3));
  166. }
  167. this.backup_data_dic_.Add(value.guid, value);
  168. }
  169. }
  170. }
  171. public void RestoreBackupData()
  172. {
  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 && this.backup_data_dic_.ContainsKey(status.guid))
  179. {
  180. SceneFreeModeSelectManager.BackupData backupData = this.backup_data_dic_[status.guid];
  181. string[] keyArray = status.flags.GetKeyArray();
  182. foreach (string flagName in keyArray)
  183. {
  184. status.RemoveFlag(flagName);
  185. }
  186. foreach (KeyValuePair<string, int> keyValuePair in backupData.maid_flag)
  187. {
  188. status.SetFlag(keyValuePair.Key, keyValuePair.Value);
  189. }
  190. status.seikeiken = backupData.seikeiken;
  191. status.initSeikeiken = backupData.init_seikeiken;
  192. status.relation = backupData.relation;
  193. int[] keyArray2 = status.features.GetKeyArray();
  194. foreach (int featureId in keyArray2)
  195. {
  196. status.RemoveFeature(featureId);
  197. }
  198. foreach (Feature.Data data in backupData.feature_set)
  199. {
  200. status.AddFeature(data);
  201. }
  202. keyArray2 = status.propensitys.GetKeyArray();
  203. foreach (int featureId2 in keyArray2)
  204. {
  205. status.RemovePropensity(featureId2);
  206. }
  207. foreach (Propensity.Data data2 in backupData.propensity_set)
  208. {
  209. status.AddPropensity(data2);
  210. }
  211. }
  212. }
  213. }
  214. public void CallScenePlayMainStory()
  215. {
  216. if (string.IsNullOrEmpty(this.scene_label_mainstory_))
  217. {
  218. return;
  219. }
  220. this.move_screen_.SetNextLabel(this.scene_label_mainstory_);
  221. this.CallScreen("Move");
  222. }
  223. public void CallScenePlayEveryday()
  224. {
  225. if (string.IsNullOrEmpty(this.scene_label_everyday_))
  226. {
  227. return;
  228. }
  229. this.move_screen_.SetNextLabel(this.scene_label_everyday_);
  230. this.CallScreen("Move");
  231. }
  232. public void CallScenePlayVip()
  233. {
  234. if (string.IsNullOrEmpty(this.scene_label_vip_))
  235. {
  236. return;
  237. }
  238. this.move_screen_.SetNextLabel(this.scene_label_vip_);
  239. this.CallScreen("Move");
  240. }
  241. public void CallStoryMode()
  242. {
  243. this.CallScreen("Story");
  244. }
  245. public void CallEverydayMode()
  246. {
  247. this.CallScreen("Everyday");
  248. }
  249. public void CallVipMode()
  250. {
  251. this.CallScreen("Vip");
  252. }
  253. public void CallYotogiMode()
  254. {
  255. if (string.IsNullOrEmpty(this.yotogi_label_))
  256. {
  257. return;
  258. }
  259. this.move_screen_.SetNextLabel(this.yotogi_label_);
  260. this.CallScreen("Move");
  261. }
  262. public void CallCharaSelect()
  263. {
  264. if (string.IsNullOrEmpty(this.cancel_label_))
  265. {
  266. return;
  267. }
  268. this.move_screen_.SetNextLabel(this.cancel_label_);
  269. this.CallScreen("Move");
  270. }
  271. protected override void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic)
  272. {
  273. string[] array = new string[]
  274. {
  275. "Select",
  276. "Init",
  277. "Vip",
  278. "Story",
  279. "Everyday",
  280. "Move"
  281. };
  282. for (int i = 0; i < array.Length; i++)
  283. {
  284. WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent<WfScreenChildren>();
  285. component.parent_mgr = this;
  286. children_dic.Add(array[i], component);
  287. }
  288. }
  289. public WfScreenMoveChildren move_screen
  290. {
  291. get
  292. {
  293. return this.move_screen_;
  294. }
  295. }
  296. public FreeModeItemEveryday.ScnearioType ScnearioItemType
  297. {
  298. get
  299. {
  300. return this.itemType;
  301. }
  302. set
  303. {
  304. this.itemType = value;
  305. }
  306. }
  307. public static bool IsFreeMode;
  308. private Dictionary<string, SceneFreeModeSelectManager.BackupData> backup_data_dic_ = new Dictionary<string, SceneFreeModeSelectManager.BackupData>();
  309. private WfScreenMoveChildren move_screen_;
  310. private ADVKagManager adv_kag_;
  311. private FreeModeInit init_mgr_;
  312. private string scene_label_mainstory_;
  313. private string scene_label_everyday_;
  314. private string scene_label_vip_;
  315. private string yotogi_label_;
  316. private string cancel_label_;
  317. [SerializeField]
  318. private FreeModeItemEveryday.ScnearioType itemType;
  319. private struct BackupData
  320. {
  321. public string guid;
  322. public Dictionary<string, int> maid_flag;
  323. public Seikeiken seikeiken;
  324. public HashSet<Feature.Data> feature_set;
  325. public HashSet<Propensity.Data> propensity_set;
  326. public Seikeiken init_seikeiken;
  327. public Relation relation;
  328. }
  329. }