using System; using System.Collections.Generic; using Schedule; using UnityEngine; using wf; using Yotogis; public class YotogiOldManager : WfScreenManager { public void Awake() { YotogiOld.CreateData(); YotogiOldManager.instans = this; this.stage_select_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiStageSelectManager", false).GetComponent(); this.skill_select_mgr_ = UTY.GetChildObject(base.gameObject, "SkillSelectManager", false).GetComponent(); this.play_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiPlayManager", false).GetComponent(); this.result_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiResultManager", false).GetComponent(); this.sub_chara_select_mgr_ = UTY.GetChildObject(base.gameObject, "SubCharacterSelectManager", false).GetComponent(); this.null_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiNullManager", false).GetComponent(); this.free_skill_select_mgr_ = UTY.GetChildObject(base.gameObject, "YotogiFreeSkillSelectManager", false).GetComponent(); for (int i = 0; i < this.play_skill_array_.Length; i++) { this.play_skill_array_[i] = new YotogiOldManager.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(); GameMain.Instance.ScriptMgr.compatibilityMode = true; this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0); if (!this.maid_.status.isCompatiblePersonality) { NDebug.Assert("旧夜伽は性格[" + this.maid_.status.personal.drawName + "]で実行する事はできません", false); } this.backup_status_.skill_id_list = new HashSet(); this.CreateBackUpStatus(); GameMain.Instance.ScriptMgr.yotogi_kag.SetYotogiOldManager(this); string b = "SceneYotogiOld"; 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 (this.is_vr_mode_) { Maid man = GameMain.Instance.CharacterMgr.GetMan(0); if (man != null) { man.Visible = true; } this.command_menu_ = Utility.CreatePrefab(null, "SceneYotogi/Yotogi/Prefab/Old/VRUI CommandMenu", true).GetComponent(); this.command_menu_.transform.SetParent(base.gameObject.transform, true); Transform transform = base.transform; while (transform != null && transform.GetComponent() == null) { transform = transform.parent; } this.vr_select_menu_ = VRYotogiOldSelectMenu.Createprefab(transform.gameObject); } 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"]; YotogiOldManager.CallScreenType callScreenType = YotogiOldManager.CallScreenType.Null; try { callScreenType = (YotogiOldManager.CallScreenType)Enum.Parse(typeof(YotogiOldManager.CallScreenType), text); } catch { NDebug.Assert("[" + text + "]を特定できませんでした", false); } if ((callScreenType == YotogiOldManager.CallScreenType.SubCharaSelect || callScreenType == YotogiOldManager.CallScreenType.FreeSkillSelect) && this.adv_kag_.tag_backup.ContainsKey("cancel_label")) { YotogiOldFreeSkillSelectManager yotogiOldFreeSkillSelectManager = this.free_skill_select_mgr_; string cancel_label = this.adv_kag_.tag_backup["cancel_label"]; this.sub_chara_select_mgr_.cancel_label = cancel_label; yotogiOldFreeSkillSelectManager.cancel_label = cancel_label; } string nextLabel = this.adv_kag_.tag_backup["label"]; this.null_mgr_.SetNextLabel(nextLabel); if (callScreenType == YotogiOldManager.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(YotogiOldManager.CallScreenType.FreeSkillSelect.ToString()); } else { this.CallScreen(YotogiOldManager.CallScreenType.StageSelect.ToString()); } } public override void Update() { base.Update(); } public void OnPreFinalize() { this.adv_kag_ = null; this.yotogi_kag_ = null; } public void OnDestroy() { YotogiOldManager.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; } if (GameMain.Instance != null && GameMain.Instance.ScriptMgr != null) { GameMain.Instance.ScriptMgr.compatibilityMode = false; } } public bool TagYotogiCall(KagTagSupport tag_data) { this.adv_kag_.CheckAbsolutelyNecessaryTag(tag_data, "yotogicall", new string[] { "name", "label" }); string text = tag_data.GetTagProperty("name").AsString(); YotogiOldManager.CallScreenType callScreenType = YotogiOldManager.CallScreenType.Null; try { callScreenType = (YotogiOldManager.CallScreenType)Enum.Parse(typeof(YotogiOldManager.CallScreenType), text); } catch { NDebug.Assert("@yotogicall : [" + text + "]を特定できませんでした", false); } if ((callScreenType == YotogiOldManager.CallScreenType.SubCharaSelect || callScreenType == YotogiOldManager.CallScreenType.FreeSkillSelect) && tag_data.IsValid("cancel_label")) { YotogiOldFreeSkillSelectManager yotogiOldFreeSkillSelectManager = this.free_skill_select_mgr_; string cancel_label = tag_data.GetTagProperty("cancel_label").AsString(); this.sub_chara_select_mgr_.cancel_label = cancel_label; yotogiOldFreeSkillSelectManager.cancel_label = cancel_label; } this.null_mgr_.SetNextLabel(tag_data.GetTagProperty("label").AsString()); if (callScreenType == YotogiOldManager.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) { YotogiOld.StageData stageData = YotogiOld.GetStageData(YotogiOldStageSelectManager.StagePrefab); string text = stageData.bgm_file; if (!string.IsNullOrEmpty(stageData.bgm_file_night)) { text = ((!GameMain.Instance.CharacterMgr.status.isDaytime) ? stageData.bgm_file_night : text); } int millisecond = 0; if (tag_data.IsValid("fade")) { millisecond = tag_data.GetTagProperty("fade").AsInteger(); } GameMain.Instance.SoundMgr.PlayBGM(text, 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(YotogiOldManager.CallScreenType.StageSelect.ToString(), this.stage_select_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.SkillSelect.ToString(), this.skill_select_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.Play.ToString(), this.play_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.Result.ToString(), this.result_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.SubCharaSelect.ToString(), this.sub_chara_select_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.FreeSkillSelect.ToString(), this.free_skill_select_mgr_); children_dic.Add(YotogiOldManager.CallScreenType.Null.ToString(), this.null_mgr_); } public void CreateBackUpStatus() { if (this.maid_ == null) { return; } this.backup_status_.param = YotogiOldPlay.Param.Create(this.maid_); this.backup_status_.propensity = new HashSet(); foreach (int item in this.maid_.status.propensitys.GetKeyArray()) { this.backup_status_.propensity.Add(item); } } public void CreateBackUpSkillID() { if (this.maid_ == null) { return; } this.backup_status_.skill_id_list = new HashSet(this.maid_.status.yotogiSkill.oldDatas.GetKeyArray()); } public void SetPlaySkillArray(Skill.Old.Data[] skill_array) { for (int i = 0; i < this.play_skill_array_.Length; i++) { 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) { if (this.is_free_mode || this.is_vr_mode) { this.play_skill_array_[i].skill_pair = YotogiOld.SkillDataPair.CreateBaseDataOnly(this.maid_, skill_array[i]); } else { this.play_skill_array_[i].skill_pair = YotogiOld.SkillDataPair.Create(this.maid_, skill_array[i]); this.play_skill_array_[i].backup_total_exp = this.play_skill_array_[i].skill_pair.param.expSystem.GetTotalExp(); } } else { this.play_skill_array_[i].skill_pair.base_data = null; } } } 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, false, IKCtrlData.IKExecTiming.Normal); stockMaid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal); } } 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, false, IKCtrlData.IKExecTiming.Normal); stockMan.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal); } } string[] array = new string[] { "handitem", "kousoku_upper", "kousoku_lower", "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.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.Old.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.play_skill_array[i].skill_pair.param.playCount += 1U; this.play_skill_array[i].skill_pair.param.expSystem.AddExp(this.play_skill_array[i].exp); string flagName = "夜伽_カテゴリー_実行回数_" + base_data.category.ToString(); this.maid_.status.OldStatus.AddFlag(flagName, 1); } this.play_skill_array[i].exp = 0; } } this.maid_.status.playCountYotogi++; this.maid_.status.selectedYotogiClass.expSystem.AddExp(exp); this.maid_.status.UpdateClassBonusStatus(); this.maid_.status.studyRate -= 50; List learnPossibleSkills = Skill.Old.GetLearnPossibleSkills(this.maid_.status); foreach (Skill.Old.Data data in learnPossibleSkills) { this.maid_.status.yotogiSkill.Add(data.id); } } public void SetRepeatVoiceFile(string file_name, int maid_no) { this.play_mgr_.SetRepeatVoiceFile(file_name, maid_no); } public void OnChangeSeikeiken() { if (!this.is_vr_mode || this.vr_select_menu == null) { return; } this.vr_select_menu.skillSelectMgr.UpdateData(this.maid, YotogiOldManager.select_vr_stage_data.stage, YotogiOldManager.select_vr_stage_spot_no); } public void DebugOnClickCallStageSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiOldManager.CallScreenType.StageSelect.ToString()); } public void DebugOnClickCallSkillSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CreateBackUpStatus(); this.CallScreen(YotogiOldManager.CallScreenType.SkillSelect.ToString()); } public void DebugOnClickCallPlay() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiOldManager.CallScreenType.Play.ToString()); } public void DebugOnClickCallResult() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiOldManager.CallScreenType.Result.ToString()); } public void DebugOnClickCallCharaSelect() { this.null_mgr_.SetNextLabel(string.Empty); this.CallScreen(YotogiOldManager.CallScreenType.SubCharaSelect.ToString()); } public void DebugOnClickNewScene() { this.CallScreen(YotogiOldManager.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.oldDatas.GetKeyArray(); for (int i = 0; i < keyArray.Length; i++) { Skill.Old.Data skillData = YotogiOld.GetSkillData(keyArray[i]); if (!hashSet.Contains(skillData.player_num)) { hashSet.Add(skillData.player_num); list.Add(skillData.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 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; } else { for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); if (stockMaid != null && stockMaid.status.isCompatiblePersonality && !stockMaid.status.OldStatus.isRentalMaid) { 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_ && this.maid.status.isCompatiblePersonality && !this.maid.status.OldStatus.isRentalMaid) { 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.isCompatiblePersonality && !stockMaid.status.OldStatus.isRentalMaid) { list.Add(stockMaid); } } } draw_list.Clear(); draw_list.AddRange(list); } public void CallVRMenu() { if (this.vr_select_menu != null) { this.vr_select_menu.CallFromYotogiScene(YotogiOldManager.select_vr_stage_data, YotogiOldManager.select_vr_stage_spot_no, YotogiOldManager.select_vr_skill_data); } } public void CallVRPlayEnd() { YotogiOldManager.select_vr_skill_data = null; this.play_mgr_.OnClickNext(); } public YotogiOldManager.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 YotogiOldManager.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 YotogiOldCommandMenuOVR command_menu { get { return this.command_menu_; } } public VRYotogiOldSelectMenu vr_select_menu { get { return this.vr_select_menu_; } } public GameObject skill_select_prefab_object { get { return this.free_skill_select_mgr_.skill_select_prefab_object; } } public static YotogiOldManager instans { get; private set; } public YotogiOldPlayManager play_mgr { get { return this.play_mgr_; } } public void AddDebugLog(string text) { } public static YotogiOld.VRSkillData select_vr_skill_data; public static YotogiOld.StageData select_vr_stage_data; public static int select_vr_stage_spot_no; private Maid maid_; private List sub_maid_list_ = new List(); private ADVKagManager adv_kag_; private YotogiKagManager yotogi_kag_; private YotogiNullManager null_mgr_; private YotogiOldStageSelectManager stage_select_mgr_; private YotogiOldSkillSelectManager skill_select_mgr_; private YotogiOldPlayManager play_mgr_; private YotogiOldResultManager result_mgr_; private YotogiOldSubCharacterSelectManager sub_chara_select_mgr_; private bool is_script_call_; private bool is_free_mode_; private int fix_skill_level_; private YotogiOldFreeSkillSelectManager free_skill_select_mgr_; private bool is_vr_mode_; private YotogiOldCommandMenuOVR command_menu_; private VRYotogiOldSelectMenu vr_select_menu_; private YotogiOldManager.PlayingSkillData[] play_skill_array_ = new YotogiOldManager.PlayingSkillData[7]; private YotogiOldManager.BackUpStatus backup_status_ = default(YotogiOldManager.BackUpStatus); public enum CallScreenType { Null, StageSelect, SkillSelect, Play, Result, SubCharaSelect, FreeSkillSelect } public class PlayingSkillData { public YotogiOld.SkillDataPair skill_pair; public int exp; public int backup_total_exp; public bool is_play; } public struct BackUpStatus { public YotogiOldPlay.Param param; public HashSet skill_id_list; public HashSet propensity; } }