using System; using System.Collections.Generic; using MaidStatus; using Schedule; using UnityEngine; public class SceneFreeModeSelectManager : WfScreenManager { public void Awake() { this.adv_kag_ = GameMain.Instance.ScriptMgr.adv_kag; this.adv_kag_.kag.AddTagCallBack("freecall", new KagScript.KagTagCallBack(this.TagFreeCall)); this.adv_kag_.kag.AddTagCallBack("freerestorebackupdata", new KagScript.KagTagCallBack(this.TagFreeRestoreBackupData)); } public override void Start() { SceneFreeModeSelectManager.IsFreeMode = true; base.Start(); GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); this.move_screen_ = base.children_dic["Move"].GetComponent(); string empty = string.Empty; string empty2 = string.Empty; if (this.adv_kag_.tag_backup != null && 0 < this.adv_kag_.tag_backup.Count && this.adv_kag_.tag_backup["name"] == "SceneFreeModeSelect") { NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("scene_label_everyday"), "SceneFreeModeSelectManagerにscene_label_everydayの設定がされていませんでした"); NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("scene_label_vip"), "SceneFreeModeSelectManagerにscene_label_everydayの設定がされていませんでした"); NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("yotogi_label"), "SceneFreeModeSelectManagerにyotogi_labelの設定がされていませんでした"); NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("cancel_label"), "SceneFreeModeSelectManagerにcancel_labelの設定がされていませんでした"); this.scene_label_mainstory_ = this.adv_kag_.tag_backup["scene_label_mainstory"]; this.scene_label_everyday_ = this.adv_kag_.tag_backup["scene_label_everyday"]; this.scene_label_vip_ = this.adv_kag_.tag_backup["scene_label_vip"]; this.yotogi_label_ = this.adv_kag_.tag_backup["yotogi_label"]; this.cancel_label_ = this.adv_kag_.tag_backup["cancel_label"]; if (this.adv_kag_.tag_backup.ContainsKey("scene_label_life_mode")) { this.scene_label_life_mode_ = this.adv_kag_.tag_backup["scene_label_life_mode"]; } if (this.adv_kag_.tag_backup.ContainsKey("life_mode_chara_select")) { this.life_mode_chara_select_label_ = this.adv_kag_.tag_backup["life_mode_chara_select"]; } this.is_life_mode_init = this.adv_kag_.tag_backup.ContainsKey("start_life_mode"); } this.init_mgr_ = base.children_dic["Init"].GetComponent(); this.init_mgr_.next_screen = "Select"; if (this.is_life_mode_init) { this.init_mgr_.next_screen = "LifeMode"; } this.StoreBackupData(); this.CallScreen("Init"); Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0); GameObject gameObject = base.gameObject.transform.parent.gameObject; UIGrid component = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton", false).GetComponent(); GameObject childObject = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/ストーリー", false); GameObject childObject2 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/日常", false); GameObject childObject3 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/夜伽", false); GameObject childObject4 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP", false); GameObject childObject5 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/VIP_HEvent", false); GameObject childObject6 = UTY.GetChildObject(gameObject, "MenuSelect/Menu/FreeModeMenuButton/ライフモード", false); if (DailyMgr.IsLegacy) { if (childObject != null) { childObject.SetActive(false); } childObject5.gameObject.SetActive(false); childObject4.gameObject.SetActive(true); if (childObject6 != null) { childObject6.SetActive(false); } } else { childObject5.gameObject.SetActive(true); if (maid.status.subCharaData != null) { if (childObject != null) { childObject.SetActive(false); } if (childObject3 != null) { childObject3.SetActive(false); } if (childObject5 != null) { List list = FreeModeItemVip.CreateItemVipList(maid.status); if (list != null) { List list2 = new List(); foreach (FreeModeItemVip freeModeItemVip in list) { if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay || !ScheduleCSVData.NetorareFlag.Contains(freeModeItemVip.vip_data.id)) { if (ScheduleAPI.VisibleNightWork(freeModeItemVip.vip_data.id, maid, false)) { list2.Add(freeModeItemVip); } } } list = list2; } childObject5.SetActive(list != null && 0 < list.Count); } } else if (maid.status.mainChara) { List list3 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null); if (list3.Count <= 0) { UIButton component2 = childObject.GetComponent(); component2.isEnabled = false; } } else if (childObject != null) { childObject.SetActive(false); } if (childObject6 != null) { childObject6.SetActive(FreeModeItemLifeMode.CreateItemList(true).Count > 0); if (childObject6.activeSelf && !PersonalEventBlocker.IsEnabledLifeMode(maid.status.personal)) { childObject6.SetActive(false); } } childObject4.gameObject.SetActive(false); } if (childObject3.gameObject.activeSelf) { UIButton component3 = childObject3.GetComponent(); if (maid.status.playCountYotogi == 0) { component3.isEnabled = false; } } if (childObject2.gameObject.activeSelf) { List list4 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, maid.status); if (list4.Count <= 0) { childObject2.gameObject.SetActive(false); } } if (Product.isPublic) { childObject3.SetActive(false); childObject4.SetActive(false); childObject5.SetActive(false); } component.Reposition(); } public void OnPreFinalize() { SceneFreeModeSelectManager.IsFreeMode = false; this.adv_kag_ = null; } public void OnDestroy() { SceneFreeModeSelectManager.IsFreeMode = false; if (this.adv_kag_ != null) { if (this.adv_kag_.kag != null) { this.adv_kag_.kag.RemoveTagCallBack("freecall"); this.adv_kag_.kag.RemoveTagCallBack("freerestorebackupdata"); } this.adv_kag_ = null; } } public bool TagFreeCall(KagTagSupport tag_data) { this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "freecall", new string[] { "name" }); this.init_mgr_.next_screen = tag_data.GetTagProperty("name").AsString(); this.CallScreen("Init"); return false; } public bool TagFreeRestoreBackupData(KagTagSupport tag_data) { this.RestoreBackupData(); return false; } public void StoreBackupData() { Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0); if (maid != null) { this.backup_0_maid_guid = maid.status.guid; } this.backup_data_dic_.Clear(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); Status status = stockMaid.status; if (stockMaid != null) { SceneFreeModeSelectManager.BackupData value = default(SceneFreeModeSelectManager.BackupData); value.guid = status.guid; value.maid_flag = new Dictionary(); foreach (string key in status.flags.GetKeyArray()) { value.maid_flag.Add(key, status.flags.Get(key)); } value.seikeiken = status.seikeiken; value.init_seikeiken = status.initSeikeiken; value.relation = status.relation; value.addRelation = status.additionalRelation; value.specialRelation = status.specialRelation; value.feature_set = new HashSet(); foreach (int key2 in status.features.GetKeyArray()) { value.feature_set.Add(status.features.Get(key2)); } value.propensity_set = new HashSet(); foreach (int key3 in status.propensitys.GetKeyArray()) { value.propensity_set.Add(status.propensitys.Get(key3)); } this.backup_data_dic_.Add(value.guid, value); } } } public void RestoreBackupData() { if (!string.IsNullOrEmpty(this.backup_0_maid_guid)) { Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(this.backup_0_maid_guid); if (stockMaid != null && stockMaid.ActiveSlotNo != 0) { GameMain.Instance.CharacterMgr.SetActiveMaid(stockMaid, 0); } } CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid2 = characterMgr.GetStockMaid(i); Status status = stockMaid2.status; if (stockMaid2 != null && this.backup_data_dic_.ContainsKey(status.guid)) { SceneFreeModeSelectManager.BackupData backupData = this.backup_data_dic_[status.guid]; string[] keyArray = status.flags.GetKeyArray(); foreach (string flagName in keyArray) { status.RemoveFlag(flagName); } foreach (KeyValuePair keyValuePair in backupData.maid_flag) { status.SetFlag(keyValuePair.Key, keyValuePair.Value); } status.seikeiken = backupData.seikeiken; status.initSeikeiken = backupData.init_seikeiken; status.relation = backupData.relation; status.additionalRelation = backupData.addRelation; status.specialRelation = backupData.specialRelation; int[] keyArray2 = status.features.GetKeyArray(); foreach (int featureId in keyArray2) { status.RemoveFeature(featureId); } foreach (Feature.Data data in backupData.feature_set) { status.AddFeature(data); } keyArray2 = status.propensitys.GetKeyArray(); foreach (int featureId2 in keyArray2) { status.RemovePropensity(featureId2); } foreach (Propensity.Data data2 in backupData.propensity_set) { status.AddPropensity(data2); } } } } public void CallScenePlayMainStory() { if (string.IsNullOrEmpty(this.scene_label_mainstory_)) { return; } this.move_screen_.SetNextLabel(this.scene_label_mainstory_); this.CallScreen("Move"); } public void CallScenePlayEveryday() { if (string.IsNullOrEmpty(this.scene_label_everyday_)) { return; } this.move_screen_.SetNextLabel(this.scene_label_everyday_); this.CallScreen("Move"); } public void CallScenePlayVip() { if (string.IsNullOrEmpty(this.scene_label_vip_)) { return; } this.move_screen_.SetNextLabel(this.scene_label_vip_); this.CallScreen("Move"); } public void CallStoryMode() { this.CallScreen("Story"); } public void CallEverydayMode() { this.CallScreen("Everyday"); } public void CallVipMode() { this.CallScreen("Vip"); } public void CallYotogiMode() { if (string.IsNullOrEmpty(this.yotogi_label_)) { return; } this.move_screen_.SetNextLabel(this.yotogi_label_); this.CallScreen("Move"); } public void CallCharaSelect() { if (string.IsNullOrEmpty(this.cancel_label_)) { return; } this.move_screen_.SetNextLabel(this.cancel_label_); this.CallScreen("Move"); } public void CallEmpireLifeMode() { if (string.IsNullOrEmpty(this.life_mode_chara_select_label_)) { return; } this.move_screen_.SetNextLabel(this.life_mode_chara_select_label_); this.CallScreen("Move"); } public void CallScenePlayLifeMode() { if (string.IsNullOrEmpty(this.scene_label_life_mode_)) { return; } this.move_screen.SetNextLabel(this.scene_label_life_mode_); this.CallScreen("Move"); } protected override void SettingChildrenList(Dictionary children_dic) { string[] array = new string[] { "Select", "Init", "Vip", "Story", "Everyday", "LifeMode", "Move" }; for (int i = 0; i < array.Length; i++) { WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent(); component.parent_mgr = this; children_dic.Add(array[i], component); } } public WfScreenMoveChildren move_screen { get { return this.move_screen_; } } public bool is_life_mode_init { get; private set; } public FreeModeItemEveryday.ScnearioType ScnearioItemType { get { return this.itemType; } set { this.itemType = value; } } public static bool IsFreeMode; private Dictionary backup_data_dic_ = new Dictionary(); private string backup_0_maid_guid; private WfScreenMoveChildren move_screen_; private ADVKagManager adv_kag_; private FreeModeInit init_mgr_; private string scene_label_mainstory_; private string scene_label_everyday_; private string scene_label_vip_; private string yotogi_label_; private string cancel_label_; private string scene_label_life_mode_ = string.Empty; private string life_mode_chara_select_label_ = string.Empty; [SerializeField] private FreeModeItemEveryday.ScnearioType itemType; private struct BackupData { public string guid; public Dictionary maid_flag; public Seikeiken seikeiken; public HashSet feature_set; public HashSet propensity_set; public Seikeiken init_seikeiken; public Relation relation; public AdditionalRelation addRelation; public SpecialRelation specialRelation; } }