using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using Scourt.Utility; using UnityEngine; public class Menu : MonoBehaviour { public static string[] GetModFiles() { string str = UTY.gameProjectPath + "\\"; string path = str + "Mod"; if (!Directory.Exists(path)) { return null; } return Directory.GetFiles(path, "mod_*.mod", SearchOption.AllDirectories); } public static string GetModPathFileName(string f_strMenuFileName) { string[] modFiles = Menu.GetModFiles(); if (modFiles == null) { NDebug.MessageBox("MODエラー", "MODフォルダが無いか、MODフォルダにMODファイルが1つもありません。\n" + f_strMenuFileName); return string.Empty; } string text = Array.Find(modFiles, (string a) => Path.GetFileName(a).ToLower() == f_strMenuFileName.ToLower()); if (string.IsNullOrEmpty(text)) { NDebug.MessageBox("MODエラー", "MODフォルダにMODファイルが見つかりません。\n" + f_strMenuFileName); return string.Empty; } return text; } public static Menu.MenuHeader ReadMenuHeader(string fileName) { byte[] buffer = null; using (AFileBase afileBase = GameUty.FileOpen(fileName, null)) { if (afileBase == null || !afileBase.IsValid()) { Debug.LogError("アイテムメニューファイルが見つかりません。" + fileName); return null; } buffer = afileBase.ReadAll(); } Menu.MenuHeader result; using (MemoryStream memoryStream = new MemoryStream(buffer)) { BinaryReader br = new BinaryReader(memoryStream, Encoding.UTF8); Menu.MenuHeader menuHeader = new Menu.MenuHeader(); if (!menuHeader.Deserialize(br)) { result = null; } else { result = menuHeader; } } return result; } public static bool ProcScript(Maid maid, string filename, bool f_bTemp = false, SubProp f_SubProp = null) { return Menu.ProcScript(maid, new MaidProp { strFileName = filename, strTempFileName = filename }, f_bTemp, f_SubProp); } public static bool ProcScript(Maid maid, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null) { string text; if (f_bTemp) { text = mp.strTempFileName; } else { text = mp.strFileName; } bool flag = false; string text2 = string.Empty; byte[] array = null; if (text.IndexOf("mod_") == 0) { flag = true; text2 = Menu.GetModPathFileName(text); if (string.IsNullOrEmpty(text2)) { return false; } text = Menu.GetBaseItemFromMod(text2); try { using (FileStream fileStream = new FileStream(text2, FileMode.Open)) { if (fileStream == null) { Debug.LogWarning("MODアイテムメニューファイルが見つかりません。" + text); return false; } array = new byte[fileStream.Length]; fileStream.Read(array, 0, (int)fileStream.Length); } } catch (Exception ex) { Debug.LogError("ProcScript MODアイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex.Message); return false; } } byte[] cd = null; try { using (AFileBase afileBase = GameUty.FileOpen(text, null)) { if (afileBase == null || !afileBase.IsValid()) { Debug.LogError("アイテムメニューファイルが見つかりません。" + text); return false; } cd = afileBase.ReadAll(); } } catch (Exception ex2) { Debug.LogError("ProcScript アイテムメニューファイルが読み込めませんでした。 : " + text + " : " + ex2.Message); return false; } Menu.ProcScriptBin(maid, cd, mp, f_bTemp, f_SubProp); if (flag) { Menu.ProcModScriptBin(maid, array, text2, mp, false); } return true; } private static void ProcScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false, SubProp f_SubProp = null) { Menu.ProcScriptBin(maid, cd, new MaidProp { strFileName = filename, strTempFileName = filename }, f_bTemp, f_SubProp); } private static void ProcScriptBin(Maid maid, byte[] cd, MaidProp mp, bool f_bTemp = false, SubProp f_SubProp = null) { string filename; if (f_bTemp) { filename = mp.strTempFileName; } else { filename = mp.strFileName; } Action errorCallBack = delegate(string errorText) { NDebug.Assert(errorText + " : " + filename, false); }; TBody body = maid.body0; if (mp.idx == 160 || mp.idx == 161 || mp.idx == 162 || mp.idx == 163) { TBodySkin slot = body.GetSlot(1); if (slot.PartsVersion < 110) { return; } } List list = new List(); BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text); int num = binaryReader.ReadInt32(); string text2 = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); string text4 = binaryReader.ReadString(); string text5 = binaryReader.ReadString(); long num2 = (long)binaryReader.ReadInt32(); bool flag = false; string text6 = string.Empty; string text7 = string.Empty; string text8 = string.Empty; string text9 = string.Empty; int num3 = 100; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; int num4 = 0; HashSet hashSet = new HashSet(); for (;;) { try { for (;;) { IL_142: int num5 = (int)binaryReader.ReadByte(); text7 = text6; text6 = string.Empty; if (num5 == 0) { break; } for (int i = 0; i < num5; i++) { text6 = text6 + "\"" + binaryReader.ReadString() + "\" "; } if (!(text6 == string.Empty)) { goto IL_1A9; } } break; IL_1A9: string stringCom = UTY.GetStringCom(text6); string[] stringList = UTY.GetStringList(text6); if (stringCom == "end") { break; } if (stringCom == "name") { goto IL_211D; } if (stringCom == "ver") { TBodySkin slot2 = body.GetSlot(stringList[1], num4); num3 = int.Parse(stringList[2]); goto IL_211D; } if (stringCom == "crc_exp") { flag2 = true; goto IL_211D; } if (stringCom == "crc_def_exp") { flag3 = true; goto IL_211D; } if (stringCom == "crc_target_slotno") { num4 = int.Parse(stringList[1]); goto IL_211D; } if (stringCom == "crc_part_hide_slot") { TBodySkin slot3 = body.GetSlot(stringList[1], num4); slot3.crcPartHideVisible = bool.Parse(stringList[2]); goto IL_211D; } if (stringCom == "crc_part_hide_move") { TBodySkin slot4 = body.GetSlot(stringList[1], num4); ImportCM.ImportSavedAttachDataGP03(stringList[2], slot4); goto IL_211D; } if (stringCom == "crc_mayu_front") { bool flag6 = bool.Parse(stringList[1]); maid.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!flag6) ? "1" : "7", true); maid.body0.SetMaterialProperty("mayu", "head", 12, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!flag6) ? "1" : "7", true); goto IL_211D; } if (stringCom == "crc_mayu_alpha") { float num6 = float.Parse(stringList[1]); maid.body0.SetMaterialProperty("mayu", "head", 3, "_Color", "Color", "1.0:1.0:1.0:" + num6.ToString(), true); maid.body0.SetMaterialProperty("mayu", "head", 12, "_Color", "Color", "1.0:1.0:1.0:" + num6.ToString(), true); goto IL_211D; } if (stringCom == "parthidemove") { TBodySkin slot5 = body.GetSlot(stringList[4], num4); slot5.LoadOrNewAttachPoint(stringList[1]); goto IL_211D; } if (stringCom == "アイテム") { MPN mpn = Menu.SetMaidItemTemp(maid, stringList[1], f_bTemp); if (maid.IsCrcBody && stringList[1].Contains("_del") && mpn != MPN.null_mpn) { hashSet.Add(mpn); goto IL_46B; } goto IL_46B; IL_46B: goto IL_211D; } if (stringCom == "alldelmenu") { using (Dictionary.Enumerator enumerator = CM3.dicDelItem.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair keyValuePair = enumerator.Current; Menu.SetMaidItemTemp(maid, keyValuePair.Value, false); } goto IL_4CC; } IL_4CC: goto IL_211D; } if (stringCom == "アイテム条件") { string slotname = stringList[1]; if (stringList[2] == "に何か") { bool flag7 = false; TBodySkin slot6 = body.GetSlot(slotname); if (stringList[3] == "有る") { if (slot6.obj != null) { flag7 = true; } } else if (stringList[3] == "無い") { if (slot6.obj == null) { flag7 = true; } } else { NDebug.Assert("アイテム条件が不正です。「有る」か「無い」かを指定してください。\n" + text6, false); } if (stringList[4] == "なら") { if (flag7) { Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp); goto IL_59D; } goto IL_59D; IL_59D: goto IL_5B4; } NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false); goto IL_5B4; IL_5B4: goto IL_6EA; } if (stringList[2] == "が") { bool flag8 = false; TBodySkin slot7 = body.GetSlot(slotname); if (slot7.m_strModelFileName == stringList[3]) { flag8 = true; } if (stringList[4] == "なら") { if (flag8) { Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp); goto IL_61A; } goto IL_61A; IL_61A: goto IL_631; } NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false); goto IL_631; IL_631: goto IL_6EA; } if (!(stringList[2] == "のアイテムパラメータの")) { goto IL_6EA; } bool flag9 = false; TBodySkin slot8 = body.GetSlot(slotname); string param = slot8.GetParam(stringList[3].ToLower()); if (stringList[4] == "が") { if (stringList[5].ToLower() == param) { flag9 = true; } } else { NDebug.Assert("アイテム条件が不正です。「が」が必要です。\n" + text6, false); } if (stringList[6] == "なら") { if (flag9) { Menu.SetMaidItemTemp(maid, stringList[7], f_bTemp); goto IL_6D3; } goto IL_6D3; IL_6D3: goto IL_6EA; } NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text6, false); goto IL_6EA; IL_6EA: goto IL_211D; } if (stringCom == "if") { if (stringList[1].IndexOf("maidprop[") == 0) { string value = stringList[1].Substring(9, stringList[1].Length - 9 - 1); MPN mpn2 = (MPN)Enum.Parse(typeof(MPN), value, false); MaidProp prop = maid.GetProp(mpn2); if (!(stringList[2] == "==") || !(stringList[3] == "nothing") || prop.nFileNameRID != 0 || !(stringList[4] == "?") || stringList[5].IndexOf("setprop[") != 0) { goto IL_86A; } string value2 = stringList[5].Substring(8, stringList[5].Length - 8 - 1); MPN idx = (MPN)Enum.Parse(typeof(MPN), value2, false); if (!(stringList[6] == "=")) { goto IL_86A; } string text10; if (stringList[7].IndexOf("getprop[") == 0) { string value3 = stringList[7].Substring(8, stringList[7].Length - 8 - 1); MPN mpn3 = (MPN)Enum.Parse(typeof(MPN), value3, false); MaidProp prop2 = maid.GetProp(mpn3); text10 = prop2.strFileName; } else { text10 = stringList[7]; } if (!string.IsNullOrEmpty(text10)) { maid.SetProp(idx, text10, 0, false, false); goto IL_86A; } goto IL_86A; IL_86A: goto IL_94D; } if (stringList[1].IndexOf("slot[") != 0) { goto IL_94D; } string[] array = stringList[1].Split(new char[] { '.' }); string value4 = array[0].Substring(5, array[0].Length - 5 - 1); TBody.SlotID f_nSlotNo = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), value4, true); TBodySkin slot9 = maid.body0.GetSlot((int)f_nSlotNo); if (2 > array.Length || !(array[1] == "ver") || !(stringList[2] == "<")) { goto IL_94D; } int num7 = int.Parse(stringList[3]); if (slot9.PartsVersion < num7 && stringList[4] == "?" && stringList[5] == "skip") { break; } goto IL_94D; IL_94D: goto IL_211D; } if (stringCom == "setprop") { if (stringList[1].IndexOf("setprop[") != 0) { goto IL_A37; } string value5 = stringList[1].Substring(8, stringList[1].Length - 8 - 1); MPN idx2 = (MPN)Enum.Parse(typeof(MPN), value5, true); if (!(stringList[2] == "=")) { goto IL_A37; } string text11; if (stringList[3].IndexOf("getprop[") == 0) { string value6 = stringList[3].Substring(8, stringList[3].Length - 8 - 1); MPN mpn4 = (MPN)Enum.Parse(typeof(MPN), value6, true); MaidProp prop3 = maid.GetProp(mpn4); text11 = prop3.strFileName; } else { text11 = stringList[3]; } if (!string.IsNullOrEmpty(text11)) { maid.SetProp(idx2, text11, 0, false, false); goto IL_A37; } goto IL_A37; IL_A37: goto IL_211D; } if (stringCom == "アイテムパラメータ") { if (stringList.Length == 4) { string text12 = stringList[1]; string text13 = stringList[2].ToLower(); string text14 = stringList[3].ToLower(); list.Add(new Menu.LastParam(0, stringCom, new string[] { text12, text13, text14 })); goto IL_AAD; } Debug.LogError("アイテムパラメータ 命令の引数が不正です。SlotNameを明示的に指定しする必要があります。アイテムパラメータ <スロット名> <変数名> <値> の順です。" + text6); goto IL_AAD; IL_AAD: goto IL_211D; } if (stringCom == "半脱ぎ" || stringCom == "リソース参照") { string key; string value7; if (stringCom == "半脱ぎ") { key = "半脱ぎ"; value7 = stringList[1]; } else { key = stringList[1]; value7 = stringList[2]; } int hashCode = Path.GetFileName(filename.ToLower()).ToLower().GetHashCode(); SortedDictionary sortedDictionary; if (Menu.m_dicResourceRef.TryGetValue(hashCode, out sortedDictionary)) { string empty = string.Empty; if (sortedDictionary.TryGetValue(key, out empty)) { sortedDictionary[key] = value7; goto IL_B64; } sortedDictionary.Add(key, value7); goto IL_B64; IL_B64: goto IL_B89; } sortedDictionary = new SortedDictionary(); sortedDictionary.Add(key, value7); Menu.m_dicResourceRef.Add(hashCode, sortedDictionary); goto IL_B89; IL_B89: goto IL_211D; } if (stringCom == "set") { goto IL_211D; } if (stringCom == "setname") { goto IL_211D; } if (stringCom == "setslotitem") { string tag = stringList[1]; uint val = uint.Parse(stringList[2]); maid.SetProp(tag, (int)val, false); goto IL_211D; } if (stringCom == "additem") { string text15 = text8; if (stringList.Length > 1) { text15 = stringList[2]; } text9 = text15; if (text15 == "body") { body.LoadBody_R(stringList[1], maid, num3, flag2); } string attachSlot = string.Empty; string attachName = string.Empty; List> list2 = null; if (4 <= stringList.Length) { if (stringList[3] == "ボーンにアタッチ") { attachSlot = "ボーンにアタッチ"; attachName = stringList[4]; } else if (stringList[3] == "アタッチ") { attachSlot = stringList[4]; attachName = stringList[5]; } int num8 = Array.FindIndex(stringList, (string a) => a.ToLower().IndexOf("split") == 0); if (num8 != -1) { string[] array2 = stringList[num8].Split(new char[] { ':' }); string[] array3 = array2[1].Split(new char[] { '&' }); foreach (string text16 in array3) { string[] array5 = text16.Split(new char[] { '=' }); if (list2 == null) { list2 = new List>(); } TBody.SlotID item = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), array5[0], true); if (array5[1].Contains("<") || array5[1].Contains(">")) { string[] array6 = array5[1].Split(new char[] { '<', '>' }); array6[0] = array6[0].ToLower(); bool flag10 = false; if (array5[1].Contains("<")) { flag10 = true; } float pos = float.Parse(array6[1]); Vector3Int plane = default(Vector3Int); if (array6[0] == "x") { if (flag10) { plane.x = -1; } else { plane.x = 1; } } else if (array6[0] == "y") { if (flag10) { plane.y = -1; } else { plane.y = 1; } } else if (array6[0] == "z") { if (flag10) { plane.z = -1; } else { plane.z = 1; } } list2.Add(new Tuple(item, new TBodySkin.SplitParam { plane = plane, pos = pos })); } else { list2.Add(new Tuple(item, new TBodySkin.SplitParam { splitPartBone = array5[1].Split(new char[] { '|' }) })); } } } } if (text15 == "handitemr") { attachSlot = "ボーンにアタッチ"; attachName = "_IK_handR"; } if (text15 == "handiteml") { attachSlot = "ボーンにアタッチ"; attachName = "_IK_handL"; } if (list2 != null) { List list3 = new List(); for (int k = 0; k < list2.Count; k++) { Tuple tuple = list2[k]; if (k == 0) { tuple.Item2.pairSlotIds = list3; } else { list3.Add(tuple.Item1); } if (!flag2 || flag3 || string.Compare(text15, tuple.Item1.ToString(), true) == 0) { maid.body0.AddItem((MPN)Enum.Parse(typeof(MPN), text8, true), num4, tuple.Item1.ToString(), stringList[1], attachSlot, attachName, f_bTemp, num3, flag2, tuple.Item2); } } } else { body.AddItem((MPN)Enum.Parse(typeof(MPN), text8, true), num4, text15, stringList[1], attachSlot, attachName, f_bTemp, num3, flag2, null); } body.SetVisibleNodeSlot(text15, num4, true, "_ALL_"); goto IL_211D; } if (stringCom == "nofloory") { TBody.SlotID i2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true); body.goSlot[(int)i2].m_bHitFloorY = false; goto IL_211D; } if (stringCom == "saveitem") { text4 = stringList[1]; goto IL_211D; } if (stringCom == "category") { text8 = stringList[1]; flag4 = (text8 == "skin"); flag5 = (text8 == "haircolor"); goto IL_211D; } if (stringCom == "maskitem") { if (stringList.Length > 1) { string maskslot = stringList[1]; body.AddMask(text8, num4, maskslot); goto IL_10EE; } goto IL_10EE; IL_10EE: goto IL_211D; } if (stringCom == "delitem") { string slotname2 = text8; if (stringList.Length > 1) { slotname2 = stringList[1]; } body.DelItem((MPN)Enum.Parse(typeof(MPN), text8, true), slotname2); goto IL_211D; } if (stringCom == "node消去") { string slotname3 = text8; string text17; if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text17)) { slotname3 = text17; } body.SetVisibleNodeSlot(slotname3, num4, false, stringList[1]); goto IL_211D; } if (stringCom == "node表示") { string slotname4 = text8; string text18; if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text18)) { slotname4 = text18; } body.SetVisibleNodeSlot(slotname4, num4, true, stringList[1]); goto IL_211D; } if (stringCom == "パーツnode消去") { string slotname5 = text8; string text19; if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text19)) { slotname5 = text19; } body.SetVisibleNodeSlotParts(slotname5, num4, stringList[1], false, stringList[2]); goto IL_211D; } if (stringCom == "パーツnode表示") { string slotname6 = text8; string text20; if (Menu.ParseParamEquale(stringList, 2).TryGetValue("slot", out text20)) { slotname6 = text20; } body.SetVisibleNodeSlotParts(slotname6, num4, stringList[1], true, stringList[2]); goto IL_211D; } if (stringCom == "mask消去") { TBody.SlotID slot10; Parse.TryParse(stringList[1], out slot10, errorCallBack); maid.body0.AddSkinMask(slot10, num4, stringList[2]); goto IL_211D; } if (stringCom == "color") { string name = stringList[1]; int matno = int.Parse(stringList[2]); string prop_name = stringList[3]; Color col = new Color(float.Parse(stringList[4]) / 255f, float.Parse(stringList[5]) / 255f, float.Parse(stringList[6]) / 255f, float.Parse(stringList[7]) / 255f); body.ChangeCol(name, matno, prop_name, col); goto IL_211D; } if (stringCom == "mancolor") { Color manColor = new Color(float.Parse(stringList[1]) / 255f, float.Parse(stringList[2]) / 255f, float.Parse(stringList[3]) / 255f, 1f); maid.ManColor = manColor; maid.ManColorUpdate(); goto IL_211D; } if (stringCom == "tex" || stringCom == "テクスチャ変更") { string text21 = stringList[1]; string[] array7 = stringList[2].Split(new char[] { '&' }); int num9 = -1; if (2 <= array7.Length) { foreach (string text22 in array7) { string[] array9 = text22.Split(new char[] { '=' }); MPN mpn5 = (MPN)Enum.Parse(typeof(MPN), array9[0], true); if (mpn5 == (MPN)mp.idx) { int.TryParse(array9[1], out num9); break; } } if (num9 == -1) { NDebug.Assert("tex mat no error.", false); } } else { int.TryParse(array7[0], out num9); if (mp.idx == 160) { num9 = 7; } } string text23 = stringList[3]; string filename2 = stringList[4]; MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE; if (stringList.Length == 6) { string text24 = stringList[5]; try { parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text24.ToUpper()); } catch { NDebug.Assert("無限色IDがありません。" + text24, false); } } if (flag4 && parts_COLOR == MaidParts.PARTS_COLOR.SKIN) { if (text21 == "body" && num9 == 0 && text23.ToLower() == "_maintex") { body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex"); flag = true; body.ChangeTex(text21, 0, num9, "_OutlineTex", filename2, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE); body.ChangeTex(text21, 0, num9, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE); } else if (text21 == "head" && num9 == 5 && text23.ToLower() == "_maintex") { body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex"); flag = true; body.ChangeTex(text21, 0, num9, "_OutlineTex", filename2, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE); body.ChangeTex(text21, 0, num9, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE); } } if (Product.isEnglish && !Product.isPublic && flag4 && text21 == "body" && num9 == 0 && text23.ToLower() == "_maintex") { if (parts_COLOR == MaidParts.PARTS_COLOR.SKIN) { body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Tex_Texwidth"); } else { body.ChangeShader(text21, num9, "CM3D2_Toony_Lighted_Outline_Texwidth"); } body.ChangeTex(text21, 0, num9, "_OutlineWidthTex", "skin_en_outline_width.tex", null, MaidParts.PARTS_COLOR.NONE); flag = true; } body.ChangeTex(text21, 0, num9, text23, filename2, null, parts_COLOR); if (parts_COLOR != MaidParts.PARTS_COLOR.NONE) { maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR)); } if ((flag4 || flag5) && !flag) { body.RestoreShader(text21); goto IL_1683; } goto IL_1683; IL_1683: goto IL_211D; } if (stringCom == "prop") { string tag2 = stringList[1]; string s = stringList[2]; maid.SetProp(tag2, int.Parse(s), false); goto IL_211D; } if (stringCom == "テクスチャ乗算") { goto IL_211D; } if (stringCom == "テクスチャ合成") { if (stringList.Length != 7) { NDebug.Assert("テクスチャ合成 の引数が不正です。" + stringList.Length, false); } if ((text8 == "accTatoo" || text8 == "hokuro") && !filename.Contains("_del")) { body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), true, 0, 0, 0f, 0f, true, f_SubProp, 1f, 1024); goto IL_17EB; } body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), false, 0, 0, 0f, 0f, false, null, 1f, 1024); goto IL_17EB; IL_17EB: goto IL_211D; } if (stringCom == "テクスチャセット合成") { if (stringList.Length != 7) { NDebug.Assert("テクスチャセット合成 の引数が不正です。" + stringList.Length, false); } body.MulTexSet(stringList[1], int.Parse(stringList[2]), stringList[3], int.Parse(stringList[4]), stringList[5], (GameUty.SystemMaterial)Enum.Parse(typeof(GameUty.SystemMaterial), stringList[6]), true, 0, 0, 0f, 0f, true, null, 1f, 1024); goto IL_211D; } if (stringCom == "マテリアル変更") { string f_strSlotName = stringList[1]; int f_nMatNo = int.Parse(stringList[2]); string f_strFileName = stringList[3]; body.ChangeMaterial(f_strSlotName, f_nMatNo, f_strFileName); goto IL_211D; } if (stringCom == "shader") { string f_strSlotName2 = stringList[1]; int f_nMatNo2 = int.Parse(stringList[2]); string f_strShaderFileName = stringList[3]; body.ChangeShader(f_strSlotName2, f_nMatNo2, f_strShaderFileName); flag = true; goto IL_211D; } if (stringCom == "アタッチポイントの設定") { if (stringList.Length < 5) { Debug.LogError("アタッチポイントの設定引数の数が不正です。 " + text6 + " " + text2); goto IL_19B0; } Vector3 v = new Vector3(float.Parse(stringList[2]), float.Parse(stringList[3]), float.Parse(stringList[4])); Quaternion q = Quaternion.identity; if (stringList.Length == 8) { q = Quaternion.Euler(float.Parse(stringList[5]), float.Parse(stringList[6]), float.Parse(stringList[7])); } else { Debug.LogError("アタッチポイントの設定引数に角度指定がありません。 " + text6 + " " + text2); } body.SetAttachPoint(text9, num4, stringList[1], v, q, f_bTemp); goto IL_19B0; IL_19B0: goto IL_211D; } if (stringCom == "blendset") { string blendSetName = stringList[1]; int num10 = (stringList.Length - 2) / 2; body.Face.morph.NewBlendSet(blendSetName); for (int m = 0; m < num10; m++) { string tag3 = stringList[2 + m * 2].ToLower(); float val2 = float.Parse(stringList[3 + m * 2]); body.Face.morph.SetValueBlendSet(blendSetName, tag3, val2); } goto IL_211D; } if (stringCom == "paramset") { body.Face.NewParamSet(text6); goto IL_211D; } if (stringCom == "commenttype") { if (!maid.status.partsDic.ContainsKey(stringList[1])) { maid.status.partsDic.Add(stringList[1], string.Empty); } maid.status.partsDic[stringList[1]] = stringList[2]; goto IL_211D; } if (stringCom == "useredit") { if (stringList[2].ToLower() == "material") { body.SetMaterialProperty(text8, stringList[3], int.Parse(stringList[4]), stringList[5], stringList[6], stringList[7], false); goto IL_1B08; } goto IL_1B08; IL_1B08: goto IL_211D; } if (stringCom == "bonemorph") { if (9 > stringList.Length || stringList.Length > 10) { Debug.LogError("BoneMorpの設定引数の数が不正です。 " + text6 + " " + text2); } if (stringList.Length == 9) { body.bonemorph.ChangeMorphPosValue(stringList[1], stringList[2], new Vector3(float.Parse(stringList[3]), float.Parse(stringList[4]), float.Parse(stringList[5])), new Vector3(float.Parse(stringList[6]), float.Parse(stringList[7]), float.Parse(stringList[8]))); goto IL_1CCE; } string text25 = stringList[1].ToLower(); string strPropName = stringList[2]; string f_strBoneName = stringList[3]; Vector3 f_fAddMin = new Vector3(float.Parse(stringList[4]), float.Parse(stringList[5]), float.Parse(stringList[6])); Vector3 f_fAddMax = new Vector3(float.Parse(stringList[7]), float.Parse(stringList[8]), float.Parse(stringList[9])); if (text25 != null) { if (text25 == "pos") { body.bonemorph.ChangeMorphPosValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax); goto IL_1CCE; } if (text25 == "rot") { body.bonemorph.ChangeMorphRotatioValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax); goto IL_1CCE; } if (text25 == "scl") { body.bonemorph.ChangeMorphSclValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax); goto IL_1CCE; } } Debug.LogError(string.Concat(new string[] { "BoneMorpのタイプ指定が不正です[", text25, "]\n", text6, " ", text2 })); goto IL_1CCE; IL_1CCE: goto IL_211D; } if (stringCom == "length") { if (stringList.Length != 11) { Debug.LogError("lengthの設定引数の数が不正です。 " + text6 + " " + text2); } body.SetHairLengthDataList(stringList[1], 0, stringList[2], stringList[3], stringList[4], new Vector3(float.Parse(stringList[5]), float.Parse(stringList[6]), float.Parse(stringList[7])), new Vector3(float.Parse(stringList[8]), float.Parse(stringList[9]), float.Parse(stringList[10]))); goto IL_211D; } if (stringCom == "anime") { if (stringList.Length < 3) { Debug.LogError("animeの設定引数の数が不正です。 " + text6 + " " + text2); } TBody.SlotID f_slot = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true); body.ItemAnimationLoad(f_slot, stringList[2]); bool f_bLoop = false; if (3 < stringList.Length) { f_bLoop = (stringList[3] == "loop"); } body.ItemAnimationPlay(f_slot, stringList[2], f_bLoop); goto IL_211D; } if (stringCom == "param2") { if (stringList.Length == 4) { string slotname7 = stringList[1]; body.GetSlot(slotname7).SetParam2(stringList[2], stringList[3]); goto IL_1E42; } Debug.LogError("param2の設定引数の数が不正です。 " + text6 + " " + text2); goto IL_1E42; IL_1E42: goto IL_211D; } if (stringCom == "animematerial") { TBody.SlotID f_slot2 = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true); string s2 = stringList[2]; body.MaterialAnimatorAdd(f_slot2, int.Parse(s2)); goto IL_211D; } if (stringCom == "meshmorph") { string value8 = stringList[1]; string blendName = stringList[2]; string[] array10 = stringList[3].Split(new char[] { '=' }); int num11 = 0; if (string.Compare(array10[0], "def", true) == 0) { num11 = int.Parse(array10[1]); } TMorphSkin.BaseBlendValue.Tag tag4 = (TMorphSkin.BaseBlendValue.Tag)Enum.Parse(typeof(TMorphSkin.BaseBlendValue.Tag), value8); TBody.SlotID parentSlotId = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), text9); maid.body0.AddBaseBlendValue(parentSlotId, tag4, blendName, (float)num11 * 0.01f); goto IL_211D; } if (stringCom == "addbonemorph") { TBody.SlotID slotID; Parse.TryParse(stringList[1], out slotID, errorCallBack); string text26 = stringList[2]; NDebug.Assert(slotID == TBody.SlotID.wear && text26 == "裾", "AddBoneMorph is SlotID.wear and 裾 only."); TBodySkin.MyBoneMorph myBoneMorph = null; List list4 = new List(); for (int n = 3; n < stringList.Length; n++) { string text27 = stringList[n]; string[] array11 = text27.Split(new char[] { '=' }); if (array11.Length == 2) { string[] array12 = array11[1].Split(new char[] { '~' }); Vector3 vector; Parse.TryParse(array12[0], out vector, errorCallBack); Vector3 vector2; Parse.TryParse(array12[1], out vector2, errorCallBack); if (string.Compare(array11[0], "pos", true) == 0) { myBoneMorph.usePos = true; myBoneMorph.pos = vector; myBoneMorph.pos2 = vector2; } else if (string.Compare(array11[0], "rot", true) == 0) { myBoneMorph.useRot = true; myBoneMorph.rot = vector; myBoneMorph.rot2 = vector2; } else if (string.Compare(array11[0], "scl", true) == 0) { myBoneMorph.useScl = true; myBoneMorph.scl = vector; myBoneMorph.scl2 = vector2; } else { Debug.LogError("AddBoneMorph Error can't parse trs type = " + array11[0]); } } else { myBoneMorph = new TBodySkin.MyBoneMorph { name = text26, targetBoneName = stringList[n] }; list4.Add(myBoneMorph); } } maid.body0.AddMyBoneMorph(slotID, text26, list4); goto IL_211D; } if (stringCom == "乳首") { string text28 = stringList[1]; TBody.SlotID slotId; Parse.TryParse(text9, out slotId, errorCallBack); TBodySkin.CHIKUBI_STATE state; Parse.TryParse(text28, out state, errorCallBack); maid.body0.AddChikubiState(slotId, num4, state); goto IL_211D; } goto IL_211D; IL_211D: goto IL_218D; } catch (Exception ex) { Debug.LogError(string.Concat(new string[] { "Exception ", Path.GetFileName(filename), " 現在処理中だった行 = ", text6, " 以前の行 = ", text7, " ", ex.Message, "StackTrace:\n", ex.StackTrace })); throw ex; } IL_218D: goto IL_142; } list.Sort((Menu.LastParam a, Menu.LastParam b) => a.nOrder - a.nOrder); for (int num12 = 0; num12 < list.Count; num12++) { Menu.LastParam lastParam = list[num12]; if (lastParam.strComm == "アイテムパラメータ") { TBodySkin slot11 = body.GetSlot(lastParam.aryArgs[0]); slot11.SetParam(lastParam.aryArgs[1], lastParam.aryArgs[2]); } } if (maid.IsCrcBody && hashSet.Contains(MPN.acchat) && hashSet.Contains(MPN.headset)) { Menu.SetMaidItemTemp(maid, CM3.dicDelItem[MPN.acchead], f_bTemp); } binaryReader.Close(); binaryReader = null; } private static Dictionary ParseParamEquale(string[] args, int startIdx) { Dictionary dictionary = new Dictionary(); for (int i = startIdx; i < args.Length; i++) { string[] array = args[i].Split(new char[] { '=' }); if (array.Length == 2) { dictionary[array[0]] = array[1]; } } return dictionary; } public static MPN SetMaidItemTemp(Maid maid, string filename, bool f_bTemp = false) { byte[] buffer = null; try { if (!GameUty.IsExistFile(filename, null)) { return MPN.null_mpn; } using (AFileBase afileBase = GameUty.FileOpen(filename, null)) { if (!afileBase.IsValid()) { NDebug.Assert("メニューファイルが見つかりません。" + filename, false); } buffer = afileBase.ReadAll(); } } catch (Exception ex) { Debug.LogError("ProcScriptBin/SetMaidItemTemp アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message); } BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin/SetMaidItemTemp 例外 : " + filename + " のヘッダーが不正です。" + text); int num = binaryReader.ReadInt32(); string text2 = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); string text4 = binaryReader.ReadString(); if (text4 == "acctatoo") { maid.DelProp(MPN.acctatoo, false); maid.SetSubProp(MPN.acctatoo, 0, filename, 0); } else if (text4 == "hokuro") { maid.DelProp(MPN.hokuro, false); maid.SetSubProp(MPN.hokuro, 0, filename, 0); } else { maid.SetProp(text4, filename, 0, f_bTemp, false); } MPN result = MPN.null_mpn; try { result = (MPN)Enum.Parse(typeof(MPN), text4, true); } catch (Exception ex2) { } return result; } public static bool ExportModScript(Maid maid, string filename, bool f_bTemp = false) { byte[] cd = null; try { using (AFileBase afileBase = GameUty.FileSystem.FileOpen(filename)) { if (!afileBase.IsValid()) { Debug.LogWarning("アイテムメニューファイルが見つかりません。" + filename); return false; } cd = afileBase.ReadAll(); } } catch (Exception ex) { Debug.LogError("ExportModScript アイテムメニューファイルが読み込めませんでした。 : " + filename + " : " + ex.Message); } string str = UTY.gameProjectPath + "\\"; string text = str + "ModExport"; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } string text2 = "mod_" + Path.GetFileNameWithoutExtension(filename); text2 = text2.Trim(); text = text + "\\" + text2; if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } StreamWriter streamWriter = new StreamWriter(text + "\\" + text2 + ".txt", false, Encoding.UTF8); streamWriter.WriteLine("出力バージョン\t" + 1570); streamWriter.WriteLine("基本アイテム\t" + filename.Replace(" ", ":")); try { Menu.ExportModScript(maid, cd, streamWriter, text + "\\" + text2, f_bTemp); NUty.WinMessageBox(NUty.GetWindowHandle(), string.Concat(new string[] { "MODテンプレート出力完了\n", text, "\\", text2, ".txt" }), "MOD Compile Completed", 0); } catch (Exception ex2) { Debug.LogError("ExportModScript 例外 : " + filename + " : " + ex2.Message); } finally { streamWriter.Close(); streamWriter.Dispose(); streamWriter = null; } return true; } public static void ExportModScript(Maid maid, byte[] cd, StreamWriter sw, string filename, bool f_bTemp = false) { TBody body = maid.body0; List list = new List(); BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MENU", "ExportModScript 例外 : ヘッダーファイルが不正です。" + text); int num = binaryReader.ReadInt32(); string path = binaryReader.ReadString(); string str = binaryReader.ReadString(); sw.WriteLine("アイテム名\t" + str); string str2 = binaryReader.ReadString(); sw.WriteLine("カテゴリ名\t" + str2); string text2 = binaryReader.ReadString(); sw.WriteLine("説明\t" + text2.Replace("\n", "《改行》")); sw.WriteLine("アイコン\t" + Path.GetFileName(filename + ".png")); long num2 = (long)binaryReader.ReadInt32(); bool flag = false; List list2 = new List(); string text3 = string.Empty; string text4 = string.Empty; string empty = string.Empty; string empty2 = string.Empty; try { for (;;) { int num3 = (int)binaryReader.ReadByte(); text4 = text3; text3 = string.Empty; if (num3 == 0) { break; } for (int i = 0; i < num3; i++) { text3 = text3 + "\"" + binaryReader.ReadString() + "\" "; } if (!(text3 == string.Empty)) { string stringCom = UTY.GetStringCom(text3); string[] stringList = UTY.GetStringList(text3); if (stringCom == "end") { break; } if (!(stringCom == "name")) { if (stringCom == "icon" || stringCom == "icons") { string f_strFileName = stringList[1]; Texture2D texture2D = ImportCM.CreateTexture(f_strFileName); if (texture2D != null) { UTY.SaveImage(texture2D, filename + ".png"); } } else if (stringCom == "additem") { sw.WriteLine("アイテム変更"); string text5 = empty; if (stringList.Length > 1) { text5 = stringList[2]; } list2.Add(text5); sw.WriteLine("\tスロット名\t" + text5); TBodySkin slot = maid.body0.GetSlot(text5); foreach (Transform transform in slot.obj.GetComponentsInChildren(true)) { Renderer component = transform.GetComponent(); if (!(component == null) && component.materials != null) { Material[] materials = component.materials; for (int k = 0; k < materials.Length; k++) { Material f_mat = materials[k]; sw.WriteLine("\t\tマテリアル番号\t" + k); Menu.ModMaterial(f_mat, sw); } } } } else if (!(stringCom == "color")) { if (stringCom == "tex" || stringCom == "テクスチャ変更") { string text6 = stringList[1]; int num4 = int.Parse(stringList[2]); string str3 = stringList[3]; string text7 = stringList[4]; string text8 = (6 > stringList.Length) ? null : stringList[5]; if (!list2.Contains(text6)) { string text9 = "テクスチャ変更"; text9 = text9 + "\t" + text6; text9 = text9 + "\t" + num4; text9 = text9 + "\t" + str3; text9 = text9 + "\t" + text7; if (!string.IsNullOrEmpty(text8)) { text9 = text9 + "\t" + text8; } if (text7.Contains("*")) { string text10 = string.Empty; TBodySkin slot2 = maid.body0.GetSlot(text6); if (slot2 != null) { text10 += "参考)出力時のモデル名は "; text10 += Path.GetFileNameWithoutExtension(slot2.m_strModelFileName); text10 += " です。"; } sw.WriteLine("// * の部分は現在装着されているモデル名に置換されます。" + text10); } if (!string.IsNullOrEmpty(text8) && !flag) { string text11 = "// 無限色ID群 "; IEnumerator enumerator = Enum.GetValues(typeof(MaidParts.PARTS_COLOR)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; text11 = text11 + ((MaidParts.PARTS_COLOR)obj).ToString() + " "; } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } sw.WriteLine(text11); flag = true; } sw.WriteLine(text9); } } else if (stringCom == "テクスチャ合成") { string item = stringList[1]; int num5 = int.Parse(stringList[2]); string text12 = stringList[3]; string text13 = stringList[4]; if (!list2.Contains(item)) { } } else if (stringCom == "マテリアル変更") { string text14 = stringList[1]; int num6 = int.Parse(stringList[2]); string text15 = stringList[3]; if (!list2.Contains(text14)) { sw.WriteLine("マテリアル変更"); sw.WriteLine("\tスロット名\t" + text14); TBodySkin slot3 = maid.body0.GetSlot(text14); foreach (Transform transform2 in slot3.obj.GetComponentsInChildren(true)) { Renderer component2 = transform2.GetComponent(); if (!(component2 == null) && component2.materials != null) { Material[] materials2 = component2.materials; for (int m = 0; m < materials2.Length; m++) { Material f_mat2 = materials2[m]; sw.WriteLine("\t\tマテリアル番号\t" + m); Menu.ModMaterial(f_mat2, sw); } } } } } else if (stringCom == "color_set") { if (stringList.Length >= 3) { string text16 = stringList[2]; text16 = "mod_" + Path.GetFileNameWithoutExtension(text16) + ".mod"; sw.WriteLine("色セット\t" + stringList[1] + "\t" + text16); } else { sw.WriteLine("色セット\t" + stringList[1]); } MPN f_mpn = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower()); maid.ExportModBaseMenu(f_mpn); } } } } } } catch (Exception ex) { Debug.LogError(string.Concat(new string[] { "Exception ", Path.GetFileName(path), " 現在処理中だった行 = ", text3, " 以前の行 = ", text4, " ", ex.Message, "StackTrace:\n", ex.StackTrace })); NDebug.Assert("メニューファイル処理中にエラーが発生しました。" + Path.GetFileName(path), false); if (binaryReader != null) { binaryReader.Close(); binaryReader = null; } throw ex; } if (binaryReader != null) { binaryReader.Close(); binaryReader = null; } } public static string[] NeedTextureWildCard(string f_strTexName) { string[] array; if (f_strTexName.Contains("*")) { string strTexName = f_strTexName; strTexName = strTexName.Replace("*", ".*"); if (Menu.m_strAllTexInFileSys == null) { Menu.m_strAllTexInFileSys = GameUty.FileSystem.GetList(string.Empty, AFileSystemBase.ListType.AllFile); } array = Array.FindAll(Menu.m_strAllTexInFileSys, (string i) => new Regex(strTexName).IsMatch(i)); array = Array.FindAll(array, (string i) => new Regex("^((?!_i_).)*$").IsMatch(i)); IEnumerable source = array; if (Menu.<>f__mg$cache0 == null) { Menu.<>f__mg$cache0 = new Func(Path.GetFileName); } array = source.Select(Menu.<>f__mg$cache0).ToArray(); string strMatchGroup = strTexName.Replace(".*", "(?.*)"); array = array.Select(delegate(string i) { Match match = new Regex(strMatchGroup).Match(i); if (match.Success) { return match.Groups["WILD"].Value; } return i; }).ToArray(); } else { array = new string[] { Path.GetFileName(f_strTexName) }; } return array; } private static void ModMaterial(Material f_mat, StreamWriter f_sw) { for (int i = 0; i < Menu.material_properties.GetLength(0); i++) { if (f_mat.HasProperty(Menu.material_properties[i, 0])) { if (Menu.material_properties[i, 1] == "tex") { Texture texture = f_mat.GetTexture(Menu.material_properties[i, 0]); f_sw.WriteLine("\t\t\tテクスチャ設定\t" + Menu.material_properties[i, 0] + "\t" + texture.name); } else if (Menu.material_properties[i, 1] == "col") { Color color = f_mat.GetColor(Menu.material_properties[i, 0]); f_sw.WriteLine(string.Concat(new object[] { "\t\t\t色設定\t", Menu.material_properties[i, 0], "\t", (int)(255f * color.r), "\t", (int)(255f * color.g), "\t", (int)(255f * color.b), "\t", (int)(255f * color.a) })); } else if (Menu.material_properties[i, 1] == "f") { float @float = f_mat.GetFloat(Menu.material_properties[i, 0]); f_sw.WriteLine(string.Concat(new object[] { "\t\t\t数値設定\t", Menu.material_properties[i, 0], "\t", @float })); } } } } private static string GetBaseItemFromMod(string f_strModMenu) { string empty = string.Empty; FileStream fileStream = new FileStream(f_strModMenu, FileMode.Open); if (fileStream == null) { return string.Empty; } BinaryReader binaryReader = new BinaryReader(fileStream); string a = binaryReader.ReadString(); NDebug.Assert(a == "CM3D2_MOD", "セーブデータファイルのヘッダーが不正です。_MOD"); int num = binaryReader.ReadInt32(); string text = binaryReader.ReadString(); string text2 = binaryReader.ReadString(); text2 = text2.Replace(":", " "); string text3 = binaryReader.ReadString(); string text4 = binaryReader.ReadString(); string text5 = binaryReader.ReadString(); binaryReader.Close(); fileStream.Close(); fileStream.Dispose(); return text2; } private static void ProcModScriptBin(Maid maid, byte[] cd, string filename, bool f_bTemp = false) { Menu.ProcModScriptBin(maid, cd, filename, null, f_bTemp); } private static void ProcModScriptBin(Maid maid, byte[] cd, string filename, MaidProp mp, bool f_bTemp = false) { if (mp != null && maid.body0 != null && (mp.idx == 160 || mp.idx == 161 || mp.idx == 162 || mp.idx == 163)) { TBodySkin slot = maid.body0.GetSlot(1); if (slot.PartsVersion < 110) { return; } } BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MOD", "ProcModScriptBin 例外 : ヘッダーファイルが不正です。" + text); int num = binaryReader.ReadInt32(); string text2 = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); string text4 = binaryReader.ReadString(); string text5 = binaryReader.ReadString(); string text6 = binaryReader.ReadString(); string text7 = binaryReader.ReadString(); MPN mpn = MPN.null_mpn; try { mpn = (MPN)Enum.Parse(typeof(MPN), text7); } catch { NDebug.Assert("カテゴリがありません。" + text7, false); } string text8 = string.Empty; if (mpn != MPN.null_mpn) { text8 = binaryReader.ReadString(); } string s = binaryReader.ReadString(); int num2 = binaryReader.ReadInt32(); Dictionary dictionary = new Dictionary(); for (int i = 0; i < num2; i++) { string key = binaryReader.ReadString(); int count = binaryReader.ReadInt32(); byte[] value = binaryReader.ReadBytes(count); dictionary.Add(key, value); } binaryReader.Close(); binaryReader = null; using (StringReader stringReader = new StringReader(s)) { Menu.IMode mode = Menu.IMode.Non; string slotname = string.Empty; TBodySkin tbodySkin = null; Material material = null; int num3 = 0; string text9; while ((text9 = stringReader.ReadLine()) != null) { string[] array = text9.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array[0] == "アイテム変更" || array[0] == "マテリアル変更") { mode = Menu.IMode.ItemChange; } else if (array[0] == "テクスチャ変更") { mode = Menu.IMode.TexChange; } if (mode == Menu.IMode.ItemChange) { if (array[0] == "スロット名") { slotname = array[1]; tbodySkin = maid.body0.GetSlot(slotname); } if (tbodySkin != null) { if (array[0] == "マテリアル番号") { num3 = int.Parse(array[1]); foreach (Transform transform in tbodySkin.obj.GetComponentsInChildren(true)) { Renderer component = transform.GetComponent(); if (!(component == null) && component.materials != null) { Material[] materials = component.materials; for (int k = 0; k < materials.Length; k++) { if (k == num3) { material = materials[k]; break; } } } } } if (material != null) { if (array[0] == "テクスチャ設定") { maid.body0.ChangeTex(slotname, 0, num3, array[1], array[2].ToLower(), dictionary, MaidParts.PARTS_COLOR.NONE); } else if (array[0] == "色設定") { material.SetColor(array[1], new Color(float.Parse(array[2]) / 255f, float.Parse(array[3]) / 255f, float.Parse(array[4]) / 255f, float.Parse(array[5]) / 255f)); } else if (array[0] == "数値設定") { material.SetFloat(array[1], float.Parse(array[2])); } } } } else if (mode == Menu.IMode.TexChange) { MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE; if (array.Length == 6) { string text10 = array[5]; try { parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper()); } catch { NDebug.Assert("無限色IDがありません。" + text10, false); } } int matno = int.Parse(array[2]); if (mp != null && mp.idx == 160) { matno = 7; } maid.body0.ChangeTex(array[1], 0, matno, array[3], array[4].ToLower(), dictionary, parts_COLOR); if (parts_COLOR != MaidParts.PARTS_COLOR.NONE) { maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR)); } } } } } // Note: this type is marked as 'beforefieldinit'. static Menu() { string[,] array = new string[31, 2]; array[0, 0] = "_MainTex"; array[0, 1] = "tex"; array[1, 0] = "_BumpMap"; array[1, 1] = "tex"; array[2, 0] = "_ToonRamp"; array[2, 1] = "tex"; array[3, 0] = "_ShadowTex"; array[3, 1] = "tex"; array[4, 0] = "_ShadowRateToon"; array[4, 1] = "tex"; array[5, 0] = "_SpecularTex"; array[5, 1] = "tex"; array[6, 0] = "_AnisoTex"; array[6, 1] = "tex"; array[7, 0] = "_RenderTex"; array[7, 1] = "tex"; array[8, 0] = "_HiTex"; array[8, 1] = "tex"; array[9, 0] = "_OutlineTex"; array[9, 1] = "tex"; array[10, 0] = "_OutlineToonRamp"; array[10, 1] = "tex"; array[11, 0] = "_Color"; array[11, 1] = "col"; array[12, 0] = "_ShadowColor"; array[12, 1] = "col"; array[13, 0] = "_RimColor"; array[13, 1] = "col"; array[14, 0] = "_SpecColor"; array[14, 1] = "col"; array[15, 0] = "_Emission"; array[15, 1] = "col"; array[16, 0] = "_ReflectColor"; array[16, 1] = "col"; array[17, 0] = "_OutlineColor"; array[17, 1] = "col"; array[18, 0] = "_MyLightColor0"; array[18, 1] = "col"; array[19, 0] = "_MyLightColor1"; array[19, 1] = "col"; array[20, 0] = "_TintColor"; array[20, 1] = "col"; array[21, 0] = "_ShadowColor"; array[21, 1] = "col"; array[22, 0] = "_Shininess"; array[22, 1] = "f"; array[23, 0] = "_FurLength"; array[23, 1] = "f"; array[24, 0] = "_OutlineWidth"; array[24, 1] = "f"; array[25, 0] = "_Cutoff"; array[25, 1] = "f"; array[26, 0] = "_AnisoOffset"; array[26, 1] = "f"; array[27, 0] = "_RimPower"; array[27, 1] = "f"; array[28, 0] = "_RimShift"; array[28, 1] = "f"; array[29, 0] = "_HiRate"; array[29, 1] = "f"; array[30, 0] = "_HiPow"; array[30, 1] = "f"; Menu.material_properties = array; } public static SortedDictionary> m_dicResourceRef = new SortedDictionary>(); private static string[] m_strAllTexInFileSys = null; private static string[,] material_properties; [CompilerGenerated] private static Func <>f__mg$cache0; public class MenuHeader { public bool Deserialize(BinaryReader br) { string a = br.ReadString(); if (!string.Equals(a, "CM3D2_MENU")) { Debug.LogError("ProcScriptBin 例外 : ヘッダーファイルが不正です。"); return false; } this.version = br.ReadInt32(); this.srcFileName = br.ReadString(); this.itemName = br.ReadString(); this.category = br.ReadString(); this.infoText = br.ReadString(); return true; } public int version; public string srcFileName; public string itemName; public string category; public string infoText; } private class LastParam { public LastParam(int f_nOrder, string f_strComm, params string[] f_argArgs) { this.nOrder = f_nOrder; this.strComm = f_strComm; this.aryArgs = new string[f_argArgs.Length]; f_argArgs.CopyTo(this.aryArgs, 0); } public int nOrder; public string strComm = string.Empty; public string[] aryArgs; } private enum IMode { Non, ItemChange, TexChange } }