using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using MaidStatus; using UnityEngine; using XVI.AniLipSync; public class Maid : MonoBehaviour { public bool Visible { get { return this.m_visible; } set { GameObject gameObject = base.gameObject; this.m_visible = value; gameObject.SetActive(value); } } public MaidParts Parts { get { return this.m_Parts; } } public Status status { get { return this.m_Status; } } public AudioSourceMgr AudioMan { get { return (!(this.body0 != null)) ? null : this.body0.AudioMan; } } public bool IsBusy { get { return this.IsAllProcPropBusy && this.Visible; } } public bool IsAllProcPropBusy { get { return this.boAllProcPropBUSY; } } public FullBodyIKCtrl IKCtrl { get { return this.body0.IKCtrl; } } public int ActiveSlotNo { get { return this.m_nActiveSlotNo; } set { this.m_nActiveSlotNo = value; } } public Color ManColor { get { return this.m_colMan; } set { this.m_colMan = value; } } public int VoicePitch { get { return this.m_nVoicePitch; } set { if (this.body0 != null) { TBody tbody = this.body0; this.m_nVoicePitch = value; tbody.SetVoicePitch(value); } } } public static void UpdateMaidRanking() { if (!GameMain.Instance.CharacterMgr.status.isAvailableRanking) { Debug.Log("メイドランキングは未開放なので更新されませんでした"); return; } List> list = new List>(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); if (!(stockMaid == null)) { stockMaid.status.popularRank = 0; long key = (long)stockMaid.status.evaluation + stockMaid.status.sales; list.Add(new KeyValuePair(key, stockMaid)); } } list.Sort(delegate(KeyValuePair a, KeyValuePair b) { long num3 = b.Key - a.Key; return (num3 != 0L) ? ((0L >= num3) ? -1 : 1) : 0; }); long num = -1L; int num2 = 0; foreach (KeyValuePair keyValuePair in list) { if (keyValuePair.Key == 0L) { break; } if (keyValuePair.Key != num) { num2++; } keyValuePair.Value.status.popularRank = num2; num = keyValuePair.Key; } } private void Awake() { } public void OnMouseUp() { if (this.IsBusy || this.body0 == null || this.onMouseUpEvent == null) { return; } this.onMouseUpEvent(this); } public void Initialize(string f_strTypeName, bool f_bMan) { this.m_Parts = base.gameObject.AddComponent(); this.m_goOffset = new GameObject("Offset"); this.m_goOffset.transform.parent = base.gameObject.transform; this.TypeName = f_strTypeName; this.boMAN = f_bMan; this.boOffsetY = true; this.body0 = base.gameObject.AddComponent(); this.body0.Init(this, f_bMan); int length = Enum.GetValues(typeof(MPN)).Length; this.m_aryMaidProp = new MaidProp[length]; List list = Maid.CreateInitMaidPropList(); foreach (MaidProp mp in list) { this.AddProp(mp); } this.InitializeStatus(); this.m_Parts.Initialize(base.gameObject, this); this.DelPrefabAll(); if (this.boMAN) { this.SetUpModel("_I_man.menu"); } else { this.SetUpModel("_I_default.menu"); if (Product.isPublic) { this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false); this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false); } } } public void InitializeStatus() { if (this.m_Status == null) { this.m_Status = new Status(); this.m_Status.Initialize(this); } } public static List CreateInitMaidPropList() { return new List { Maid.CreateProp(0, int.MaxValue, 0, MPN.null_mpn, 0), Maid.CreateProp(0, 130, 10, MPN.MuneL, 1), Maid.CreateProp(0, 100, 0, MPN.MuneS, 1), Maid.CreateProp(0, 130, 10, MPN.MuneTare, 1), Maid.CreateProp(0, 100, 40, MPN.RegFat, 1), Maid.CreateProp(0, 100, 20, MPN.ArmL, 1), Maid.CreateProp(0, 100, 20, MPN.Hara, 1), Maid.CreateProp(0, 100, 40, MPN.RegMeet, 1), Maid.CreateProp(20, 80, 50, MPN.KubiScl, 2), Maid.CreateProp(0, 100, 50, MPN.UdeScl, 2), Maid.CreateProp(0, 100, 50, MPN.EyeScl, 2), Maid.CreateProp(0, 100, 50, MPN.EyeSclX, 2), Maid.CreateProp(0, 100, 50, MPN.EyeSclY, 2), Maid.CreateProp(0, 100, 50, MPN.EyePosX, 2), Maid.CreateProp(0, 100, 50, MPN.EyePosY, 2), Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2), Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2), Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2), Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2), Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2), Maid.CreateProp(0, 1, 0, MPN.EarNone, 2), Maid.CreateProp(0, 100, 0, MPN.EarElf, 2), Maid.CreateProp(0, 100, 50, MPN.EarRot, 2), Maid.CreateProp(0, 100, 50, MPN.EarScl, 2), Maid.CreateProp(0, 100, 50, MPN.NosePos, 2), Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2), Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2), Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2), Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2), Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2), Maid.CreateProp(0, 100, 50, MPN.MayuX, 2), Maid.CreateProp(0, 100, 50, MPN.MayuY, 2), Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2), Maid.CreateProp(0, 100, 50, MPN.HeadX, 2), Maid.CreateProp(0, 100, 50, MPN.HeadY, 2), Maid.CreateProp(20, 80, 50, MPN.DouPer, 2), Maid.CreateProp(20, 80, 50, MPN.sintyou, 2), Maid.CreateProp(0, 100, 50, MPN.koshi, 2), Maid.CreateProp(0, 100, 50, MPN.kata, 2), Maid.CreateProp(0, 100, 50, MPN.west, 2), Maid.CreateProp(0, 100, 10, MPN.MuneUpDown, 2), Maid.CreateProp(0, 100, 40, MPN.MuneYori, 2), Maid.CreateProp(0, 100, 50, MPN.MuneYawaraka, 2), Maid.CreateProp(string.Empty, MPN.body, 3), Maid.CreateProp(string.Empty, MPN.head, 3), Maid.CreateProp(string.Empty, MPN.hairf, 3), Maid.CreateProp(string.Empty, MPN.hairr, 3), Maid.CreateProp(string.Empty, MPN.hairt, 3), Maid.CreateProp(string.Empty, MPN.hairs, 3), Maid.CreateProp(string.Empty, MPN.wear, 3), Maid.CreateProp(string.Empty, MPN.skirt, 3), Maid.CreateProp(string.Empty, MPN.mizugi, 3), Maid.CreateProp(string.Empty, MPN.bra, 3), Maid.CreateProp(string.Empty, MPN.panz, 3), Maid.CreateProp(string.Empty, MPN.stkg, 3), Maid.CreateProp(string.Empty, MPN.shoes, 3), Maid.CreateProp(string.Empty, MPN.headset, 3), Maid.CreateProp(string.Empty, MPN.glove, 3), Maid.CreateProp(string.Empty, MPN.acchead, 3), Maid.CreateProp(string.Empty, MPN.hairaho, 3), Maid.CreateProp(string.Empty, MPN.accha, 3), Maid.CreateProp(string.Empty, MPN.acchana, 3), Maid.CreateProp(string.Empty, MPN.acckamisub, 3), Maid.CreateProp(string.Empty, MPN.acckami, 3), Maid.CreateProp(string.Empty, MPN.accmimi, 3), Maid.CreateProp(string.Empty, MPN.accnip, 3), Maid.CreateProp(string.Empty, MPN.acckubi, 3), Maid.CreateProp(string.Empty, MPN.acckubiwa, 3), Maid.CreateProp(string.Empty, MPN.accheso, 3), Maid.CreateProp(string.Empty, MPN.accude, 3), Maid.CreateProp(string.Empty, MPN.accashi, 3), Maid.CreateProp(string.Empty, MPN.accsenaka, 3), Maid.CreateProp(string.Empty, MPN.accshippo, 3), Maid.CreateProp(string.Empty, MPN.accanl, 3), Maid.CreateProp(string.Empty, MPN.accvag, 3), Maid.CreateProp(string.Empty, MPN.megane, 3), Maid.CreateProp(string.Empty, MPN.accxxx, 3), Maid.CreateProp(string.Empty, MPN.handitem, 3), Maid.CreateProp(string.Empty, MPN.acchat, 3), Maid.CreateProp(string.Empty, MPN.haircolor, 3), Maid.CreateProp(string.Empty, MPN.skin, 3), Maid.CreateProp(string.Empty, MPN.acctatoo, 3), Maid.CreateProp(string.Empty, MPN.accnail, 3), Maid.CreateProp(string.Empty, MPN.underhair, 3), Maid.CreateProp(string.Empty, MPN.hokuro, 3), Maid.CreateProp(string.Empty, MPN.mayu, 3), Maid.CreateProp(string.Empty, MPN.lip, 3), Maid.CreateProp(string.Empty, MPN.eye, 3), Maid.CreateProp(string.Empty, MPN.eye_hi, 3), Maid.CreateProp(string.Empty, MPN.eye_hi_r, 3), Maid.CreateProp(string.Empty, MPN.chikubi, 3), Maid.CreateProp(string.Empty, MPN.chikubicolor, 3), Maid.CreateProp(string.Empty, MPN.eyewhite, 3), Maid.CreateProp(string.Empty, MPN.nose, 3), Maid.CreateProp(string.Empty, MPN.facegloss, 3), Maid.CreateProp(string.Empty, MPN.moza, 3), Maid.CreateProp(string.Empty, MPN.onepiece, 3), Maid.CreateProp(string.Empty, MPN.set_maidwear, 3), Maid.CreateProp(string.Empty, MPN.set_mywear, 3), Maid.CreateProp(string.Empty, MPN.set_underwear, 3), Maid.CreateProp(string.Empty, MPN.set_body, 3), Maid.CreateProp(string.Empty, MPN.folder_eye, 3), Maid.CreateProp(string.Empty, MPN.folder_mayu, 3), Maid.CreateProp(string.Empty, MPN.folder_underhair, 3), Maid.CreateProp(string.Empty, MPN.folder_skin, 3), Maid.CreateProp(string.Empty, MPN.folder_eyewhite, 3), Maid.CreateProp(string.Empty, MPN.kousoku_upper, 3), Maid.CreateProp(string.Empty, MPN.kousoku_lower, 3), Maid.CreateProp(string.Empty, MPN.seieki_naka, 3), Maid.CreateProp(string.Empty, MPN.seieki_hara, 3), Maid.CreateProp(string.Empty, MPN.seieki_face, 3), Maid.CreateProp(string.Empty, MPN.seieki_mune, 3), Maid.CreateProp(string.Empty, MPN.seieki_hip, 3), Maid.CreateProp(string.Empty, MPN.seieki_ude, 3), Maid.CreateProp(string.Empty, MPN.seieki_ashi, 3) }; } public void Uninit() { this.Visible = false; this.boOffsetY = true; this.DelPrefabAll(); Debug.Log("Uninit " + this.status.firstName); this.body0.UnInit(); } private void OnDestroy() { this.DelPrefabAll(); this.Uninit(); } public void ManColorUpdate() { if (this.body0 != null) { this.body0.ManColorUpdate(); } } public void ClearPropValueDefault() { foreach (MaidProp maidProp in this.m_aryMaidProp) { if (!(maidProp.name == "body")) { maidProp.temp_value = (maidProp.value = maidProp.value_Default); } } } public MaidProp GetProp(string tag) { return this.m_dicMaidProp[tag]; } public MaidProp GetPropLower(string tagLower) { return (MaidProp)this.m_hashMaidPropLower[tagLower]; } public MaidProp GetProp(MPN mpn) { return this.m_aryMaidProp[(int)mpn]; } public static MaidProp CreateProp(string f_strDefFileName, MPN mpn, int type) { NDebug.Assert(type == 3, "プロパティオブジェクトのタイプが不正です。"); MaidProp maidProp = new MaidProp(); maidProp.name = mpn.ToString(); maidProp.type = type; maidProp.listSubProp = null; maidProp.strFileName = f_strDefFileName; if (string.IsNullOrEmpty(maidProp.strFileName)) { string strFileName = maidProp.strFileName; if (CM3.dicDelItem.TryGetValue(mpn, out strFileName)) { maidProp.strFileName = strFileName; } } maidProp.nFileNameRID = maidProp.strFileName.ToLower().GetHashCode(); maidProp.boDut = true; maidProp.boTempDut = false; maidProp.idx = (int)mpn; return maidProp; } public static MaidProp CreateProp(int minval, int maxval, int defval, MPN mpn, int type) { NDebug.Assert(type == 0 || type == 1 || type == 2, "プロパティオブジェクトのタイプが不正です。"); MaidProp maidProp = new MaidProp(); maidProp.name = mpn.ToString(); maidProp.type = type; maidProp.min = minval; maidProp.max = maxval; if (defval < minval) { defval = minval; } if (defval > maxval) { defval = maxval; } maidProp.value_Default = defval; maidProp.listSubProp = null; maidProp.strFileName = string.Empty; maidProp.temp_value = (maidProp.value = defval); maidProp.idx = (int)mpn; maidProp.boDut = true; maidProp.boTempDut = false; return maidProp; } private void AddProp(MaidProp mp) { MPN idx = (MPN)mp.idx; this.m_dicMaidProp[idx.ToString()] = mp; this.m_aryMaidProp[(int)idx] = mp; this.m_hashMaidPropLower[idx.ToString().ToLower()] = mp; } private void AddProp(string f_strDefFileName, MPN mpn, int type) { this.AddProp(Maid.CreateProp(f_strDefFileName, mpn, type)); } private void AddProp(int minval, int maxval, int defval, MPN mpn, int type) { this.AddProp(Maid.CreateProp(minval, maxval, defval, mpn, type)); } public void Prop_AddValue(string tag, int val) { NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。"); this.Prop_AddValue(this.m_dicMaidProp[tag].idx, val); } public void Prop_AddValue(int idx, int val) { val += this.m_aryMaidProp[idx].value; if (this.m_aryMaidProp[idx].min > val) { val = this.m_aryMaidProp[idx].min; } if (this.m_aryMaidProp[idx].max < val) { val = this.m_aryMaidProp[idx].max; } if (this.m_aryMaidProp[idx].value_LinkMAX != 0 && this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value < val) { val = this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value; } if (this.m_aryMaidProp[idx].value != val) { this.m_aryMaidProp[idx].value = val; } this.m_aryMaidProp[idx].boDut = true; this.m_aryMaidProp[idx].boTempDut = false; } public void SetProp(string tag, int val, bool f_bTemp = false) { MPN idx = MPN.null_mpn; try { idx = (MPN)Enum.Parse(typeof(MPN), tag); } catch { NDebug.Assert("指定されたプロパティ名がありません。" + tag, false); } this.SetProp(idx, val, f_bTemp); } public void SetProp(MPN idx, int val, bool f_bTemp = false) { NDebug.Assert(idx != MPN.null_mpn, "指定されたプロパティ名がありません。" + base.tag); MaidProp maidProp = this.m_aryMaidProp[(int)idx]; if (maidProp.min > val) { val = maidProp.min; } if (maidProp.max < val) { val = maidProp.max; } if (f_bTemp) { maidProp.temp_value = val; maidProp.boTempDut = true; } else { maidProp.value = val; maidProp.boDut = true; maidProp.boTempDut = false; } } public void SetProp(string tag, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false) { NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。" + tag); MaidProp mp = this.m_dicMaidProp[tag]; this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale); } public void SetProp(MPN idx, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false) { MaidProp mp = this.m_aryMaidProp[(int)idx]; this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale); } public void SetProp(MaidProp mps) { bool flag = false; bool flag2 = false; bool flag3 = false; MaidProp prop = this.GetProp((MPN)mps.idx); bool flag4 = prop.m_dicTBodySkinPos.Count != 0; flag = (prop.m_dicTBodyAttachPos.Count != 0); flag2 = (prop.m_dicMaterialProp.Count != 0); flag3 = (prop.m_dicBoneLength.Count != 0); if (mps.idx != 43) { this.SetProp((MPN)mps.idx, mps.strFileName, mps.nFileNameRID, false, false); } if (flag4 || mps.m_dicTBodySkinPos.Count != 0) { MaidProp prop2 = this.GetProp((MPN)mps.idx); prop2.m_dicTBodySkinPos.Clear(); foreach (KeyValuePair> keyValuePair in mps.m_dicTBodySkinPos) { prop2.m_dicTBodySkinPos[keyValuePair.Key] = new KeyValuePair(keyValuePair.Value.Key, new BoneAttachPos(keyValuePair.Value.Value)); } if (mps.idx != 43) { prop2.boDut = true; } prop2.boAdjustDut = true; } if (flag || mps.m_dicTBodyAttachPos.Count != 0) { MaidProp prop3 = this.GetProp((MPN)mps.idx); prop3.m_dicTBodyAttachPos.Clear(); foreach (KeyValuePair>> keyValuePair2 in mps.m_dicTBodyAttachPos) { Dictionary> dictionary = new Dictionary>(); foreach (KeyValuePair> keyValuePair3 in keyValuePair2.Value) { dictionary[keyValuePair3.Key] = new KeyValuePair(keyValuePair3.Value.Key, new VtxAttachPos(keyValuePair3.Value.Value)); } prop3.m_dicTBodyAttachPos[keyValuePair2.Key] = dictionary; } if (mps.idx != 43) { prop3.boDut = true; } prop3.boAdjustDut = true; } if (flag2 || mps.m_dicMaterialProp.Count != 0) { MaidProp prop4 = this.GetProp((MPN)mps.idx); prop4.m_dicMaterialProp.Clear(); foreach (KeyValuePair> keyValuePair4 in mps.m_dicMaterialProp) { prop4.m_dicMaterialProp[keyValuePair4.Key] = new KeyValuePair(keyValuePair4.Value.Key, new MatPropSave(keyValuePair4.Value.Value)); } if (mps.idx != 43) { prop4.boDut = true; } prop4.boAdjustDut = true; } if (flag3 || mps.m_dicBoneLength.Count != 0) { MaidProp prop5 = this.GetProp((MPN)mps.idx); prop5.m_dicBoneLength.Clear(); foreach (KeyValuePair>> keyValuePair5 in mps.m_dicBoneLength) { Dictionary dictionary2 = new Dictionary(); foreach (KeyValuePair keyValuePair6 in keyValuePair5.Value.Value) { dictionary2[keyValuePair6.Key] = keyValuePair6.Value; } prop5.m_dicBoneLength[keyValuePair5.Key] = new KeyValuePair>(keyValuePair5.Value.Key, dictionary2); } if (mps.idx != 43) { prop5.boDut = true; } prop5.boAdjustDut = true; } } private void SetProp(MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale = false) { if (f_bTemp) { if (filename != mp.strTempFileName) { mp.boTempDut = true; mp.strTempFileName = filename; mp.bNoScale = f_bNoScale; if (f_nFileNameRID == 0) { mp.nTempFileNameRID = filename.ToLower().GetHashCode(); } else { mp.nTempFileNameRID = f_nFileNameRID; } if (Product.isPublic) { if (mp.idx == 71 && filename.ToLower() != "pants030_i_.menu") { this.SetProp(mp, "pants030_i_.menu", 0, f_bTemp, f_bNoScale); return; } if (mp.idx == 70 && filename.ToLower() != "bra030_i_.menu") { this.SetProp(mp, "bra030_i_.menu", 0, f_bTemp, f_bNoScale); return; } } } } else { if (mp.strFileName != filename || mp.bSubDut || (97 <= mp.idx && mp.idx <= 100)) { mp.boDut = true; } mp.strFileName = filename; mp.bNoScale = f_bNoScale; if (f_nFileNameRID == 0) { mp.nFileNameRID = filename.ToLower().GetHashCode(); } else { mp.nFileNameRID = f_nFileNameRID; } mp.strTempFileName = string.Empty; mp.nTempFileNameRID = 0; if (mp.listSubProp != null) { mp.listSubProp.Clear(); } mp.bSubDut = false; mp.m_dicTBodySkinPos.Clear(); mp.m_dicTBodyAttachPos.Clear(); mp.m_dicMaterialProp.Clear(); mp.m_dicBoneLength.Clear(); if (Product.isPublic) { f_nFileNameRID = mp.nFileNameRID; if (filename.Contains("_del")) { f_nFileNameRID = 0; } if (mp.idx == 96) { this.m_strBefOnepiceFileName = filename; this.m_nBefOnepiceRID = f_nFileNameRID; if (f_nFileNameRID != 0) { MaidProp prop = this.GetProp(MPN.wear); if (!prop.strFileName.Contains("_del")) { this.m_strBefWearFileName = prop.strFileName; this.m_nBefWearRID = prop.nFileNameRID; } MaidProp prop2 = this.GetProp(MPN.skirt); if (!prop2.strFileName.Contains("_del")) { this.m_strBefSkirtFileName = prop2.strFileName; this.m_nBefSkirtRID = prop2.nFileNameRID; } } } else if (mp.idx == 67) { this.m_strBefWearFileName = filename; this.m_nBefWearRID = f_nFileNameRID; if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0) { this.m_nBefOnepiceRID = 0; if (this.m_nBefSkirtRID != 0) { this.SetProp(MPN.skirt, this.m_strBefSkirtFileName, this.m_nBefSkirtRID, false, false); } } } else if (mp.idx == 68) { this.m_strBefSkirtFileName = filename; this.m_nBefSkirtRID = f_nFileNameRID; if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0) { this.m_nBefOnepiceRID = 0; if (this.m_nBefWearRID != 0) { this.SetProp(MPN.wear, this.m_strBefWearFileName, this.m_nBefWearRID, false, false); } } } else { if (mp.idx == 71 && filename.ToLower() != "pants030_i_.menu") { this.SetProp(mp, "pants030_i_.menu", 0, f_bTemp, f_bNoScale); return; } if (mp.idx == 70 && filename.ToLower() != "bra030_i_.menu") { this.SetProp(mp, "bra030_i_.menu", 0, f_bTemp, f_bNoScale); return; } } } } if (mp.boTempDut && mp.boDut) { string[] array = new string[6]; array[0] = "SetProp:本元とTempのどうちらにも更新フラグが付いています。"; int num = 1; MPN idx = (MPN)mp.idx; array[num] = idx.ToString(); array[2] = " 元="; array[3] = mp.strFileName; array[4] = " Temp="; array[5] = mp.strTempFileName; Debug.LogWarning(string.Concat(array)); } } public bool DelProp(MPN idx, bool f_bTemp = false) { string empty = string.Empty; if (CM3.dicDelItem.TryGetValue(idx, out empty)) { this.SetProp(idx, empty, 0, f_bTemp, false); return true; } return false; } public void SetSubProp(MPN idx, int subno, string filename, int f_nFileNameRID = 0) { MaidProp maidProp = this.m_aryMaidProp[(int)idx]; if (maidProp.listSubProp == null) { maidProp.listSubProp = new List(); } if (maidProp.listSubProp.Count() < subno + 1) { int num = maidProp.listSubProp.Count(); for (int i = num; i < subno + 1; i++) { maidProp.listSubProp.Add(null); } } SubProp subProp = maidProp.listSubProp[subno]; if (subProp == null) { SubProp subProp2 = new SubProp(); maidProp.listSubProp[subno] = subProp2; subProp = subProp2; } subProp.bDut = true; subProp.strFileName = filename; if (f_nFileNameRID == 0) { subProp.nFileNameRID = filename.ToLower().GetHashCode(); } else { subProp.nFileNameRID = f_nFileNameRID; } maidProp.bSubDut = true; } public SubProp GetSubProp(MPN idx, int subno) { MaidProp maidProp = this.m_aryMaidProp[(int)idx]; SubProp result = null; if (maidProp.listSubProp != null && subno < maidProp.listSubProp.Count) { result = maidProp.listSubProp[subno]; } return result; } public void DelSubProp(MPN idx, int subno = -1) { MaidProp maidProp = this.m_aryMaidProp[(int)idx]; if (maidProp.listSubProp != null) { if (subno == -1) { maidProp.listSubProp.Clear(); } else if (maidProp.listSubProp.Count > subno) { SubProp subProp = maidProp.listSubProp[subno]; if (subProp != null) { subProp.strFileName = string.Empty; subProp.nFileNameRID = 0; subProp.bDut = false; } } } maidProp.bSubDut = true; } public void ResetProp(string mpn, bool force_reset = false) { NDebug.Assert(this.m_dicMaidProp.ContainsKey(mpn), "指定されたプロパティ名がありません。" + base.tag); MaidProp mp = this.m_dicMaidProp[mpn]; this.ResetProp(mp, force_reset); } public void ResetProp(MPN idx, bool force_reset = false) { MaidProp mp = this.m_aryMaidProp[(int)idx]; this.ResetProp(mp, force_reset); } public void ResetProp(MaidProp mp, bool force_reset = false) { if ((mp.nTempFileNameRID != 0 && mp.nFileNameRID != mp.nTempFileNameRID) || mp.temp_value != mp.value || force_reset) { mp.boDut = true; mp.strTempFileName = string.Empty; mp.nTempFileNameRID = 0; mp.temp_value = 0; mp.boTempDut = false; } } public void ItemChangeTemp(string mpn, string name) { MaidProp prop = this.GetProp(mpn); SortedDictionary sortedDictionary; string filename; if (prop.nFileNameRID != 0 && Menu.m_dicResourceRef.TryGetValue(prop.nFileNameRID, out sortedDictionary) && sortedDictionary.TryGetValue(name, out filename)) { this.SetProp(mpn, filename, 0, true, false); } } public bool IsItemChange(string mpn, string name) { MaidProp prop = this.GetProp(mpn); return prop.nFileNameRID != 0 && Menu.m_dicResourceRef.ContainsKey(prop.nFileNameRID) && Menu.m_dicResourceRef[prop.nFileNameRID].ContainsKey(name) && this.GetProp(mpn).strTempFileName == Menu.m_dicResourceRef[prop.nFileNameRID][name]; } public bool IsItemChangeEnabled(string mpn, string name) { MaidProp prop = this.GetProp(mpn); return prop.nFileNameRID != 0 && Menu.m_dicResourceRef.ContainsKey(prop.nFileNameRID) && Menu.m_dicResourceRef[prop.nFileNameRID].ContainsKey(name); } public void DutPropAll() { for (int i = 0; i < this.m_aryMaidProp.Length; i++) { MaidProp maidProp = this.m_aryMaidProp[i]; maidProp.boDut = true; if (maidProp.listSubProp != null) { for (int j = 0; j < maidProp.listSubProp.Count; j++) { if (maidProp.listSubProp[j] != null) { maidProp.listSubProp[j].bDut = true; } } } } } public void SetUpModel(string f_strPresetMenuFileName) { Menu.ProcScript(this, f_strPresetMenuFileName, false, null); this.body0.FixMaskFlag(); this.body0.FixVisibleFlag(false); this.AllProcPropSeqStart(); if (!this.boMAN) { } } public void AllProcPropSeqStart() { this.boAllProcPropBUSY = true; this.boModelChg = false; this.AllProcProp2Fase = 0; this.AllProcProp2Cnt = 0; } private void AllProcPropSeq() { if (this.AllProcProp2Fase == 0) { while (this.AllProcProp2Fase == 0) { MaidProp maidProp = this.m_aryMaidProp[this.AllProcProp2Cnt]; this.AllProcProp2Cnt++; if (this.m_aryMaidProp.Length == this.AllProcProp2Cnt) { this.AllProcProp2Cnt = 0; if (Array.Find(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null) { this.AllProcProp2Fase++; } } if (maidProp == null) { string str = "AllProcProp2_Proc MPNがNULLです。"; MPN allProcProp2Cnt = (MPN)this.AllProcProp2Cnt; NDebug.Assert(str + allProcProp2Cnt.ToString(), false); } if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[maidProp.name])) { if (!this.boModelChg) { this.body0.FixVisibleFlag(true); this.boModelChg = true; } if (this.boMAN && maidProp.idx == 43) { for (int i = 44; i <= 100; i++) { this.GetProp((MPN)i).boDut = true; } this.GetProp(MPN.moza).boDut = true; } else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48) { this.GetProp(MPN.haircolor).boDut = true; } else if (maidProp.idx == 45) { MPN[] array = new MPN[] { MPN.skin, MPN.eye, MPN.mayu, MPN.eye_hi, MPN.eye_hi_r, MPN.EyeClose, MPN.EarNone, MPN.EarElf, MPN.EarRot, MPN.EarScl, MPN.NosePos, MPN.NoseScl, MPN.FaceShape, MPN.FaceShapeSlim, MPN.MayuShapeIn, MPN.MayuShapeOut, MPN.MayuX, MPN.MayuY, MPN.MayuRot, MPN.eye_hi_r, MPN.eyewhite, MPN.nose, MPN.facegloss, MPN.lip }; foreach (MPN mpn in array) { this.GetProp(mpn).boDut = true; } } else if (maidProp.idx == 52) { MaidProp prop = this.GetProp(MPN.acctatoo); prop.boDut = true; if (prop.listSubProp != null) { for (int k = 0; k < prop.listSubProp.Count; k++) { if (prop.listSubProp[k] != null) { prop.listSubProp[k].bDut = true; } } } prop = this.GetProp(MPN.hokuro); prop.boDut = true; if (prop.listSubProp != null) { for (int l = 0; l < prop.listSubProp.Count; l++) { if (prop.listSubProp[l] != null) { prop.listSubProp[l].bDut = true; } } } this.GetProp(MPN.lip).boDut = true; this.GetProp(MPN.nose).boDut = true; this.GetProp(MPN.facegloss).boDut = true; } break; } } } else if (this.AllProcProp2Fase == 1) { this.AllProcProp2Fase++; } else if (this.AllProcProp2Fase == 2) { bool flag = false; foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values) { if (maidProp2.type != 3) { flag |= this.ProcItem(maidProp2); } } if (flag) { this.body0.ItemScaleReset(); } this.AllProcProp2Fase++; } else if (this.AllProcProp2Fase == 3) { if (this.boModelChg) { this.body0.MulTexProc(); this.body0.FixMaskFlag(); this.body0.FixVisibleFlag(false); } this.AllProcProp2Fase++; } else if (this.AllProcProp2Fase == 4) { this.ProcSSParam(); this.AllProcProp2Fase++; } else if (this.AllProcProp2Fase == 5) { this.boAllProcPropBUSY = false; } } public void AllProcProp() { if (Product.isPublic) { this.AllProcPropSeqStart(); while (this.boAllProcPropBUSY) { this.AllProcPropSeq(); } return; } this.boModelChg = false; float realtimeSinceStartup = Time.realtimeSinceStartup; for (;;) { if (Array.Find(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null) { break; } for (int i = 0; i < this.m_aryMaidProp.Length; i++) { MaidProp maidProp = this.m_aryMaidProp[i]; string name = maidProp.name; if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[name])) { if (!this.boModelChg) { this.body0.FixVisibleFlag(true); this.boModelChg = true; } if (this.boMAN && maidProp.idx == 43) { for (int j = 44; j <= 100; j++) { this.GetProp((MPN)j).boDut = true; } this.GetProp(MPN.moza).boDut = true; } else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48) { this.GetProp(MPN.haircolor).boDut = true; } else if (maidProp.idx == 45) { MPN[] array = new MPN[] { MPN.skin, MPN.eye, MPN.mayu, MPN.eye_hi, MPN.eye_hi_r, MPN.EyeClose, MPN.EarNone, MPN.EarElf, MPN.EarRot, MPN.EarScl, MPN.NosePos, MPN.NoseScl, MPN.FaceShape, MPN.FaceShapeSlim, MPN.MayuShapeIn, MPN.MayuShapeOut, MPN.MayuX, MPN.MayuY, MPN.MayuRot, MPN.eye_hi_r, MPN.eyewhite, MPN.nose, MPN.facegloss, MPN.lip }; foreach (MPN mpn in array) { this.GetProp(mpn).boDut = true; } } else if (maidProp.idx == 52) { MaidProp prop = this.GetProp(MPN.acctatoo); prop.boDut = true; if (prop.listSubProp != null) { for (int l = 0; l < prop.listSubProp.Count; l++) { if (prop.listSubProp[l] != null) { prop.listSubProp[l].bDut = true; } } } prop = this.GetProp(MPN.hokuro); prop.boDut = true; if (prop.listSubProp != null) { for (int n = 0; n < prop.listSubProp.Count; n++) { if (prop.listSubProp[n] != null) { prop.listSubProp[n].bDut = true; } } } this.GetProp(MPN.lip).boDut = true; this.GetProp(MPN.nose).boDut = true; this.GetProp(MPN.facegloss).boDut = true; } } } } realtimeSinceStartup = Time.realtimeSinceStartup; bool flag = false; foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values) { if (maidProp2.type != 3) { flag |= this.ProcItem(maidProp2); } } if (flag) { this.body0.ItemScaleReset(); } realtimeSinceStartup = Time.realtimeSinceStartup; if (this.boModelChg) { this.body0.MulTexProc(); this.body0.FixMaskFlag(); this.body0.FixVisibleFlag(false); } realtimeSinceStartup = Time.realtimeSinceStartup; this.ProcSSParam(); } private bool ProcItem(MaidProp mp) { bool result = false; string name = mp.name; if (mp.type == 1) { if (mp.boTempDut) { mp.boTempDut = false; this.body0.VertexMorph_FromProcItem(name, (float)mp.temp_value / 100f); result = true; } if (mp.boDut) { mp.boDut = false; this.body0.VertexMorph_FromProcItem(name, (float)mp.value / 100f); result = true; } } else if (mp.type == 2) { if (mp.boTempDut) { mp.boTempDut = false; this.body0.BoneMorph_FromProcItem(name, (float)mp.temp_value / 100f); result = true; } if (mp.boDut) { mp.boDut = false; this.body0.BoneMorph_FromProcItem(name, (float)mp.value / 100f); result = true; } } else if (mp.type == 3) { if (Product.isPublic && (mp.boTempDut || mp.boDut) && (mp.idx == 44 || mp.idx == 55 || mp.idx == 62 || mp.idx == 63 || mp.idx == 44 || mp.idx == 82 || mp.idx == 90 || mp.idx == 91 || mp.idx == 93)) { mp.boDut = false; mp.boTempDut = false; } if (mp.boTempDut && mp.boDut) { string[] array = new string[6]; array[0] = "Item実行を、本元とTempを同時に更新しようとしました。"; int num = 1; MPN idx = (MPN)mp.idx; array[num] = idx.ToString(); array[2] = " 元="; array[3] = mp.strFileName; array[4] = " Temp="; array[5] = mp.strTempFileName; Debug.LogWarning(string.Concat(array)); } if (mp.boTempDut) { if (!string.IsNullOrEmpty(mp.strTempFileName) && !Menu.ProcScript(this, mp, true, null)) { Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。"); mp.nTempFileNameRID = 0; mp.strTempFileName = string.Empty; } result = true; mp.boTempDut = false; if (97 <= mp.idx && mp.idx <= 100) { mp.nTempFileNameRID = 0; mp.strTempFileName = string.Empty; } } if (mp.boDut) { if (!string.IsNullOrEmpty(mp.strFileName) && !Menu.ProcScript(this, mp, false, null)) { Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。"); if (this.DelProp((MPN)mp.idx, false)) { Menu.ProcScript(this, mp, false, null); } } result = true; mp.boDut = false; if (97 <= mp.idx && mp.idx <= 100) { mp.nFileNameRID = 0; mp.strFileName = string.Empty; } } if (mp.listSubProp != null) { for (int i = 0; i < mp.listSubProp.Count; i++) { SubProp subProp = mp.listSubProp[i]; if (subProp != null && subProp.bDut) { if (!Menu.ProcScript(this, subProp.strFileName, false, subProp)) { Debug.LogWarning("サブメニューファイル " + subProp.strFileName + " が開けませんでした。"); mp.listSubProp[i] = null; } result = true; subProp.bDut = false; } } } if (mp.boAdjustDut) { if (this.body0.isLoadedBody) { foreach (KeyValuePair>> keyValuePair in mp.m_dicTBodyAttachPos) { TBodySkin tbodySkin = this.body0.goSlot[(int)keyValuePair.Key]; if (tbodySkin.morph != null) { foreach (KeyValuePair> keyValuePair2 in keyValuePair.Value) { tbodySkin.morph.SetAttachPointOffsetLocal(keyValuePair2.Key, keyValuePair2.Value.Value); result = true; } } } } mp.boAdjustDut = false; } } return result; } public bool MayuDrawPriority { get { string materialProperty = this.body0.GetMaterialProperty("head", 3, "_ZTest2", "AUTO"); if (!string.IsNullOrEmpty(materialProperty)) { float num = 0f; if (float.TryParse(materialProperty, out num)) { if ((int)(num + 0.5f) == 1) { return false; } if ((int)(num + 0.5f) == 7) { return true; } } } return false; } set { this.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!value) ? "1" : "7", true); } } public void SubPropAlpha(MPN f_mpn, int f_nSubNo, float f_fTexMulAlpha) { MaidProp maidProp = this.m_aryMaidProp[(int)f_mpn]; if (maidProp.listSubProp.Count <= f_nSubNo) { Debug.LogError("listSubProp の範囲を超えています。"); return; } SubProp subProp = maidProp.listSubProp[f_nSubNo]; if (subProp == null) { Debug.LogError("listSubProp に " + f_nSubNo + " 番はありません。"); return; } subProp.fTexMulAlpha = f_fTexMulAlpha; } public bool SerializeProp(BinaryWriter f_bwWrite) { f_bwWrite.Write("CM3D2_MPROP_LIST"); f_bwWrite.Write(1310); f_bwWrite.Write(this.m_dicMaidProp.Count); int num = 0; foreach (KeyValuePair keyValuePair in this.m_dicMaidProp) { f_bwWrite.Write(keyValuePair.Key); keyValuePair.Value.Serialize(f_bwWrite); num++; } return true; } public bool SerializePropLowCapacity(BinaryWriter writer) { NDebug.Assert(this.m_dicMaidProp.Count < 65535, "容量over"); writer.Write((char)this.m_dicMaidProp.Count); NDebug.Assert(true, "MPN容量over"); foreach (KeyValuePair keyValuePair in this.m_dicMaidProp) { MPN mpn = (MPN)Enum.Parse(typeof(MPN), keyValuePair.Key); writer.Write((char)mpn); keyValuePair.Value.SerializeLowCapacity(writer); } return true; } public bool SerializeMultiColor(BinaryWriter f_bwWrite) { return this.m_Parts.Serialize(f_bwWrite); } public bool SerializeMisc(BinaryWriter f_bwWrite) { f_bwWrite.Write("CM3D2_MAID_MISC"); f_bwWrite.Write(1310); f_bwWrite.Write(this.m_nActiveSlotNo); if (this.m_texIcon != null) { byte[] array = this.m_texIcon.EncodeToPNG(); f_bwWrite.Write(array.Length); f_bwWrite.Write(array); } else { f_bwWrite.Write(0); } f_bwWrite.Write(this.m_strThumCardTime); f_bwWrite.Write(this.m_colMan.r); f_bwWrite.Write(this.m_colMan.g); f_bwWrite.Write(this.m_colMan.b); f_bwWrite.Write(this.m_colMan.a); f_bwWrite.Write(this.m_nVoicePitch); this.FixThumCard(); return true; } public bool SerializeBody(BinaryWriter f_bwWrite) { f_bwWrite.Write("CM3D2_MAID_BODY"); f_bwWrite.Write(1310); return true; } public bool DeserializeProp(BinaryReader f_brRead) { string a = f_brRead.ReadString(); NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。"); int num = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); for (int i = 0; i < num2; i++) { string tag = f_brRead.ReadString(); MaidProp prop = this.GetProp(tag); prop.Deserialize(f_brRead); if (num <= 135 && prop.idx == 83 && Path.GetFileNameWithoutExtension(prop.strFileName.ToLower()) == "acckubi007_i_") { prop.boDut = true; prop.strFileName = CM3.dicDelItem[MPN.acckubi]; prop.nFileNameRID = prop.strFileName.ToLower().GetHashCode(); prop.strTempFileName = string.Empty; prop.nTempFileNameRID = 0; } } if (num <= 110) { MaidProp prop2 = this.GetProp(MPN.EyeScl); MaidProp prop3 = this.GetProp(MPN.EyeSclX); prop3.value = prop2.value; MaidProp prop4 = this.GetProp(MPN.EyeSclY); prop4.value = prop2.value; } if (!this.boMAN && Product.isPublic) { this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false); this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false); } this.AllProcPropSeqStart(); return true; } public void DeserializeOldData(OldDataConverter.MaidData data, bool statusOnly = false) { NDebug.AssertNull(data != null); this.status.Deserialize(data.statusReader, true); using (MemoryStream memoryStream = new MemoryStream(data.ReadAppearanceByte())) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { this.DeserializeProp(binaryReader); this.DeserializeMultiColor(binaryReader); } } if (!statusOnly) { Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false); texture2D.LoadImage(data.ReadThumbnailByte()); byte[] array = data.ReadAppearanceByte(); this.SetThumIcon(texture2D); string text = GameMain.Instance.CMSystem.CM3D2Path + "\\Thumb\\" + this.status.guid + ".png"; if (File.Exists(text)) { string text2 = Path.GetFullPath(".\\") + "Thumb\\" + this.status.guid + ".png"; if (!File.Exists(text2)) { File.Copy(text, text2); } } } } public static List DeserializePropPre(BinaryReader f_brRead) { List list = new List(); string a = f_brRead.ReadString(); NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。"); int num = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); HashSet hashSet = new HashSet(); for (int i = 0; i < num2; i++) { if (4 <= num) { string text = f_brRead.ReadString(); } MaidProp maidProp = new MaidProp(); maidProp.Deserialize(f_brRead); hashSet.Add((MPN)maidProp.idx); list.Add(maidProp); if (num <= 110 && maidProp.idx == 10) { list.Add(new MaidProp { type = maidProp.type, idx = 11, name = MPN.EyeSclX.ToString(), value = maidProp.value, min = maidProp.min, max = maidProp.max, boDut = true }); list.Add(new MaidProp { type = maidProp.type, idx = 12, name = MPN.EyeSclY.ToString(), value = maidProp.value, min = maidProp.min, max = maidProp.max, boDut = true }); } } if (num < 200) { list.Add(Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2)); list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuY, 2)); } if (num < 210) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2)); } if (!hashSet.Contains(MPN.FaceShapeSlim)) { list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2)); } if (!hashSet.Contains(MPN.EarNone)) { list.Add(Maid.CreateProp(0, 1, 0, MPN.EarNone, 2)); } if (!hashSet.Contains(MPN.EarElf)) { list.Add(Maid.CreateProp(0, 100, 0, MPN.EarElf, 2)); } if (!hashSet.Contains(MPN.EarRot)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EarRot, 2)); } if (!hashSet.Contains(MPN.EarScl)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EarScl, 2)); } if (!hashSet.Contains(MPN.NosePos)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.NosePos, 2)); } if (!hashSet.Contains(MPN.NoseScl)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2)); } if (!hashSet.Contains(MPN.MayuShapeIn)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2)); } if (!hashSet.Contains(MPN.MayuShapeOut)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2)); } if (!hashSet.Contains(MPN.MayuRot)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2)); } return list; } public static List DeserializePropLowCapacity(BinaryReader reader) { List list = Maid.CreateInitMaidPropList(); Dictionary dictionary = new Dictionary(); for (int i = 0; i < list.Count; i++) { dictionary.Add(list[i].idx, list[i]); } int num = (int)reader.ReadChar(); for (int j = 0; j < num; j++) { int key = (int)reader.ReadChar(); MaidProp maidProp = dictionary[key]; maidProp.DeserializeLowCapacity(reader); } return list; } public static MaidParts.PartsColor[] DeserializeMultiColorPre(BinaryReader f_brRead) { return MaidParts.DeserializePre(f_brRead); } public bool DeserializeMultiColor(BinaryReader f_brRead) { MaidParts.PartsColor[] array = MaidParts.DeserializePre(f_brRead); for (int i = 0; i < array.Length; i++) { this.Parts.SetPartsColor((MaidParts.PARTS_COLOR)i, array[i]); } return true; } public bool DeserializeMisc(BinaryReader f_brRead) { string a = f_brRead.ReadString(); NDebug.Assert(a == "CM3D2_MAID_MISC", "メイドその他のヘッダーが不正です。"); int num = f_brRead.ReadInt32(); this.m_nActiveSlotNo = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); if (num2 != 0) { byte[] data = f_brRead.ReadBytes(num2); UnityEngine.Object.Destroy(this.m_texIcon); this.m_texIcon = new Texture2D(1, 1, TextureFormat.ARGB32, false); this.m_texIcon.LoadImage(data); } if (8 <= num) { this.m_strThumCardTime = f_brRead.ReadString(); } this.m_colMan.r = f_brRead.ReadSingle(); this.m_colMan.g = f_brRead.ReadSingle(); this.m_colMan.b = f_brRead.ReadSingle(); this.m_colMan.a = f_brRead.ReadSingle(); if (202 <= num) { this.m_nVoicePitch = f_brRead.ReadInt32(); } this.CheckOldThumCard(); return true; } public static bool DeserializeBodyPre(BinaryReader f_brRead) { return Maid.DeserializeBodyRead(f_brRead); } public bool DeserializeBody(BinaryReader f_brRead) { return Maid.DeserializeBodyRead(f_brRead); } public static bool DeserializeBodyRead(BinaryReader f_brRead) { string a = f_brRead.ReadString(); NDebug.Assert(a == "CM3D2_MAID_BODY", "メイドBodyヘッダーが不正です。"); int num = f_brRead.ReadInt32(); return true; } public void SetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable) { MaidProp prop = this.GetProp(m_mpn); BoneAttachPos boneAttachPos = new BoneAttachPos(); boneAttachPos.bEnable = f_bEnable; boneAttachPos.pss.position = f_vPosLocal; boneAttachPos.pss.rotation = f_qRotLocal; boneAttachPos.pss.scale = f_vScaleRate; prop.m_dicTBodySkinPos[f_slot] = new KeyValuePair(prop.nFileNameRID, boneAttachPos); } public BoneAttachPos GetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot) { BoneAttachPos result = null; MaidProp prop = this.GetProp(m_mpn); KeyValuePair keyValuePair; if (prop.m_dicTBodySkinPos.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID) { result = keyValuePair.Value; } return result; } public void ClearTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot) { MaidProp prop = this.GetProp(m_mpn); prop.m_dicTBodySkinPos.Remove(f_slot); } public void SetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname, int f_vidx, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable) { MaidProp prop = this.GetProp(m_mpn); Dictionary> dictionary; if (!prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary)) { dictionary = (prop.m_dicTBodyAttachPos[f_slot] = new Dictionary>()); } VtxAttachPos vtxAttachPos = new VtxAttachPos(); vtxAttachPos.vtxcount = f_vtxcount; vtxAttachPos.vidx = f_vidx; vtxAttachPos.prs.position = f_vPosLocal; vtxAttachPos.prs.rotation = f_qRotLocal; vtxAttachPos.prs.scale = f_vScaleRate; vtxAttachPos.bEnable = f_bEnable; dictionary[f_apname] = new KeyValuePair(prop.nFileNameRID, vtxAttachPos); } public VtxAttachPos GetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname) { VtxAttachPos result = null; MaidProp prop = this.GetProp(m_mpn); Dictionary> dictionary; KeyValuePair keyValuePair; if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary) && dictionary.TryGetValue(f_apname, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.vtxcount == f_vtxcount) { result = keyValuePair.Value; } return result; } public void ClearAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, string f_apname) { MaidProp prop = this.GetProp(m_mpn); Dictionary> dictionary; if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary)) { dictionary.Remove(f_apname); } } public void SetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue) { MaidProp prop = this.GetProp(m_mpn); prop.m_dicMaterialProp[f_slot] = new KeyValuePair(prop.nFileNameRID, new MatPropSave(f_nMatNo, f_strPropName, f_strTypeName, f_strValue)); } public MatPropSave GetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot) { MaidProp prop = this.GetProp(m_mpn); KeyValuePair keyValuePair; if (prop.m_dicMaterialProp.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID) { return keyValuePair.Value; } return null; } public void SetHairLengthSaveToMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, float f_fValue) { MaidProp prop = this.GetProp(f_mpn); KeyValuePair> value; if (!prop.m_dicBoneLength.TryGetValue(f_slot, out value)) { Dictionary>> dicBoneLength = prop.m_dicBoneLength; value = new KeyValuePair>(prop.nFileNameRID, new Dictionary()); dicBoneLength[f_slot] = value; } value.Value[f_strName] = f_fValue; } public bool GetHairLengthFromMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, out float f_fOutValue) { MaidProp prop = this.GetProp(f_mpn); KeyValuePair> keyValuePair; if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.TryGetValue(f_strName, out f_fOutValue)) { return true; } f_fOutValue = 0.5f; return false; } public void ClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot) { MaidProp prop = this.GetProp(f_mpn); if (prop.m_dicBoneLength != null && prop.m_dicBoneLength.ContainsKey(f_slot)) { prop.m_dicBoneLength.Remove(f_slot); } } public bool NotExistThenClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot) { MaidProp prop = this.GetProp(f_mpn); KeyValuePair> keyValuePair; if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key != prop.nFileNameRID) { prop.m_dicBoneLength.Remove(f_slot); return true; } return false; } public void ThumShotCamMove() { GameMain.Instance.ThumCamera.GetComponent().MoveTargetCard(this); GameMain.Instance.ThumCamera.GetComponent().MoveTargetThum(this); } public void ThumShot() { UnityEngine.Object.Destroy(this.m_texIcon); this.m_texIcon = GameMain.Instance.ThumCamera.GetComponent().ShotThumIcon(this); this.SetThumCard(GameMain.Instance.ThumCamera.GetComponent().ShotThumCard(this)); } public void ThumShotCustom(string saveFileName, bool adjustmentCameraTransform) { ThumShot component = GameMain.Instance.ThumCamera.GetComponent(); Texture2D texture2D; if (adjustmentCameraTransform) { texture2D = component.ShotThumCard(this); } else { texture2D = component.ShotThumCardOriginal(); } string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } text = text + "/" + saveFileName; UTY.SaveImage(texture2D, text); UnityEngine.Object.Destroy(texture2D); } public void SetThumCard(Texture2D tex) { string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string f_strFileName = string.Empty; this.m_strThumCardTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); f_strFileName = text + "/_tmp_thum_" + this.status.guid + ".png"; UTY.SaveImage(tex, f_strFileName); UnityEngine.Object.Destroy(tex); Texture2D thumIcon = this.GetThumIcon(); f_strFileName = text + "/icon_thum_" + this.status.guid + ".png"; UTY.SaveImage(thumIcon, f_strFileName); } public void SetThumIcon(Texture2D icon_tex) { this.m_texIcon = icon_tex; } public Texture2D GetThumIcon() { return this.m_texIcon; } public Texture2D GetThumCard() { Texture2D result = null; string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string text2 = text + "/_tmp_thum_" + this.status.guid + ".png"; if (File.Exists(text2)) { result = UTY.LoadTexture(text2); } else { text2 = text + "/" + this.status.guid + ".png"; if (File.Exists(text2)) { result = UTY.LoadTexture(text2); } } return result; } public static void DeletedTmpThumCards() { string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { return; } string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly); for (int i = 0; i < files.Length; i++) { string text2 = text + "\\"; int num = files[i].IndexOf(text2); if (num != 0) { files[i] = string.Empty; } else { string text3 = string.Empty; try { text3 = files[i].Substring(text2.Length, files[i].Length - text2.Length); } catch { } if (string.IsNullOrEmpty(text3)) { files[i] = string.Empty; } else if (0 > text3.IndexOf(".png") || text3.IndexOf("_tmp_thum_") != 0) { files[i] = string.Empty; } } } for (int j = 0; j < files.Length; j++) { if (!string.IsNullOrEmpty(files[j])) { try { File.Delete(files[j]); } catch { } } } } private void FixThumCard() { string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { return; } string text2 = text + "/_tmp_thum_" + this.status.guid + ".png"; if (!File.Exists(text2)) { return; } string text3 = text + "/" + this.status.guid + ".png"; try { if (File.Exists(text3)) { File.Delete(text3); } File.Move(text2, text3); } catch { } } private void CheckOldThumCard() { string fullPath = Path.GetFullPath(".\\"); string text = fullPath + "Thumb"; if (!Directory.Exists(text)) { return; } string text2 = string.Concat(new string[] { text, "/", this.status.guid, this.m_strThumCardTime, ".png" }); if (!File.Exists(text2)) { return; } File.Move(text2, text + "/" + this.status.guid + ".png"); } public void ProcSSParam() { this.boBallGAG = (this.body0.GetSlotUserParam("accHa", "口枷") > 0); this.boNoseFook = (this.body0.GetSlotUserParam("accHana", "鼻フック") > 0); } public void StopAnime(string fn = "") { this.body0.StopAnime(fn); } public string CrossFade(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f) { return this.CrossFade(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight); } public string CrossFade(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f) { return this.body0.CrossFade(fn, fileSystem, additive, loop, boAddQue, val, weight); } public string CrossFadeAbsolute(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f) { return this.CrossFadeAbsolute(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight); } public string CrossFadeAbsolute(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f) { return this.body0.CrossFadeAbsolute(fn, fileSystem, additive, loop, boAddQue, val, weight); } public void CacheAnime(string fn, bool loadMuneL = false, bool loadMuneR = false) { this.body0.CacheLoadAnime(GameUty.FileSystem, Path.ChangeExtension(fn, ".anm"), loadMuneL, loadMuneR); } public Animation GetAnimation() { return this.body0.GetAnimation(); } private void Start() { } public void ResetAll() { this.FaceAnime("通常", 0f, 0); this.FaceBlend("無し"); this.OpenMouth(false); this.EyeToReset(0f); this.DelPrefabAll(); string[] array = new string[] { "handitem", "kousoku_upper", "kousoku_lower", "eye_hi", "skirt", "panz", "mizugi", "onepiece", "accanl", "accvag", "KubiScl", "UdeScl", "DouPer", "sintyou", "kata", "seieki_naka" }; for (int i = 0; i < array.Length; i++) { this.ResetProp(array[i], false); } if (this.body0 != null && this.body0.isLoadedBody) { this.body0.SetMaskMode(TBody.MaskMode.None); for (int j = 10; j <= 20; j++) { this.body0.MulTexRemove("body", 0, "_MainTex", j); this.body0.MulTexRemove("body", 0, "_ShadowTex", j); this.body0.MulTexRemove("head", 5, "_MainTex", j); this.body0.MulTexRemove("head", 5, "_ShadowTex", j); } this.body0.MulTexProc("body"); this.body0.MulTexProc("head"); this.SetModeHairR(TBody.ModeHirR.Normal); if (this.body0.isLoadedBody) { this.body0.MuneYureL(1f); this.body0.MuneYureR(1f); this.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false); this.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false); } } } public void Lipsync(bool f_bEnable) { this.boLipsync = f_bEnable; } public void LipSyncEnabled(bool enabled) { this.lipSyncEnabled = enabled; } public bool MicLipSync { get { return this.m_MicLipSync; } } public void SetMicLipSync(bool is_start) { if (!this.AudioMan) { Debug.LogError("AudioManが見つかりません"); return; } this.m_MicLipSync = is_start; this.m_bFoceKuchipakuSelfUpdateTime = is_start; if (is_start) { if (!this.MicLipData.Context) { this.MicLipData.Context = this.AudioMan.gameObject.AddComponent(); } if (!this.MicLipData.MorphTarget) { this.MicLipData.MorphTarget = this.AudioMan.gameObject.AddComponent(); } if (!this.MicLipData.MicInput) { this.MicLipData.MicInput = this.AudioMan.gameObject.AddComponent(); } this.MicLipData.Context.Init(); this.MicLipData.MorphTarget.Init(this); this.MicLipData.MicInput.Init(this); this.MicLipData.MicInput.StartMicrophone(); } else { if (this.MicLipData.MicInput) { this.MicLipData.MicInput.StopMicrophone(); } this.AudioMan.audiosource.clip = null; UnityEngine.Object.Destroy(this.MicLipData.Context); UnityEngine.Object.Destroy(this.MicLipData.MorphTarget); UnityEngine.Object.Destroy(this.MicLipData.MicInput); } } public void StartKuchipakuPattern(float f_fOffsetTime, string f_strPattern, bool f_bSelfUpdateTime = false) { this.m_fKuchipakuPatternOffsetTime = f_fOffsetTime; this.m_baKuchipakuPattern = Convert.FromBase64String(f_strPattern); this.m_bFoceKuchipakuSelfUpdateTime = f_bSelfUpdateTime; } public void StopKuchipakuPattern() { this.m_fKuchipakuPatternOffsetTime = 0f; this.m_baKuchipakuPattern = null; this.m_bFoceKuchipakuSelfUpdateTime = false; } public void IKTargetToAttachPoint(string tag, Maid tgt_maid, string tgt_name, string attachpoint_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, string axisbone = "", bool do_animation = false, bool is_next = false) { IKCtrlData ikdata = this.body0.IKCtrl.GetIKData(tag, true); Transform axis_bone = null; if (attach_type != IKCtrlData.IKAttachType.Rotate && !string.IsNullOrEmpty(axisbone)) { axis_bone = CMT.SearchObjName(tgt_maid.body0.m_trBones, axisbone, true); } ikdata.SetIKSetting(attach_type, is_next, tgt_maid, this.body0.GetSlotNo(tgt_name), attachpoint_name, axis_bone, f_vecOffset, do_animation); } public void IKTargetToBone(string tag, Maid tgt_maid, string tgtbone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool search_sm = false, bool do_animation = false, bool is_next = false) { IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true); if (tgtbone_name != "無し") { Transform target; if (!search_sm) { target = CMT.SearchObjName(tgt_maid.body0.m_trBones, tgtbone_name, true); } else { target = CMT.SearchObjName(tgt_maid.body0.SmBody, tgtbone_name, false); } ikdata.SetIKSetting(attach_type, is_next, tgt_maid, target, f_vecOffset, do_animation); } else { ikdata.Detach(IKCtrlData.IKAttachType.NewPoint); ikdata.Detach(IKCtrlData.IKAttachType.Rotate); } } public void IKTargetToOdogu(string tag, string odogu_name, string tgt_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, bool is_next = false) { Transform transform = null; GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(odogu_name); if (!prefabFromBg) { Debug.LogErrorFormat("現在の背景に大道具「{0}」は存在しません", new object[] { odogu_name }); } else if (prefabFromBg.transform.childCount == 0 || string.IsNullOrEmpty(tgt_name)) { transform = prefabFromBg.transform; } else { for (int i = 0; i < prefabFromBg.transform.childCount; i++) { Transform child = prefabFromBg.transform.GetChild(i); if (child && !(child.name != tgt_name)) { transform = prefabFromBg.transform.GetChild(i); break; } } if (!transform) { Debug.LogErrorFormat("大道具「{0}」にターゲット「{1}」は存在しません", new object[] { odogu_name, tgt_name }); } } IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true); ikdata.SetIKSetting(attach_type, is_next, transform, f_vecOffset, do_animation); } public void IKTargetToIKBone(string my_tag, Maid f_maidTarget, string bone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, bool is_next = false) { IKCtrlData ikdata = f_maidTarget.IKCtrl.GetIKData(bone_name, true); if (!ikdata) { return; } Transform targetBone = ikdata.TargetBone; IKCtrlData ikdata2 = this.IKCtrl.GetIKData(my_tag, true); ikdata2.SetIKSetting(attach_type, is_next, f_maidTarget, bone_name, targetBone, f_vecOffset, do_animation); } public void IKDetach(string name) { this.IKTargetToBone(name, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false); } public void AllIKDetach(float blendtime = 0f) { this.IKCtrl.BlendTime = blendtime; this.IKCtrl.IKActive = (blendtime > 0f); this.IKCtrl.AllForceIK = false; foreach (string tag in this.IKCtrl.strIKDataPair.Keys) { this.IKTargetToBone(tag, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false); } } public void OpenMouth(bool f_bOpen) { this.boMouthOpen = f_bOpen; } public void OpenMouthLookTooth(bool f_bOpen) { this.boLookTooth = f_bOpen; } public void EyeToPosition(Vector3 f_vecTargetPos, float f_fFadeTime = 0f) { if (f_fFadeTime <= 0f) { f_fFadeTime = 0.001f; } this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime; this.body0.trsLookTarget = null; this.body0.offsetLookTarget = f_vecTargetPos; this.body0.boHeadToCam = true; this.body0.boEyeToCam = true; this.body0.boEyeSorashi = false; } public void EyeToTargetObject(Transform target_trans, float f_fFadeTime = 0f) { this.body0.trsLookTarget = target_trans; if (this.body0.trsLookTarget == null) { this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f); } if (f_fFadeTime <= 0f) { f_fFadeTime = 0.001f; } this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime; this.body0.boHeadToCam = true; this.body0.boEyeToCam = true; this.body0.boEyeSorashi = false; } public void EyeToTarget(Maid f_maidTarget, float f_fFadeTime = 0f, string f_strBoneName = "Bip01 Head") { Transform transform = CMT.SearchObjName(f_maidTarget.body0.m_trBones, f_strBoneName, true); this.body0.trsLookTarget = transform; if (transform == null) { this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f); } if (f_fFadeTime <= 0f) { f_fFadeTime = 0.001f; } this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime; this.body0.boHeadToCam = true; this.body0.boEyeToCam = true; this.body0.boEyeSorashi = false; } public void EyeToCamera(Maid.EyeMoveType f_eType, float f_fFadeTime = 0f) { this.body0.boHeadToCam = false; this.body0.boEyeToCam = true; this.body0.boEyeSorashi = false; if (f_fFadeTime <= 0f) { f_fFadeTime = 0.001f; } this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime; if (GameMain.Instance.VRMode) { if (GameMain.Instance.OvrMgr != null) { this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor; } if (GameMain.Instance.OvrIK != null && OvrIK.IsVRIKMode && GameMain.Instance.OvrIK.NowMaid == this) { this.body0.trsLookTarget = GameMain.Instance.OvrIK.EyeTargetTrs; } } else if (GameMain.Instance.MainCamera != null) { this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform; } if (f_eType == Maid.EyeMoveType.無し) { this.body0.boEyeToCam = false; } if (f_eType == Maid.EyeMoveType.無視する) { this.body0.boEyeToCam = false; } if (f_eType == Maid.EyeMoveType.顔を向ける) { this.body0.boHeadToCam = true; } if (f_eType == Maid.EyeMoveType.顔だけ動かす) { this.body0.boHeadToCam = true; this.body0.boEyeToCam = false; } if (f_eType == Maid.EyeMoveType.顔をそらす) { this.body0.trsLookTarget = null; this.body0.boEyeSorashi = true; this.body0.boEyeToCam = true; this.body0.boHeadToCam = true; } if (f_eType == Maid.EyeMoveType.目と顔を向ける) { this.body0.boHeadToCam = true; this.body0.boEyeToCam = true; } if (f_eType == Maid.EyeMoveType.目だけ向ける) { this.body0.boHeadToCam = false; this.body0.boEyeToCam = true; } if (f_eType == Maid.EyeMoveType.目だけそらす) { this.body0.trsLookTarget = null; this.body0.boEyeSorashi = true; this.body0.boEyeToCam = true; this.body0.boHeadToCam = false; } } public void EyeToReset(float f_fFadeTime = 0f) { this.EyeToCamera(Maid.EyeMoveType.無し, f_fFadeTime); } public void LockHeadAndEye(bool toLock) { this.body0.boLockHeadAndEye = toLock; } public bool GetLockHeadAndEye() { return this.body0.boLockHeadAndEye; } public void SetModeHairR(TBody.ModeHirR f_eMode) { this.body0.Mode_HairR = f_eMode; } public void SetAutoTwist(Maid.AutoTwist f_eType, bool f_bEnable) { switch (f_eType) { case Maid.AutoTwist.ShoulderL: this.body0.boAutoTwistShoulderL = f_bEnable; break; case Maid.AutoTwist.ShoulderR: this.body0.boAutoTwistShoulderR = f_bEnable; break; case Maid.AutoTwist.WristL: this.body0.boAutoTwistWristL = f_bEnable; break; case Maid.AutoTwist.WristR: this.body0.boAutoTwistWristR = f_bEnable; break; case Maid.AutoTwist.ThighL: this.body0.boAutoTwistThighL = f_bEnable; break; case Maid.AutoTwist.ThighR: this.body0.boAutoTwistThighR = f_bEnable; break; } } public void SetAutoTwistAll(bool f_bEnable) { this.body0.boAutoTwistShoulderL = f_bEnable; this.body0.boAutoTwistShoulderR = f_bEnable; this.body0.boAutoTwistWristL = f_bEnable; this.body0.boAutoTwistWristR = f_bEnable; this.body0.boAutoTwistThighL = f_bEnable; this.body0.boAutoTwistThighR = f_bEnable; } public void FaceAnime(string tag, float t = 1f, int chkcode = 0) { this.FaceAnimeChkCode = chkcode; this.ActiveFace = tag; if (this.body0 != null && this.body0.Face != null && this.body0.Face.morph != null && this.body0.Face.morph.dicBlendSet != null && this.body0.Face.morph.dicBlendSet.ContainsKey(tag + "〓通常")) { tag += "〓通常"; } if (t == 0f) { this.boFaceAnime = false; this.FaceName = tag; this.FaceName2 = string.Empty; return; } this.boFaceAnime = true; if (this.FaceName2 != string.Empty) { this.FaceName = this.FaceName2; this.FaceName2 = string.Empty; } if (this.FaceName == string.Empty) { this.FaceName = "デフォ"; } this.FaceName2 = tag; this.FacePlus = 1f / t; this.FaceTime = this.FacePlus * 0.0166666675f; } public void FaceBlend(string tag) { if (this.body0 == null) { Debug.LogError("Bodyが読み込まれる前に、表情ブレンドが呼ばれました。" + tag); return; } if (tag == "無し") { tag = string.Empty; } this.FaceName3 = tag; } public void ChangeAutoFace(bool bo) { if (this.boAutoFace != bo) { this.AutoFaceLV_old = 0; this.Hazukashi = 0f; } this.boAutoFace = bo; } public void AddPrefab(string f_strPrefab, string f_strName, string f_strDestBone, Vector3 f_vOffsetLocalPos, Vector3 f_vOffsetLocalRot) { UnityEngine.Object @object = Resources.Load("Prefab/" + f_strPrefab); if (@object != null) { Transform transform = null; if (this.body0 != null && this.body0.isLoadedBody) { transform = CMT.SearchObjName(this.body0.m_trBones, f_strDestBone, true); } if (transform != null) { GameObject goItem = UnityEngine.Object.Instantiate(@object) as GameObject; goItem.AddComponent(); goItem.name = goItem.name.Replace("(Clone)", string.Empty); if (!string.IsNullOrEmpty(f_strName)) { goItem.name = f_strName; } AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren(true); AttachPrefab[] array = (from a in componentsInChildren where a.name == goItem.name select a).ToArray(); for (int i = 0; i < array.Length; i++) { UnityEngine.Object.DestroyImmediate(array[i].gameObject); } goItem.transform.SetParent(transform, false); goItem.transform.localPosition = f_vOffsetLocalPos; goItem.transform.localRotation = Quaternion.Euler(f_vOffsetLocalRot); } else { Debug.LogError("人物にプレハブ追加で、ボーン名が見つかりません。" + f_strDestBone); } } else { Debug.LogError("人物にプレハブ追加で、プレハブが見つかりません。Prefab/" + f_strPrefab); } } public void DelPrefab(string f_strName) { if (this.body0 == null || !this.body0.isLoadedBody) { return; } AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren(true); AttachPrefab[] array = (from a in componentsInChildren where a.name == f_strName select a).ToArray(); for (int i = 0; i < array.Length; i++) { UnityEngine.Object.DestroyImmediate(array[i].gameObject); } } public void DelPrefabAll() { if (this.body0 == null || !this.body0.isLoadedBody) { return; } AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { UnityEngine.Object.DestroyImmediate(componentsInChildren[i].gameObject); } } public GameObject GetPrefab(string f_strName) { if (this.body0 == null || !this.body0.isLoadedBody) { return null; } AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren(true); AttachPrefab[] array = (from a in componentsInChildren where a.name == f_strName select a).ToArray(); return (0 >= array.Length) ? null : array[0].gameObject; } public void AnimationObject(string f_strName, string f_strAnimName, bool f_bNowPlay, bool f_bLoop) { Transform transform; if ((transform = CMT.SearchObjName(this.body0.m_trBones, f_strName, false)) != null) { Animation animation = transform.gameObject.GetComponent(); if (animation == null) { animation = transform.gameObject.AddComponent(); } AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, f_strAnimName, true, true, true); if (animationClip == null) { NDebug.Assert("アニメーション " + f_strAnimName + " が見つかりません。", false); } animation.AddClip(animationClip, f_strAnimName); animation.clip = animationClip; animation.playAutomatically = true; animation.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop); if (f_bNowPlay) { animation.PlayQueued(f_strAnimName, QueueMode.PlayNow); } this.m_goTestAnim = transform.gameObject; } else { NDebug.Assert("人物に追加した " + f_strName + " は見つかりませんでした。", false); } } public void SetPos(Vector3 f_vecLocalPos) { base.gameObject.transform.localPosition = f_vecLocalPos; } public void SetRot(Vector3 f_vecLocalRot) { base.gameObject.transform.localRotation = Quaternion.Euler(f_vecLocalRot); } public Vector3 GetPos() { return base.gameObject.transform.localPosition; } public Vector3 GetRot() { return base.gameObject.transform.localRotation.eulerAngles; } public Vector3 GetWorldRot() { return base.gameObject.transform.rotation.eulerAngles; } public void SetPosOffset(Vector3 f_vecLocalPos) { this.m_vOffsetPostion = f_vecLocalPos; } public void UpdateTransformData() { this.SetPos(this.baseOffset + this.motionOffset); if (this.boMAN) { if (!string.IsNullOrEmpty(this.rotateLinkMaid)) { for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++) { Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i); if (maid != null && maid.status.guid == this.rotateLinkMaid) { maid.UpdateTransformData(); break; } } } return; } Vector3 position = base.transform.position; base.transform.localRotation = Quaternion.identity; if (!Mathf.Approximately(0f, this.baseEulerAngles.x)) { base.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x); } if (!Mathf.Approximately(0f, this.baseEulerAngles.y)) { base.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y); } if (!Mathf.Approximately(0f, this.baseEulerAngles.z)) { base.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z); } for (int j = 0; j < GameMain.Instance.CharacterMgr.GetManCount(); j++) { Maid man = GameMain.Instance.CharacterMgr.GetMan(j); if (man != null && man.status.guid == this.rotateLinkMaid) { man.SetPos(man.baseOffset + man.motionOffset); man.transform.localRotation = Quaternion.identity; if (!Mathf.Approximately(0f, this.baseEulerAngles.x)) { man.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x); } if (!Mathf.Approximately(0f, this.baseEulerAngles.y)) { man.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y); } if (!Mathf.Approximately(0f, this.baseEulerAngles.z)) { man.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z); } break; } } } public void SetPosOffsetFromUdeSclX(string category, float val) { this.m_vOffsetPostion.x = ((float)this.GetProp(category).value - 50f) * (val / 50f); } public void SetPosOffsetFromUdeSclY(string category, float val) { this.m_vOffsetPostion.y = ((float)this.GetProp(category).value - 50f) * (val / 50f); } public void SetPosOffsetFromUdeSclZ(string category, float val) { this.m_vOffsetPostion.z = ((float)this.GetProp(category).value - 50f) * (val / 50f); } public void ExportModBaseMenu(MPN f_mpn) { MaidProp prop = this.GetProp(f_mpn); if (string.IsNullOrEmpty(prop.strFileName)) { NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MOD Export Error", 0); return; } Menu.ExportModScript(this, prop.strFileName, false); } public void ExportModBaseMqo(MPN f_mpn, string f_strOutFileName) { MaidProp prop = this.GetProp(f_mpn); if (string.IsNullOrEmpty(prop.strFileName)) { NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MQO Export Error", 0); return; } } public void FoceKuchipakuUpdate(float f_fNowTime) { if (this.m_baKuchipakuPattern != null) { int num = (int)((this.m_fKuchipakuPatternOffsetTime + f_fNowTime) * 30f); int num2 = this.m_baKuchipakuPattern.Length / 3; if (0 < num && num < num2) { this.body0.Face.morph.boLipSync = true; this.body0.Face.morph.LipSync1 = this.body0.Face.morph.LipSync1 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3] / 255f * 0.85f * 3f; this.body0.Face.morph.LipSync2 = this.body0.Face.morph.LipSync2 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 1] / 255f * 0.85f * 3f; this.body0.Face.morph.LipSync3 = this.body0.Face.morph.LipSync3 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 2] / 255f * 0.85f * 3f; } else { this.body0.Face.morph.boLipSync = false; } } } private void Update() { if (this.boAllProcPropBUSY) { this.AllProcPropSeq(); return; } if (this.boMAN) { this.m_goOffset.transform.localPosition = this.m_vOffsetPostion; return; } if (!this.body0.isLoadedBody) { return; } if (this.boOffsetY) { float num = this.body0.ToeL.position.y; if (this.body0.ToeR.position.y < num) { num = this.body0.ToeR.position.y; } num = this.body0.CenterBone.position.y; num *= 0.8f; float num2 = this.body0.Pelvis.position.y - this.body0.CenterBone.position.y; this.m_goOffset.transform.localPosition = new Vector3(0f, -num2 + num2 * this.body0.bonemorph.SnityouOutScale, 0f) + this.m_vOffsetPostion; } this.body0.Face.morph.boLookTooth = this.boLookTooth; this.body0.Face.morph.boBallGAG = (this.boBallGAG | this.boMouthOpen); this.body0.Face.morph.boNoseFook = this.boNoseFook; if (this.AudioMan != null && !this.m_bFoceKuchipakuSelfUpdateTime) { this.body0.Face.morph.boLipSync = this.AudioMan.audiosource.isPlaying; if (!this.lipSyncEnabled) { this.body0.Face.morph.boLipSync = false; } float voicePara_ = this.VoicePara_1; float voicePara_2 = this.VoicePara_3; float vol = this.AudioMan.GetVol(); this.voice_avg1 = this.voice_avg1 * (1f - voicePara_) + vol * voicePara_; this.voice_avg2 = this.voice_avg2 * (1f - voicePara_) + this.AudioMan.VAvgMax * voicePara_; this.voice_avg1D = this.voice_avg1D * (1f - voicePara_2) + (vol - this.voice_avg1_old) * voicePara_2; this.voice_avg2D = this.voice_avg2D * (1f - voicePara_2) + (this.AudioMan.VAvgMax - this.voice_avg2_old) * voicePara_2; this.voice_avg1_old = vol; this.voice_avg2_old = this.AudioMan.VAvgMax; this.voice_ao_time -= Time.deltaTime; if (this.voice_ao_time < 0f && this.voice_avg1D > 0f && this.voice_ao_chk0 < -0.05f && this.voice_ao_chk1 > 0.1f) { this.voice_ao_time = 0.05f; this.voice_ao = (this.voice_ao + 1) % 8; this.voice_ao_chk0 = 0f; this.voice_ao_chk1 = 0f; } if (this.voice_ao_chk1 < this.voice_avg1D) { this.voice_ao_chk1 = this.voice_avg1D; } if (0.1f < this.voice_avg1D) { this.voice_ao_chk0 = 0f; } if (this.voice_ao_chk0 > this.voice_avg1D) { this.voice_ao_chk0 = this.voice_avg1D; } float num3 = Mathf.Pow(this.voice_avg1, 1f) * 10f * this.VoicePara_2; if (this.voice_ao % 2 == 0) { this.voice_ao_f *= 0.5f; } else { this.voice_ao_f = this.voice_ao_f * 0.5f + 0.5f; } this.voice_lf2 = num3 * this.voice_ao_f; this.voice_lf3 = num3 * (1f - this.voice_ao_f); this.body0.Face.morph.LipSync2 = this.voice_lf2; this.body0.Face.morph.LipSync3 = this.voice_lf3; float num4 = Mathf.Pow(this.voice_avg2, 0.5f) * (this.voice_avg2D * 30f * this.VoicePara_4 + 0.5f); this.voice_lf1 = num4; this.body0.Face.morph.LipSync1 = this.voice_lf1; if (this.voice_ao % 4 < 2) { this.voice_ao_f2 *= 0.5f; } else { this.voice_ao_f2 = this.voice_ao_f2 * 0.5f + 0.5f; } this.body0.Face.morph.LipSync1 *= this.voice_ao_f2; this.body0.Face.morph.LipSync2 *= 1f - this.voice_ao_f2; this.body0.Face.morph.LipSync3 *= 1f - this.voice_ao_f2; this.body0.Face.morph.LipSync1 = Mathf.Clamp01(this.body0.Face.morph.LipSync1 * 0.5f); this.body0.Face.morph.LipSync2 = Mathf.Clamp01(this.body0.Face.morph.LipSync2 * 0.5f); this.body0.Face.morph.LipSync3 = Mathf.Clamp01(this.body0.Face.morph.LipSync3 * 0.5f); } if (this.m_baKuchipakuPattern != null && this.lipSyncEnabled && !this.m_bFoceKuchipakuSelfUpdateTime && this.AudioMan != null) { this.FoceKuchipakuUpdate(this.AudioMan.audiosource.time); } if (this.boLipsync && this.lipSyncEnabled) { this.body0.Face.morph.boLipSync = true; this.LipsyncT1 += Mathf.Sin(Time.time * 10f) * 0.5f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f; this.LipsyncT2 += Mathf.Sin(Time.time * 5f) * 0.1f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f; float num5 = (1f + Mathf.Sin(Time.time * 4f + this.LipsyncT1)) * 0.5f * 0.98f + 0.1f; float num6 = (Mathf.Sin(this.LipsyncT1) + 1f) * 0.5f; float num7 = (Mathf.Sin(this.LipsyncT2) + 1f) * 0.5f; this.body0.Face.morph.LipSync1 = num5 * num6 * num7 * 0.5f; this.body0.Face.morph.LipSync3 = num5 * (1f - num6) * num7 * 0.5f; this.body0.Face.morph.LipSync2 = num5 * (1f - num7) * 0.5f; } else if (this.boLipsync_old) { this.body0.Face.morph.LipSync1 = 0f; this.body0.Face.morph.LipSync3 = 0f; this.body0.Face.morph.LipSync2 = 0f; } this.boLipsync_old = this.boLipsync; if (this.boMabataki) { this.body0.Face.morph.ClearBlendValues(); if (this.FaceName != string.Empty) { this.body0.Face.morph.MulBlendValues(this.FaceName, 1f); } if (this.FaceName2 != string.Empty) { this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f)); this.FaceTime += Time.deltaTime * this.FacePlus; if (this.FaceTime >= 1f) { this.boFaceAnime = false; this.FaceName = this.FaceName2; this.FaceName2 = string.Empty; } } if (this.FaceName3 != string.Empty) { this.body0.Face.morph.AddBlendValues(this.FaceName3, 1f); } if (this.MabatakiVal > 0f) { float num8 = this.MabatakiVal * this.MabatakiVal; num8 = Mathf.Sin(num8 * 3.14159274f); this.body0.Face.morph.EyeMabataki = num8; } else { this.body0.Face.morph.EyeMabataki = 0f; } if (!this.MabatakiUpdateStop) { this.MabatakiVal -= Time.deltaTime * 2f; } this.body0.Face.morph.FixBlendValues_Face(); if (!this.boFaceAnime && this.NextMabatakiTime < Time.time && !this.MabatakiUpdateStop) { float num9 = 0.5f + (float)UTY.GetRnd(80) * 0.1f; this.NextMabatakiTime = Time.time + num9; this.MabatakiVal = 1f; } } else if (this.FaceName2 != string.Empty) { this.body0.Face.morph.ClearBlendValues(); if (this.FaceName != string.Empty) { this.body0.Face.morph.MulBlendValues(this.FaceName, 1f); } this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f)); this.FaceTime += Time.deltaTime * this.FacePlus; if (this.FaceTime >= 1f) { this.boFaceAnime = false; this.FaceName = this.FaceName2; this.FaceName2 = string.Empty; } this.MabatakiVal = 0f; this.body0.Face.morph.FixBlendValues_Face(); } } private void LateUpdate() { if (this.boAllProcPropBUSY) { return; } if (!this.body0.isLoadedBody) { return; } if (this.m_MotionLoad == 1) { this.m_MotionLoad = 0; if (!this.boMAN) { this.CrossFade("maid_stand01.anm", false, true, false, 0.5f, 1f); this.FaceAnime("通常", 1f, 0); if (GameMain.Instance.VRMode) { if (GameMain.Instance.OvrMgr != null) { this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor; } } else if (GameMain.Instance.MainCamera != null) { this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform; } } } } public GameObject m_goOffset; private Status m_Status; private MaidParts m_Parts; private bool m_visible; public Action onMouseUpEvent; public string TypeName = string.Empty; public TBody body0; public bool boMAN; public bool boNPC; public bool boOffsetY = true; public Vector3 baseOffset = Vector3.zero; public Vector3 motionOffset = Vector3.zero; public Vector3 baseEulerAngles = Vector3.zero; public string rotateLinkMaid = string.Empty; private Dictionary m_dicMaidProp = new Dictionary(); private MaidProp[] m_aryMaidProp; private Hashtable m_hashMaidPropLower = new Hashtable(); private int m_nActiveSlotNo = -1; private string m_strThumCardTime = string.Empty; private Texture2D m_texIcon; private Color m_colMan = new Color(0f, 0.09f, 1f, 1f); private int m_nVoicePitch = 50; private string m_strBefOnepiceFileName; private int m_nBefOnepiceRID; private string m_strBefWearFileName; private int m_nBefWearRID; private string m_strBefSkirtFileName; private int m_nBefSkirtRID; private bool boModelChg; public bool boAllProcPropBUSY; private int AllProcProp2Fase; private int AllProcProp2Cnt; public bool boLookTooth; public bool boBallGAG; public bool boMouthOpen; public bool boNoseFook; private float m_fKuchipakuPatternOffsetTime; public byte[] m_baKuchipakuPattern; private bool m_bFoceKuchipakuSelfUpdateTime; [Header("音声入力用コンポーネント")] public Maid.LipSyncComp MicLipData = new Maid.LipSyncComp(); private bool m_MicLipSync; private bool boAutoFace; private float NextMabatakiTime; private float MabatakiVal; private string FaceName = string.Empty; private string FaceName2 = string.Empty; public string FaceName3 = string.Empty; private float FaceTime; private float FacePlus; public string ActiveFace = string.Empty; public int FaceAnimeChkCode; public bool boFaceAnime; public int OldFaceAtr; public bool boShitakaraNozoku; public bool boVisibleBottom; public int AutoFaceLV_old; public float Hazukashi; public bool boChkEye_old; public GameObject m_goTestAnim; public float voice_time; public float voice_avg1; public float voice_avg2; public float voice_avg1_old; public float voice_avg2_old; public float voice_avg1D; public float voice_avg2D; public int voice_ao; public float voice_ao_f; public float voice_ao_f2; public float voice_ao_time; public float voice_ao_chk0; public float voice_ao_chk1; public float voice_lf1; public float voice_lf2; public float voice_lf3; public float VoicePara_1 = 0.5f; public float VoicePara_2 = 0.074f; public float VoicePara_3 = 0.5f; public float VoicePara_4 = 0.05f; private bool lipSyncEnabled = true; private bool boLipsync; private bool boLipsync_old; private float LipsyncT1; private float LipsyncT2; public bool boMabataki = true; public bool MabatakiUpdateStop; private Vector3 m_vOffsetPostion = Vector3.zero; public static int changetest; private int m_MotionLoad = 1; [Serializable] public class LipSyncComp { [HideInInspector] public bool IsInit = true; public LowLatencyLipSyncContext Context; public OVRLipSyncContextMorphTarget MorphTarget; public OVRLipSyncMicInput MicInput; } public enum EyeMoveType { 無し, 無視する, 顔を向ける, 顔だけ動かす, 顔をそらす, 目と顔を向ける, 目だけ向ける, 目だけそらす } public enum AutoTwist { ShoulderL, ShoulderR, WristL, WristR, ThighL, ThighR } }