123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- using System;
- using System.Collections.Generic;
- using MaidStatus;
- 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<WfScreenMoveChildren>();
- 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"];
- }
- this.init_mgr_ = base.children_dic["Init"].GetComponent<FreeModeInit>();
- this.init_mgr_.next_screen = "Select";
- 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<UIGrid>();
- 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);
- if (DailyMgr.IsLegacy)
- {
- if (childObject != null)
- {
- childObject.SetActive(false);
- }
- childObject5.gameObject.SetActive(false);
- childObject4.gameObject.SetActive(true);
- }
- else
- {
- if (maid.status.subCharaData != null)
- {
- if (childObject != null)
- {
- childObject.SetActive(false);
- }
- if (childObject3 != null)
- {
- childObject3.SetActive(false);
- }
- }
- else if (maid.status.mainChara)
- {
- List<FreeModeItemEveryday> list = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Story, null);
- if (list.Count <= 0)
- {
- UIButton component2 = childObject.GetComponent<UIButton>();
- component2.isEnabled = false;
- }
- }
- else if (childObject != null)
- {
- childObject.SetActive(false);
- }
- childObject5.gameObject.SetActive(true);
- childObject4.gameObject.SetActive(false);
- }
- if (childObject3.gameObject.activeSelf)
- {
- UIButton component3 = childObject3.GetComponent<UIButton>();
- if (maid.status.playCountYotogi == 0)
- {
- component3.isEnabled = false;
- }
- }
- if (childObject2.gameObject.activeSelf)
- {
- List<FreeModeItemEveryday> list2 = FreeModeItemEveryday.CreateItemEverydayList(FreeModeItemEveryday.ScnearioType.Nitijyou, maid.status);
- if (list2.Count <= 0)
- {
- childObject2.gameObject.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()
- {
- 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<string, int>();
- 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.feature_set = new HashSet<Feature.Data>();
- foreach (int key2 in status.features.GetKeyArray())
- {
- value.feature_set.Add(status.features.Get(key2));
- }
- value.propensity_set = new HashSet<Propensity.Data>();
- 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()
- {
- 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 && 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<string, int> keyValuePair in backupData.maid_flag)
- {
- status.SetFlag(keyValuePair.Key, keyValuePair.Value);
- }
- status.seikeiken = backupData.seikeiken;
- status.initSeikeiken = backupData.init_seikeiken;
- status.relation = backupData.relation;
- 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");
- }
- protected override void SettingChildrenList(Dictionary<string, WfScreenChildren> children_dic)
- {
- string[] array = new string[]
- {
- "Select",
- "Init",
- "Vip",
- "Story",
- "Everyday",
- "Move"
- };
- for (int i = 0; i < array.Length; i++)
- {
- WfScreenChildren component = UTY.GetChildObject(base.gameObject, array[i], false).GetComponent<WfScreenChildren>();
- component.parent_mgr = this;
- children_dic.Add(array[i], component);
- }
- }
- public WfScreenMoveChildren move_screen
- {
- get
- {
- return this.move_screen_;
- }
- }
- public FreeModeItemEveryday.ScnearioType ScnearioItemType
- {
- get
- {
- return this.itemType;
- }
- set
- {
- this.itemType = value;
- }
- }
- public static bool IsFreeMode;
- private Dictionary<string, SceneFreeModeSelectManager.BackupData> backup_data_dic_ = new Dictionary<string, SceneFreeModeSelectManager.BackupData>();
- 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_;
- [SerializeField]
- private FreeModeItemEveryday.ScnearioType itemType;
- private struct BackupData
- {
- public string guid;
- public Dictionary<string, int> maid_flag;
- public Seikeiken seikeiken;
- public HashSet<Feature.Data> feature_set;
- public HashSet<Propensity.Data> propensity_set;
- public Seikeiken init_seikeiken;
- public Relation relation;
- }
- }
|