using System; using System.Collections.Generic; using MaidStatus; using MaidStatus.CsvData; using Schedule; using UnityEngine; using wf; using Yotogis; public class YotogiManager : WfScreenManager { public void Awake() { YotogiStage.CreateData(); YotogiManager.instans = this; this.play_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiPlayManager", false).GetComponent(); this.skill_select_mgr_ = UTY.GetChildObject(base.gameObject, "SkillSelectManager", false).GetComponent(); this.result_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiResultManager", false).GetComponent(); this.free_skill_select_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiFreeSkillSelectManager", false).GetComponent(); this.stage_select_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiStageSelectManager", false).GetComponent(); this.sub_chara_select_mgr_ = UTY.GetChildObject(base.gameObject, "SubCharacterSelectManager", false).GetComponent(); this.null_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiNullManager", false).GetComponent(); for (int i = 0; i < this.play_skill_array_.Length; i++) { this.play_skill_array_[i] = new YotogiManager.PlayingSkillData(); } this.adv_kag_ = GameMain.Instance.ScriptMgr.adv_kag; this.yotogi_kag_ = GameMain.Instance.ScriptMgr.yotogi_kag; this.adv_kag_.kag.AddTagCallBack("yotogicall", new KagScript.KagTagCallBack(this.TagYotogiCall)); this.yotogi_kag_.kag.AddTagCallBack("playbgmroom", new KagScript.KagTagCallBack(this.TagPlayBGMRoom)); this.yotogi_kag_.kag.AddTagCallBack("controlmask", new KagScript.KagTagCallBack(this.TagControlMask)); this.yotogi_kag_.enabled = false; } public override void Start() { base.Start(); this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0); this.backup_status_.skill_id_list = new HashSet(); this.backup_status_.yotogi_class_list = new HashSet(); this.CreateBackUpStatus(); GameMain.Instance.ScriptMgr.yotogi_kag.SetYotogiManager(this); string b = "SceneYotogi"; if (this.adv_kag_.tag_backup.ContainsKey("free_start")) { this.is_free_mode_ = true; } else { this.is_free_mode_ = false; } this.is_vr_mode_ = this.adv_kag_.tag_backup.ContainsKey("vr_mode"); if (GameMain.Instance.VRMode) { this.command_menu_ = Utility.CreatePrefab(null, "SceneYotogi/Yotogi/Prefab/VRUI CommandMenu", true).GetComponent(); this.command_menu_.transform.SetParent(base.gameObject.transform, true); this.command_menu_.visible = false; } this.is_script_call_ = false; if (this.adv_kag_.tag_backup != null && 0 < this.adv_kag_.tag_backup.Count && this.adv_kag_.tag_backup["name"] == b) { this.is_script_call_ = true; NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("start"), "SceneCallにstartの設定がされていませんでした"); NDebug.Assert(this.adv_kag_.tag_backup.ContainsKey("label"), "SceneCallにlabelの設定がされていませんでした"); string text = this.adv_kag_.tag_backup["start"]; YotogiManager.CallScreenType callScreenType = YotogiManager.CallScreenType.Null; try { callScreenType = (YotogiManager.CallScreenType)Enum.Parse(typeof(YotogiManager.CallScreenType), text); } catch { NDebug.Assert("[" + text + "]を特定できませんでした", false); } if ((callScreenType == YotogiManager.CallScreenType.SubCharaSelect || callScreenType == YotogiManager.CallScreenType.FreeSkillSelect) && this.adv_kag_.tag_backup.ContainsKey("cancel_label")) { YotogiFreeSkillSelectManager yotogiFreeSkillSelectManager = this.free_skill_select_mgr_; string cancel_label = this.adv_kag_.tag_backup["cancel_label"]; this.sub_chara_select_mgr_.cancel_label = cancel_label; yotogiFreeSkillSelectManager.cancel_label = cancel_label; } string nextLabel = this.adv_kag_.tag_backup["label"]; this.null_mgr_.SetNextLabel(nextLabel); if (callScreenType == YotogiManager.CallScreenType.SkillSelect && this.adv_kag_.tag_backup.ContainsKey("edit_label")) { this.skill_select_mgr_.SetEditNextLabel(this.adv_kag_.tag_backup["edit_label"]); } this.CallScreen(text); } else if (this.is_free_mode) { this.CallScreen(YotogiManager.CallScreenType.FreeSkillSelect.ToString()); } else { this.CallScreen(YotogiManager.CallScreenType.StageSelect.ToString()); } } public override void Update() { base.Update(); } public void OnPreFinalize() { this.adv_kag_ = null; this.yotogi_kag_ = null; } public void OnDestroy() { YotogiManager.instans = null; if (this.adv_kag_ != null) { if (this.adv_kag_.kag != null) { this.adv_kag_.kag.RemoveTagCallBack("yotogicall"); } this.adv_kag_ = null; if (this.yotogi_kag_.kag != null) { this.yotogi_kag_.kag.RemoveTagCallBack("playbgmroom"); this.yotogi_kag_.kag.RemoveTagCallBack("controlmask"); } this.yotogi_kag_ = null; } } public bool TagYotogiCall(KagTagSupport tag_data) { this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "yotogicall", new string[] { "name", "label" }); string text = tag_data.GetTagProperty("name").AsString(); YotogiManager.CallScreenType callScreenType = YotogiManager.CallScreenType.Null; try { callScreenType = (YotogiManager.CallScreenType)Enum.Parse(typeof(YotogiManager.CallScreenType), text); } catch { NDebug.Assert("@yotogicall : [" + text + "]を特定できませんでした", false); } if ((callScreenType == YotogiManager.CallScreenType.SubCharaSelect || callScreenType == YotogiManager.CallScreenType.FreeSkillSelect) && tag_data.IsValid("cancel_label")) { YotogiFreeSkillSelectManager yotogiFreeSkillSelectManager = this.free_skill_select_mgr_; string cancel_label = tag_data.GetTagProperty("cancel_label").AsString(); this.sub_chara_select_mgr_.cancel_label = cancel_label; yotogiFreeSkillSelectManager.cancel_label = cancel_label; } this.null_mgr_.SetNextLabel(tag_data.GetTagProperty("label").AsString()); if (callScreenType == YotogiManager.CallScreenType.SkillSelect && tag_data.IsValid("edit_label")) { this.skill_select_mgr_.SetEditNextLabel(tag_data.GetTagProperty("edit_label").AsString()); } this.CallScreen(text); return false; } public bool TagPlayBGMRoom(KagTagSupport tag_data) { List allDatas = YotogiStage.GetAllDatas(false); YotogiStage.Data data = null; foreach (YotogiStage.Data data2 in allDatas) { if (YotogiStageSelectManager.SelectedStage == data2) { data = data2; break; } } if (data == null) { Debug.LogError("@playbgmroomエラー prefab名[" + YotogiStageSelectManager.SelectedStage.drawName + "]から背景データを特定できませんでした"); return false; } int millisecond = 0; if (tag_data.IsValid("fade")) { millisecond = tag_data.GetTagProperty("fade").AsInteger(); } GameMain.Instance.SoundMgr.PlayBGM(data.bgmFileName, GameUty.MillisecondToSecond(millisecond), true); return false; } public bool TagControlMask(KagTagSupport tag_data) { if (base.cur_call_screen_name == "Play" && this.play_mgr_ != null) { this.play_mgr_.SetControlMask(true, false); } return false; } protected override void SettingChildrenList(Dictionary children_dic) { children_dic.Add(YotogiManager.CallScreenType.SkillSelect.ToString(), this.skill_select_mgr_); children_dic.Add(YotogiManager.CallScreenType.Result.ToString(), this.result_mgr_); children_dic.Add(YotogiManager.CallScreenType.FreeSkillSelect.ToString(), this.free_skill_select_mgr_); children_dic.Add(YotogiManager.CallScreenType.StageSelect.ToString(), this.stage_select_mgr_); children_dic.Add(YotogiManager.CallScreenType.Play.ToString(), this.play_mgr_); children_dic.Add(YotogiManager.CallScreenType.SubCharaSelect.ToString(), this.sub_chara_select_mgr_); children_dic.Add(YotogiManager.CallScreenType.Null.ToString(), this.null_mgr_); } public void CreateBackUpStatus() { if (this.maid_ == null) { return; } this.backup_status_.param = YotogiPlay.Param.Create(this.maid_); this.backup_status_.propensity = new HashSet(this.maid_.status.propensitys.GetKeyArray()); } public void CreateBackUpSkillID() { if (this.maid_ == null) { return; } this.backup_status_.skill_id_list = new HashSet(this.maid_.status.yotogiSkill.datas.GetKeyArray()); } public void CreateBackUpYotogiClass() { this.backup_status_.yotogi_class_list = new HashSet(this.maid_.status.yotogiClass.datas.GetKeyArray()); } public void SetPlaySkillArray(KeyValuePair[] skill_array) { this.play_skill_array_ = new YotogiManager.PlayingSkillData[7]; for (int i = 0; i < this.play_skill_array_.Length; i++) { this.play_skill_array_[i] = new YotogiManager.PlayingSkillData(); this.play_skill_array_[i].exp = 0; this.play_skill_array_[i].backup_total_exp = 0; this.play_skill_array_[i].is_play = false; if (i < skill_array.Length) { Skill.Data key = skill_array[i].Key; bool value = skill_array[i].Value; if (this.is_free_mode || this.is_vr_mode) { this.play_skill_array_[i].skill_pair = Yotogi.SkillDataPair.CreateBaseDataOnly(this.maid_, key); } else { this.play_skill_array_[i].skill_pair = Yotogi.SkillDataPair.Create(this.maid_, key); this.play_skill_array_[i].skill_pair.lock_skill_exp = value; this.play_skill_array_[i].backup_total_exp = this.play_skill_array_[i].skill_pair.skill_data.expSystem.GetTotalExp(); } } else { this.play_skill_array_[i].skill_pair.base_data = null; } } } public void AddPlaySkill(Skill.Data skillData) { YotogiManager.PlayingSkillData[] array = this.play_skill_array_; this.play_skill_array_ = new YotogiManager.PlayingSkillData[this.play_skill_array_.Length + 1]; for (int i = 0; i < array.Length; i++) { this.play_skill_array_[i] = array[i]; } YotogiManager.PlayingSkillData playingSkillData = new YotogiManager.PlayingSkillData(); playingSkillData.exp = 0; playingSkillData.backup_total_exp = 0; playingSkillData.is_play = false; playingSkillData.skill_pair = Yotogi.SkillDataPair.Create(this.maid_, skillData); playingSkillData.skill_pair.lock_skill_exp = true; playingSkillData.backup_total_exp = playingSkillData.skill_pair.skill_data.expSystem.GetTotalExp(); this.play_skill_array_[this.play_skill_array_.Length - 1] = playingSkillData; } public bool IsAllCharaBusy() { bool flag = false; CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetMaidCount(); i++) { Maid maid = characterMgr.GetMaid(i); if (maid != null && maid.Visible && maid.IsBusy) { flag = true; break; } } if (flag) { return flag; } for (int j = 0; j < characterMgr.GetManCount(); j++) { Maid man = characterMgr.GetMan(j); if (man != null && man.Visible && man.IsBusy) { flag = true; break; } } return flag; } public void ResetWorld() { GameMain.Instance.BgMgr.DelPrefabFromBgAll(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); if (stockMaid != null && stockMaid.body0 != null && stockMaid.body0.isLoadedBody) { stockMaid.body0.MuneYureL(1f); stockMaid.body0.MuneYureR(1f); stockMaid.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false); stockMaid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false); } } for (int j = 0; j < characterMgr.GetStockManCount(); j++) { Maid stockMan = characterMgr.GetStockMan(j); if (stockMan != null && stockMan.body0 != null && stockMan.body0.isLoadedBody) { stockMan.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false); stockMan.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, 0f, false, false); } } string[] array = new string[] { "handitem", "kousoku_upper", "kousoku_lower", "acchead", "megane", "skirt", "panz", "mizugi", "onepiece", "accanl", "accvag", "KubiScl", "UdeScl", "DouPer", "sintyou", "kata" }; for (int k = 0; k < characterMgr.GetMaidCount(); k++) { Maid maid = characterMgr.GetMaid(k); if (maid != null && maid.Visible) { maid.FaceAnime("通常", 0f, 0); maid.FaceBlend("無し"); maid.OpenMouth(false); maid.DelPrefabAll(); for (int l = 0; l < array.Length; l++) { maid.ResetProp(array[l], true); } maid.AllProcPropSeqStart(); } } for (int m = 0; m < characterMgr.GetManCount(); m++) { Maid man = characterMgr.GetMan(m); if (man != null && man.Visible) { man.DelPrefabAll(); for (int n = 0; n < array.Length; n++) { man.ResetProp(array[n], false); } man.AllProcPropSeqStart(); } } } public void UnVisibleMaidAndMan(bool maid_unvisible, bool man_unvisible) { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; if (man_unvisible) { for (int i = 0; i < characterMgr.GetManCount(); i++) { Maid man = characterMgr.GetMan(i); if (man != null) { man.Visible = false; } } } if (maid_unvisible) { for (int j = 0; j < characterMgr.GetMaidCount(); j++) { Maid maid = characterMgr.GetMaid(j); if (maid != null) { maid.Visible = false; } } } } public void ApplyStatus() { int exp = 0; for (int i = 0; i < this.play_skill_array.Length; i++) { Skill.Data base_data = this.play_skill_array[i].skill_pair.base_data; if (base_data != null) { if (this.play_skill_array[i].is_play && this.maid_.status.yotogiSkill.datas.ContainsKey(base_data.id)) { YotogiSkillData yotogiSkillData = this.maid_.status.yotogiSkill.Get(base_data.id); yotogiSkillData.playCount += 1u; yotogiSkillData.expSystem.AddExp(this.play_skill_array[i].exp); string flagName = "夜伽_カテゴリー_実行回数_" + base_data.category.ToString(); int flag = this.maid_.status.GetFlag(flagName); this.maid_.status.SetFlag(flagName, flag + 1); } this.play_skill_array[i].exp = 0; } } this.maid_.status.playCountYotogi++; if (!this.maid_.status.enabledYotogiStatusLock) { this.maid_.status.selectedYotogiClass.expSystem.AddExp(exp); this.maid_.status.studyRate += -50; } List learnPossibleClassDatas = this.maid.status.yotogiClass.GetLearnPossibleClassDatas(true, AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New); foreach (YotogiClass.Data data in learnPossibleClassDatas) { this.maid.status.yotogiClass.Add(data, true, true); } this.maid.status.UpdateClassBonusStatus(); List learnPossibleSkills = Skill.GetLearnPossibleSkills(this.maid_.status); foreach (Skill.Data data2 in learnPossibleSkills) { this.maid_.status.yotogiSkill.Add(data2.id); } foreach (int id in this.acquired_propensityid_list) { Propensity.Data data3 = Propensity.GetData(id); this.maid_.status.AddPropensity(data3); } } public void SetRepeatVoiceFile(string file_name, int maid_no) { this.play_mgr_.SetRepeatVoiceFile(file_name, maid_no); } public void AddRepeatVoiceFile(string file_name, int maid_no) { this.play_mgr_.AddRepeatVoiceFile(file_name, maid_no); } public void OnChangeSeikeiken() { } public void DebugOnClickCallStageSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiManager.CallScreenType.StageSelect.ToString()); } public void DebugOnClickCallSkillSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CreateBackUpStatus(); this.CallScreen(YotogiManager.CallScreenType.SkillSelect.ToString()); } public void DebugOnClickCallPlay() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiManager.CallScreenType.Play.ToString()); } public void DebugOnClickCallResult() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiManager.CallScreenType.Result.ToString()); } public void DebugOnClickCallCharaSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiManager.CallScreenType.SubCharaSelect.ToString()); } public void DebugOnClickNewScene() { this.CallScreen(YotogiManager.CallScreenType.FreeSkillSelect.ToString()); } public bool IsCallShouldSubCharaSelect() { List list = new List(); HashSet hashSet = new HashSet(); if (this.is_free_mode) { int[] keyArray = this.maid.status.yotogiSkill.datas.GetKeyArray(); for (int i = 0; i < keyArray.Length; i++) { Skill.Data data = Skill.Get(keyArray[i]); if (!hashSet.Contains(data.player_num)) { hashSet.Add(data.player_num); list.Add(data.player_num); } } } else { if (this.play_skill_array == null) { return false; } for (int j = 0; j < this.play_skill_array.Length; j++) { if (this.play_skill_array[j] != null && this.play_skill_array[j].skill_pair.base_data != null) { if (!hashSet.Contains(this.play_skill_array[j].skill_pair.base_data.player_num)) { hashSet.Add(this.play_skill_array[j].skill_pair.base_data.player_num); list.Add(this.play_skill_array[j].skill_pair.base_data.player_num); } } } } list.Sort(); int playPossibleMaidCount = this.GetPlayPossibleMaidCount(); int num = 0; for (int k = 0; k < list.Count; k++) { if (list[k] <= playPossibleMaidCount) { num = list[k]; } } return 1 < num; } public bool inputCBLUpKey { get { return false; } } public bool inputCBLDownKey { get { return false; } } public bool inputCBLRightKey { get { return false; } } public bool inputCBLLeftKey { get { return false; } } public bool inputCBLEnterKey { get { return false; } } public bool inputCBLCancelKey { get { return false; } } public int GetPlayPossibleMaidCount() { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; int num = 0; if (this.is_script_call_ && !this.is_free_mode) { num = ScheduleAPI.GetYotogiMaids(GameMain.Instance.CharacterMgr.status.isDaytime).Count; if (num == 0) { num = 1; } } else { for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); if (stockMaid != null && stockMaid.status.heroineType != HeroineType.Sub) { num++; } } } return num; } public void GetSubMaidList(List draw_list) { if (draw_list == null) { return; } List list = new List(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; if (this.is_script_call_ && !this.is_free_mode) { List yotogiMaids = ScheduleAPI.GetYotogiMaids(GameMain.Instance.CharacterMgr.status.isDaytime); for (int i = 0; i < yotogiMaids.Count; i++) { if (yotogiMaids[i] != this.maid_) { list.Add(yotogiMaids[i]); } } } else { for (int j = 0; j < characterMgr.GetStockMaidCount(); j++) { Maid stockMaid = characterMgr.GetStockMaid(j); if (stockMaid != null && this.maid_ != stockMaid && stockMaid.status.heroineType != HeroineType.Sub) { list.Add(stockMaid); } } } draw_list.Clear(); draw_list.AddRange(list); } public YotogiManager.BackUpStatus GetBackUpStatus() { return this.backup_status_; } public Maid maid { get { return this.maid_; } } public int skill_select_max_hp { get { return this.maid_.status.maxHp; } } public YotogiManager.PlayingSkillData[] play_skill_array { get { return this.play_skill_array_; } } public YotogiNullManager null_mgr { get { return this.null_mgr_; } } public YotogiKagManager yotogi_kag { get { return this.yotogi_kag_; } } public bool is_free_mode { get { return this.is_free_mode_; } set { this.is_free_mode_ = value; } } public int fix_skill_level { get { return this.fix_skill_level_; } set { this.fix_skill_level_ = wf.Math.RoundMinMax(value, 0, 3); } } public bool is_vr_mode { get { return this.is_vr_mode_; } } public YotogiCommandMenuOVR command_menu { get { return this.command_menu_; } } public GameObject skill_select_prefab_object { get { return this.free_skill_select_mgr_.skill_select_prefab_object; } } public static YotogiManager instans { get; private set; } public YotogiPlayManager play_mgr { get { return this.play_mgr_; } } public void AddDebugLog(string text) { } public HashSet acquired_propensityid_list = new HashSet(); private Maid maid_; private List sub_maid_list_ = new List(); private ADVKagManager adv_kag_; private YotogiKagManager yotogi_kag_; private YotogiNullManager null_mgr_; private YotogiStageSelectManager stage_select_mgr_; private YotogiSkillSelectManager skill_select_mgr_; private YotogiPlayManager play_mgr_; private YotogiResultManager result_mgr_; private YotogiSubCharacterSelectManager sub_chara_select_mgr_; private bool is_script_call_; private bool is_free_mode_; private int fix_skill_level_; private YotogiFreeSkillSelectManager free_skill_select_mgr_; private bool is_vr_mode_; private YotogiCommandMenuOVR command_menu_; private YotogiManager.PlayingSkillData[] play_skill_array_ = new YotogiManager.PlayingSkillData[7]; private YotogiManager.BackUpStatus backup_status_ = default(YotogiManager.BackUpStatus); public enum CallScreenType { Null, StageSelect, SkillSelect, Play, Result, SubCharaSelect, FreeSkillSelect } public class PlayingSkillData { public Yotogi.SkillDataPair skill_pair = new Yotogi.SkillDataPair(); public int exp; public int backup_total_exp; public bool is_play; } public struct BackUpStatus { public YotogiPlay.Param param; public HashSet skill_id_list; public HashSet propensity; public HashSet yotogi_class_list; } }