using System; using System.Collections.Generic; using MaidStatus; using MaidStatus.Old; using UnityEngine; public static class YotogiOldSkillSelectWaitMotion { public static void Create() { if (YotogiOldSkillSelectWaitMotion.data_dic_ != null) { return; } YotogiOldSkillSelectWaitMotion.data_dic_ = new Dictionary>(); using (AFileBase afileBase = GameUty.FileSystemOld.FileOpen("yotogi_skil_select_wait_motion.nei")) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, "file open error[yotogi_skil_select_wait_motion.nei]"); for (int i = 1; i < csvParser.max_cell_y; i++) { int num = 0; string cellAsString = csvParser.GetCellAsString(num++, i); MaidStatus.Personal.Data data = MaidStatus.Personal.GetData(cellAsString); if (!YotogiOldSkillSelectWaitMotion.data_dic_.ContainsKey(data.id)) { YotogiOldSkillSelectWaitMotion.data_dic_.Add(data.id, new List()); } List list = YotogiOldSkillSelectWaitMotion.data_dic_[data.id]; YotogiOldSkillSelectWaitMotion.Data item = default(YotogiOldSkillSelectWaitMotion.Data); if (csvParser.IsCellToExistData(num, i)) { MaidStatus.Old.Relation relation = MaidStatus.Old.Relation.Contact; try { relation = (MaidStatus.Old.Relation)Enum.Parse(typeof(MaidStatus.Old.Relation), csvParser.GetCellAsString(num++, i)); } catch (Exception e) { NDebug.AssertParseError("MaidStatus.Old.Relation", e); } num++; item.relation = relation; item.condition_sp = Condition.Null; } else if (csvParser.IsCellToExistData(++num, i)) { Condition condition_sp = Condition.Null; try { condition_sp = (Condition)Enum.Parse(typeof(Condition), csvParser.GetCellAsString(num++, i)); } catch (Exception e2) { NDebug.AssertParseError("MaidStatus.Old.Condition", e2); } item.relation = MaidStatus.Old.Relation.Contact; item.condition_sp = condition_sp; } else { NDebug.Assert("error.", false); } item.motion_script_file = csvParser.GetCellAsString(num++, i) + ".ks"; item.motion_script_label = csvParser.GetCellAsString(num++, i); item.face_blend_name = csvParser.GetCellAsString(num++, i); item.face_name = csvParser.GetCellAsString(num++, i); list.Add(item); } } } } public static bool ApplyMaidGesture(Maid maid, YotogiOld.Stage stage) { if (YotogiOldSkillSelectWaitMotion.wait_count_ == 0) { YotogiOldSkillSelectWaitMotion.Create(); YotogiOldSkillSelectWaitMotion.Data data = YotogiOldSkillSelectWaitMotion.GetData(maid); ScriptManager scriptMgr = GameMain.Instance.ScriptMgr; scriptMgr.is_motion_blend = false; bool compatibilityMode = scriptMgr.compatibilityMode; scriptMgr.compatibilityMode = true; scriptMgr.LoadMotionScript(0, false, data.motion_script_file, data.motion_script_label, string.Empty, string.Empty, false, true); scriptMgr.compatibilityMode = compatibilityMode; scriptMgr.is_motion_blend = true; maid.FaceAnime(data.face_name, 0f, 0); maid.FaceBlend("無し"); maid.OpenMouth(false); } if (YotogiOldSkillSelectWaitMotion.wait_count_ < 10) { YotogiOldSkillSelectWaitMotion.wait_count_++; return false; } maid.body0.SetMaskMode(TBody.MaskMode.None); maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f); YotogiOldSkillSelectWaitMotion.ApplyEnvSetting(maid, stage); GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 256f * 154f - (float)Screen.width / 2f, 0f, 0f), false); YotogiOldSkillSelectWaitMotion.wait_count_ = 0; return true; } public static void ApplyEnvSetting(Maid maid, YotogiOld.Stage stage) { YotogiOld.StageData stageData = YotogiOld.stage_data_list[stage]; GameMain.Instance.CharacterMgr.SetCharaAllPos(stageData.camera_data.skill_select_chara_pos); GameMain.Instance.CharacterMgr.SetCharaAllRot(stageData.camera_data.skill_select_chara_rotate); CameraMain mainCamera = GameMain.Instance.MainCamera; Transform bone = maid.body0.GetBone("Bip01 Head"); mainCamera.SetTargetPos(bone.position - new Vector3(0.00503452f, 0.02758344f, -0.0292511f), true); mainCamera.SetDistance(1.1f, true); mainCamera.SetAroundAngle(stageData.camera_data.skill_select_camera_rotate, true); GameMain.Instance.MainLight.SetRotation(stageData.camera_data.skill_select_light_pos); GameMain.Instance.MainLight.SetIntensity(stageData.camera_data.skill_select_light_intensity); } public static YotogiOldSkillSelectWaitMotion.Data GetData(Maid maid) { MaidStatus.Old.Status oldStatus = maid.status.OldStatus; NDebug.Assert(YotogiOldSkillSelectWaitMotion.data_dic_.ContainsKey(oldStatus.mainStatus.personal.id), "error."); List list = YotogiOldSkillSelectWaitMotion.data_dic_[oldStatus.mainStatus.personal.id]; YotogiOldSkillSelectWaitMotion.Data result = default(YotogiOldSkillSelectWaitMotion.Data); if (oldStatus.condition == Condition.Null) { MaidStatus.Old.Relation relation = (oldStatus.relation == MaidStatus.Old.Relation.Null) ? MaidStatus.Old.Relation.Trust : oldStatus.relation; for (int i = 0; i < list.Count; i++) { if (list[i].relation == relation) { result = list[i]; break; } } } else { for (int j = 0; j < list.Count; j++) { if (list[j].condition_sp == oldStatus.condition) { result = list[j]; break; } } } NDebug.Assert(!string.IsNullOrEmpty(result.motion_script_file), "error."); return result; } private static Dictionary> data_dic_; private static int wait_count_; public struct Data { public MaidStatus.Old.Relation relation; public Condition condition_sp; public string motion_script_file; public string motion_script_label; public string face_blend_name; public string face_name; } }