123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- 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<int, List<YotogiOldSkillSelectWaitMotion.Data>>();
- 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<YotogiOldSkillSelectWaitMotion.Data>());
- }
- List<YotogiOldSkillSelectWaitMotion.Data> 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<YotogiOldSkillSelectWaitMotion.Data> 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<int, List<YotogiOldSkillSelectWaitMotion.Data>> 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;
- }
- }
|