123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539 |
- 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 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<string>(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 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 text;
- if (f_bTemp)
- {
- text = mp.strTempFileName;
- }
- else
- {
- text = mp.strFileName;
- }
- TBody body = maid.body0;
- if (mp.idx == 61 || mp.idx == 64 || mp.idx == 65 || mp.idx == 66)
- {
- TBodySkin slot = body.GetSlot(1);
- if (slot.PartsVersion < 110)
- {
- return;
- }
- }
- List<Menu.LastParam> list = new List<Menu.LastParam>();
- BinaryReader binaryReader = new BinaryReader(new MemoryStream(cd), Encoding.UTF8);
- string text2 = binaryReader.ReadString();
- NDebug.Assert(text2 == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text2);
- int num = binaryReader.ReadInt32();
- string text3 = binaryReader.ReadString();
- string text4 = binaryReader.ReadString();
- string text5 = binaryReader.ReadString();
- string text6 = binaryReader.ReadString();
- long num2 = (long)binaryReader.ReadInt32();
- bool flag = false;
- string text7 = string.Empty;
- string text8 = string.Empty;
- string text9 = string.Empty;
- string slotname = string.Empty;
- int version = 100;
- bool flag2 = false;
- bool flag3 = false;
- for (;;)
- {
- try
- {
- for (;;)
- {
- IL_108:
- int num3 = (int)binaryReader.ReadByte();
- text8 = text7;
- text7 = string.Empty;
- if (num3 == 0)
- {
- break;
- }
- for (int i = 0; i < num3; i++)
- {
- text7 = text7 + "\"" + binaryReader.ReadString() + "\" ";
- }
- if (!(text7 == string.Empty))
- {
- goto IL_16F;
- }
- }
- break;
- IL_16F:
- string stringCom = UTY.GetStringCom(text7);
- string[] stringList = UTY.GetStringList(text7);
- if (stringCom == "end")
- {
- break;
- }
- if (stringCom == "name")
- {
- goto IL_1546;
- }
- if (stringCom == "ver")
- {
- TBodySkin slot2 = body.GetSlot(stringList[1]);
- version = int.Parse(stringList[2]);
- goto IL_1546;
- }
- if (stringCom == "アイテム")
- {
- Menu.SetMaidItemTemp(maid, stringList[1], f_bTemp);
- goto IL_1546;
- }
- if (stringCom == "アイテム条件")
- {
- string slotname2 = stringList[1];
- if (stringList[2] == "に何か")
- {
- bool flag4 = false;
- TBodySkin slot3 = body.GetSlot(slotname2);
- if (stringList[3] == "有る")
- {
- if (slot3.obj != null)
- {
- flag4 = true;
- }
- }
- else if (stringList[3] == "無い")
- {
- if (slot3.obj == null)
- {
- flag4 = true;
- }
- }
- else
- {
- NDebug.Assert("アイテム条件が不正です。「有る」か「無い」かを指定してください。\n" + text7, false);
- }
- if (stringList[4] == "なら")
- {
- if (flag4)
- {
- Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
- goto IL_2C9;
- }
- goto IL_2C9;
- IL_2C9:
- goto IL_2E0;
- }
- NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
- goto IL_2E0;
- IL_2E0:
- goto IL_414;
- }
- if (stringList[2] == "が")
- {
- bool flag5 = false;
- TBodySkin slot4 = body.GetSlot(slotname2);
- if (slot4.m_strModelFileName == stringList[3])
- {
- flag5 = true;
- }
- if (stringList[4] == "なら")
- {
- if (flag5)
- {
- Menu.SetMaidItemTemp(maid, stringList[5], f_bTemp);
- goto IL_345;
- }
- goto IL_345;
- IL_345:
- goto IL_35C;
- }
- NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
- goto IL_35C;
- IL_35C:
- goto IL_414;
- }
- if (!(stringList[2] == "のアイテムパラメータの"))
- {
- goto IL_414;
- }
- bool flag6 = false;
- TBodySkin slot5 = body.GetSlot(slotname2);
- string param = slot5.GetParam(stringList[3].ToLower());
- if (stringList[4] == "が")
- {
- if (stringList[5].ToLower() == param)
- {
- flag6 = true;
- }
- }
- else
- {
- NDebug.Assert("アイテム条件が不正です。「が」が必要です。\n" + text7, false);
- }
- if (stringList[6] == "なら")
- {
- if (flag6)
- {
- Menu.SetMaidItemTemp(maid, stringList[7], f_bTemp);
- goto IL_3FD;
- }
- goto IL_3FD;
- IL_3FD:
- goto IL_414;
- }
- NDebug.Assert("アイテム条件が不正です。「なら」が必要です。\n" + text7, false);
- goto IL_414;
- IL_414:
- goto IL_1546;
- }
- if (stringCom == "if")
- {
- if (stringList[1].IndexOf("maidprop[") != 0)
- {
- goto IL_594;
- }
- string value = stringList[1].Substring(9, stringList[1].Length - 9 - 1);
- MPN mpn = (MPN)Enum.Parse(typeof(MPN), value, false);
- MaidProp prop = maid.GetProp(mpn);
- if (!(stringList[2] == "==") || !(stringList[3] == "nothing") || prop.nFileNameRID != 0 || !(stringList[4] == "?") || stringList[5].IndexOf("setprop[") != 0)
- {
- goto IL_594;
- }
- 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_594;
- }
- string text10;
- if (stringList[7].IndexOf("getprop[") == 0)
- {
- string value3 = stringList[7].Substring(8, stringList[7].Length - 8 - 1);
- MPN mpn2 = (MPN)Enum.Parse(typeof(MPN), value3, false);
- MaidProp prop2 = maid.GetProp(mpn2);
- text10 = prop2.strFileName;
- }
- else
- {
- text10 = stringList[7];
- }
- if (!string.IsNullOrEmpty(text10))
- {
- maid.SetProp(idx, text10, 0, false, false);
- goto IL_594;
- }
- goto IL_594;
- IL_594:
- goto IL_1546;
- }
- if (stringCom == "アイテムパラメータ")
- {
- if (stringList.Length == 4)
- {
- string text11 = stringList[1];
- string text12 = stringList[2].ToLower();
- string text13 = stringList[3].ToLower();
- list.Add(new Menu.LastParam(0, stringCom, new string[]
- {
- text11,
- text12,
- text13
- }));
- goto IL_609;
- }
- Debug.LogError("アイテムパラメータ 命令の引数が不正です。SlotNameを明示的に指定しする必要があります。アイテムパラメータ <スロット名> <変数名> <値> の順です。" + text7);
- goto IL_609;
- IL_609:
- goto IL_1546;
- }
- if (stringCom == "半脱ぎ" || stringCom == "リソース参照")
- {
- string key;
- string value4;
- if (stringCom == "半脱ぎ")
- {
- key = "半脱ぎ";
- value4 = stringList[1];
- }
- else
- {
- key = stringList[1];
- value4 = stringList[2];
- }
- int hashCode = Path.GetFileName(text.ToLower()).ToLower().GetHashCode();
- SortedDictionary<string, string> sortedDictionary;
- if (Menu.m_dicResourceRef.TryGetValue(hashCode, out sortedDictionary))
- {
- string empty = string.Empty;
- if (sortedDictionary.TryGetValue(key, out empty))
- {
- sortedDictionary[key] = value4;
- goto IL_6BB;
- }
- sortedDictionary.Add(key, value4);
- goto IL_6BB;
- IL_6BB:
- goto IL_6E0;
- }
- sortedDictionary = new SortedDictionary<string, string>();
- sortedDictionary.Add(key, value4);
- Menu.m_dicResourceRef.Add(hashCode, sortedDictionary);
- goto IL_6E0;
- IL_6E0:
- goto IL_1546;
- }
- if (stringCom == "set")
- {
- goto IL_1546;
- }
- if (stringCom == "setname")
- {
- goto IL_1546;
- }
- if (stringCom == "setslotitem")
- {
- string tag = stringList[1];
- uint val = uint.Parse(stringList[2]);
- maid.SetProp(tag, (int)val, false);
- goto IL_1546;
- }
- if (stringCom == "additem")
- {
- string text14 = text9;
- if (stringList.Length > 1)
- {
- text14 = stringList[2];
- }
- slotname = text14;
- if (text14 == "body")
- {
- body.LoadBody_R(stringList[1], maid);
- }
- string attachSlot = string.Empty;
- string attachName = string.Empty;
- if (stringList.Length == 6)
- {
- if (stringList[3] == "アタッチ")
- {
- attachSlot = stringList[4];
- attachName = stringList[5];
- }
- }
- else if (stringList.Length == 5 && stringList[3] == "ボーンにアタッチ")
- {
- attachSlot = "ボーンにアタッチ";
- attachName = stringList[4];
- }
- if (text14 == "handitemr")
- {
- attachSlot = "ボーンにアタッチ";
- attachName = "_IK_handR";
- }
- if (text14 == "handiteml")
- {
- attachSlot = "ボーンにアタッチ";
- attachName = "_IK_handL";
- }
- body.AddItem((MPN)Enum.Parse(typeof(MPN), text9, true), text14, stringList[1], attachSlot, attachName, f_bTemp, version);
- body.SetVisibleNodeSlot(text14, true, "_ALL_");
- goto IL_1546;
- }
- if (stringCom == "nofloory")
- {
- TBody.SlotID index = (TBody.SlotID)Enum.Parse(typeof(TBody.SlotID), stringList[1], true);
- body.goSlot[(int)index].m_bHitFloorY = false;
- goto IL_1546;
- }
- if (stringCom == "saveitem")
- {
- text5 = stringList[1];
- goto IL_1546;
- }
- if (stringCom == "category")
- {
- text9 = stringList[1];
- flag2 = (text9 == "skin");
- flag3 = (text9 == "haircolor");
- goto IL_1546;
- }
- if (stringCom == "maskitem")
- {
- if (stringList.Length > 1)
- {
- string maskslot = stringList[1];
- body.AddMask(text9, maskslot);
- goto IL_92C;
- }
- goto IL_92C;
- IL_92C:
- goto IL_1546;
- }
- if (stringCom == "delitem")
- {
- string slotname3 = text9;
- if (stringList.Length > 1)
- {
- slotname3 = stringList[1];
- }
- body.DelItem((MPN)Enum.Parse(typeof(MPN), text9, true), slotname3);
- goto IL_1546;
- }
- if (stringCom == "node消去")
- {
- body.SetVisibleNodeSlot(text9, false, stringList[1]);
- goto IL_1546;
- }
- if (stringCom == "node表示")
- {
- body.SetVisibleNodeSlot(text9, true, stringList[1]);
- goto IL_1546;
- }
- if (stringCom == "パーツnode消去")
- {
- body.SetVisibleNodeSlotParts(text9, stringList[1], false, stringList[2]);
- goto IL_1546;
- }
- if (stringCom == "パーツnode表示")
- {
- body.SetVisibleNodeSlotParts(text9, stringList[1], true, stringList[2]);
- goto IL_1546;
- }
- 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_1546;
- }
- 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_1546;
- }
- if (stringCom == "tex" || stringCom == "テクスチャ変更")
- {
- string text15 = stringList[1];
- int num4 = int.Parse(stringList[2]);
- string text16 = stringList[3];
- string filename = stringList[4];
- MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.NONE;
- if (stringList.Length == 6)
- {
- string text17 = stringList[5];
- try
- {
- parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text17.ToUpper());
- }
- catch
- {
- NDebug.Assert("無限色IDがありません。" + text17, false);
- }
- }
- if (mp.idx == 61)
- {
- num4 = 7;
- }
- if (flag2 && parts_COLOR == MaidParts.PARTS_COLOR.SKIN)
- {
- if (text15 == "body" && num4 == 0 && text16.ToLower() == "_maintex")
- {
- body.ChangeShader(text15, num4, "CM3D2_Toony_Lighted_Outline_Tex");
- flag = true;
- body.ChangeTex(text15, num4, "_OutlineTex", filename, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
- body.ChangeTex(text15, num4, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
- }
- else if (text15 == "head" && num4 == 5 && text16.ToLower() == "_maintex")
- {
- body.ChangeShader(text15, num4, "CM3D2_Toony_Lighted_Outline_Tex");
- flag = true;
- body.ChangeTex(text15, num4, "_OutlineTex", filename, null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
- body.ChangeTex(text15, num4, "_OutlineToonRamp", "toonBlackA1.tex", null, MaidParts.PARTS_COLOR.SKIN_OUTLINE);
- }
- }
- if (Product.isEnglish && !Product.isPublic && flag2 && text15 == "body" && num4 == 0 && text16.ToLower() == "_maintex")
- {
- if (parts_COLOR == MaidParts.PARTS_COLOR.SKIN)
- {
- body.ChangeShader(text15, num4, "CM3D2_Toony_Lighted_Outline_Tex_Texwidth");
- }
- else
- {
- body.ChangeShader(text15, num4, "CM3D2_Toony_Lighted_Outline_Texwidth");
- }
- body.ChangeTex(text15, num4, "_OutlineWidthTex", "skin_en_outline_width.tex", null, MaidParts.PARTS_COLOR.NONE);
- flag = true;
- }
- body.ChangeTex(text15, num4, text16, filename, null, parts_COLOR);
- if (parts_COLOR != MaidParts.PARTS_COLOR.NONE)
- {
- maid.Parts.SetPartsColor(parts_COLOR, maid.Parts.GetPartsColor(parts_COLOR));
- }
- if ((flag2 || flag3) && !flag)
- {
- body.RestoreShader(text15);
- goto IL_D49;
- }
- goto IL_D49;
- IL_D49:
- goto IL_1546;
- }
- if (stringCom == "prop")
- {
- string tag2 = stringList[1];
- string s = stringList[2];
- maid.SetProp(tag2, int.Parse(s), false);
- goto IL_1546;
- }
- if (stringCom == "テクスチャ乗算")
- {
- goto IL_1546;
- }
- if (stringCom == "テクスチャ合成")
- {
- if (stringList.Length != 7)
- {
- NDebug.Assert("テクスチャ合成 の引数が不正です。" + stringList.Length, false);
- }
- if ((text9 == "accTatoo" || text9 == "hokuro") && !text.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_EAC;
- }
- 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_EAC;
- IL_EAC:
- goto IL_1546;
- }
- 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_1546;
- }
- 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_1546;
- }
- 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_1546;
- }
- if (stringCom == "アタッチポイントの設定")
- {
- if (stringList.Length < 5)
- {
- Debug.LogError("アタッチポイントの設定引数の数が不正です。 " + text7 + " " + text3);
- goto IL_106F;
- }
- 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("アタッチポイントの設定引数に角度指定がありません。 " + text7 + " " + text3);
- }
- body.SetAttachPoint(slotname, stringList[1], v, q, f_bTemp);
- goto IL_106F;
- IL_106F:
- goto IL_1546;
- }
- if (stringCom == "blendset")
- {
- string blendSetName = stringList[1];
- int num5 = (stringList.Length - 2) / 2;
- body.Face.morph.NewBlendSet(blendSetName);
- for (int j = 0; j < num5; j++)
- {
- string tag3 = stringList[2 + j * 2].ToLower();
- float val2 = float.Parse(stringList[3 + j * 2]);
- body.Face.morph.SetValueBlendSet(blendSetName, tag3, val2);
- }
- goto IL_1546;
- }
- if (stringCom == "paramset")
- {
- body.Face.NewParamSet(text7);
- goto IL_1546;
- }
- 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_1546;
- }
- if (stringCom == "useredit")
- {
- if (stringList[2].ToLower() == "material")
- {
- body.SetMaterialProperty(text9, stringList[3], int.Parse(stringList[4]), stringList[5], stringList[6], stringList[7], false);
- goto IL_11C7;
- }
- goto IL_11C7;
- IL_11C7:
- goto IL_1546;
- }
- if (stringCom == "bonemorph")
- {
- if (9 > stringList.Length || stringList.Length > 10)
- {
- Debug.LogError("BoneMorpの設定引数の数が不正です。 " + text7 + " " + text3);
- }
- 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_138D;
- }
- string text18 = 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 (text18 != null)
- {
- if (text18 == "pos")
- {
- body.bonemorph.ChangeMorphPosValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
- goto IL_138D;
- }
- if (text18 == "rot")
- {
- body.bonemorph.ChangeMorphRotatioValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
- goto IL_138D;
- }
- if (text18 == "scl")
- {
- body.bonemorph.ChangeMorphSclValue(strPropName, f_strBoneName, f_fAddMin, f_fAddMax);
- goto IL_138D;
- }
- }
- Debug.LogError(string.Concat(new string[]
- {
- "BoneMorpのタイプ指定が不正です[",
- text18,
- "]\n",
- text7,
- " ",
- text3
- }));
- goto IL_138D;
- IL_138D:
- goto IL_1546;
- }
- if (stringCom == "length")
- {
- if (stringList.Length != 11)
- {
- Debug.LogError("lengthの設定引数の数が不正です。 " + text7 + " " + text3);
- }
- body.SetHairLengthDataList(stringList[1], 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_1546;
- }
- if (stringCom == "anime")
- {
- if (stringList.Length < 3)
- {
- Debug.LogError("animeの設定引数の数が不正です。 " + text7 + " " + text3);
- }
- 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_1546;
- }
- if (stringCom == "param2")
- {
- if (stringList.Length == 4)
- {
- string slotname4 = stringList[1];
- body.GetSlot(slotname4).SetParam2(stringList[2], stringList[3]);
- goto IL_1500;
- }
- Debug.LogError("param2の設定引数の数が不正です。 " + text7 + " " + text3);
- goto IL_1500;
- IL_1500:
- goto IL_1546;
- }
- 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_1546;
- }
- goto IL_1546;
- IL_1546:
- goto IL_15C9;
- }
- catch (Exception ex)
- {
- Debug.LogError(string.Concat(new string[]
- {
- "Exception ",
- Path.GetFileName(text),
- " 現在処理中だった行 = ",
- text7,
- " 以前の行 = ",
- text8,
- " ",
- ex.Message,
- "StackTrace:\n",
- ex.StackTrace
- }));
- NDebug.Assert("メニューファイル処理中にエラーが発生しました。" + Path.GetFileName(text), true);
- goto IL_15C9;
- }
- IL_15C9:
- goto IL_108;
- }
- list.Sort((Menu.LastParam a, Menu.LastParam b) => a.nOrder - a.nOrder);
- for (int k = 0; k < list.Count; k++)
- {
- Menu.LastParam lastParam = list[k];
- if (lastParam.strComm == "アイテムパラメータ")
- {
- TBodySkin slot6 = body.GetSlot(lastParam.aryArgs[0]);
- slot6.SetParam(lastParam.aryArgs[1], lastParam.aryArgs[2]);
- }
- }
- binaryReader.Close();
- binaryReader = null;
- }
- public static void SetMaidItemTemp(Maid maid, string filename, bool f_bTemp = false)
- {
- byte[] buffer = null;
- try
- {
- if (!GameUty.IsExistFile(filename, null))
- {
- return;
- }
- 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);
- }
- }
- 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" + 1320);
- 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<Menu.LastParam> list = new List<Menu.LastParam>();
- 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<string> list2 = new List<string>();
- 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<Transform>(true))
- {
- Renderer component = transform.GetComponent<Renderer>();
- 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<Transform>(true))
- {
- Renderer component2 = transform2.GetComponent<Renderer>();
- 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<string>(Menu.m_strAllTexInFileSys, (string i) => new Regex(strTexName).IsMatch(i));
- array = Array.FindAll<string>(array, (string i) => new Regex("^((?!_i_).)*$").IsMatch(i));
- IEnumerable<string> source = array;
- if (Menu.<>f__mg$cache0 == null)
- {
- Menu.<>f__mg$cache0 = new Func<string, string>(Path.GetFileName);
- }
- array = source.Select(Menu.<>f__mg$cache0).ToArray<string>();
- string strMatchGroup = strTexName.Replace(".*", "(?<WILD>.*)");
- array = array.Select(delegate(string i)
- {
- Match match = new Regex(strMatchGroup).Match(i);
- if (match.Success)
- {
- return match.Groups["WILD"].Value;
- }
- return i;
- }).ToArray<string>();
- }
- 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 == 61 || mp.idx == 64 || mp.idx == 65 || mp.idx == 66))
- {
- 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<string, byte[]> dictionary = new Dictionary<string, byte[]>();
- 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<Transform>(true))
- {
- Renderer component = transform.GetComponent<Renderer>();
- 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, 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 == 61)
- {
- matno = 7;
- }
- maid.body0.ChangeTex(array[1], 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<int, SortedDictionary<string, string>> m_dicResourceRef = new SortedDictionary<int, SortedDictionary<string, string>>();
- private static string[] m_strAllTexInFileSys = null;
- private static string[,] material_properties;
- [CompilerGenerated]
- private static Func<string, string> <>f__mg$cache0;
- 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
- }
- }
|