public static GameObject Add(string name, string tooltip, byte[] png, Action <GameObject> action) { GameObject _Base = _SysShortcut.transform.Find("Base").gameObject; GameObject _Grid = _Base.transform.Find("Grid").gameObject; GameObject button = NGUITools.AddChild(_Grid, UTY.GetChildObject(_Grid, "Config", true)); button.name = name; EventDelegate.Set(button.GetComponent <UIButton>().onClick, () => { action(button); }); UIEventTrigger trigger = button.GetComponent <UIEventTrigger>(); EventDelegate.Set(trigger.onHoverOver, () => { VisibleExplanationRaw(tooltip); }); EventDelegate.Set(trigger.onHoverOut, () => { _SysShortcut.VisibleExplanation(null, false); }); EventDelegate.Set(trigger.onDragStart, () => { _SysShortcut.VisibleExplanation(null, false); }); UISprite sprite = button.GetComponent <UISprite>(); sprite.type = UIBasicSprite.Type.Filled; sprite.fillAmount = 0.0f; Texture2D texture = new Texture2D(1, 1); texture.LoadImage(png); UITexture uitexture = NGUITools.AddWidget <UITexture>(button); uitexture.material = new Material(uitexture.shader); uitexture.material.mainTexture = texture; uitexture.MakePixelPerfect(); repositionButtons(); return(button); }
// Token: 0x06000006 RID: 6 RVA: 0x000020F8 File Offset: 0x000002F8 public static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action) { GameObject goButton = null; if (Buttons.Contains(name)) { Buttons.Remove(name); } if (action == null) { return(goButton); } try { goButton = NGUITools.AddChild(Buttons.Grid, UTY.GetChildObject(Buttons.Grid, "Config", true)); if (name != null) { goButton.name = name; } EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, delegate() { action(goButton); }); UIEventTrigger component = goButton.GetComponent <UIEventTrigger>(); EventDelegate.Add(component.onHoverOut, delegate() { Buttons.SysShortcut.VisibleExplanation(null, false); }); EventDelegate.Add(component.onDragStart, delegate() { Buttons.SysShortcut.VisibleExplanation(null, false); }); Buttons.SetText(goButton, label); if (pngData == null) { pngData = DefaultIcon.Png; } UISprite component2 = goButton.GetComponent <UISprite>(); component2.type = UIBasicSprite.Type.Filled; component2.fillAmount = 0f; Texture2D texture2D = new Texture2D(1, 1); texture2D.LoadImage(pngData); UITexture uitexture = NGUITools.AddWidget <UITexture>(goButton); uitexture.material = new Material(uitexture.shader); uitexture.material.mainTexture = texture2D; uitexture.MakePixelPerfect(); Buttons.Reposition(); } catch { if (goButton != null) { NGUITools.Destroy(goButton); goButton = null; } throw; } return(goButton); }
private Texture ChangeTexFile(string dir, string filename, int matNo1, string propName) { Texture changedTex; // キャッシュ削除用に変更前のテクスチャを取得 var srcTex = material.GetTexture(propName) as Texture2D; string extension = Path.GetExtension(filename).ToLower(); if (extension.Length == 0 || extension == FileConst.EXT_TEXTURE) { string texName; if (extension.Length == 0) { texName = filename; filename += FileConst.EXT_TEXTURE; } else { texName = filename.Substring(0, filename.Length - 4); } holder.currentMaid.body0.ChangeTex(holder.currentSlot.Name, matNo1, propName, filename, null, MaidParts.PARTS_COLOR.NONE); // ChangeTexは、Materialからロードした時と違い、nameにファイル名が設定されてしまうため、 // 拡張子を除いた名前を再設定 changedTex = material.GetTexture(propName); if (changedTex != null) { changedTex.name = texName; } } else { TBodySkin slot = holder.currentMaid.body0.GetSlot(holder.currentSlot.Name); // 直接イメージをロードして適用(要dir指定) var mat = holder.GetMaterial(slot, matNo1); if (mat == null) { return(null); } byte[] img = UTY.LoadImage(Path.Combine(dir, filename)); var tex2d = new Texture2D(1, 1, TextureFormat.RGBA32, false); tex2d.LoadImage(img); slot.listDEL.Add(tex2d); // tex以外は拡張子を付与したままとする tex2d.name = filename; //Path.GetFileNameWithoutExtension(filename); mat.SetTexture(propName, tex2d); changedTex = tex2d; } // テクスチャ変更後は、以前のFilterParamやキャッシュをリセット if (srcTex != null) { textureModifier.RemoveCache(srcTex); textureModifier.RemoveFilter(holder.currentMaid, holder.currentSlot.Name, material, srcTex); } return(changedTex); }
/// <summary> /// /// </summary> /// <param name="__instance"></param> /// <param name="test"></param> private static void SetMethod(SceneFreeModeSelectManager __instance, string test) { MyLog.LogMessage("CreateItemEverydayList:" + test); try { GameObject childObject = UTY.GetChildObject(__instance.gameObject.transform.parent.gameObject, test, false); childObject.SetActive(true); childObject.GetComponent <UIButton>().isEnabled = true; } catch (Exception) { MyLog.LogError("CreateItemEverydayList:" + test); } }
public static void OnSceneFreeModeSelectAwake(SceneFreeModeSelectManager mgr) { if (!EnableAllFreeModeItems) { return; } var root = mgr.gameObject.transform.parent.gameObject; var buttonObj = UTY.GetChildObject(root, "MenuSelect/Menu/FreeModeMenuButton/夜伽"); buttonObj.SetActive(true); var button = buttonObj.GetComponent <UIButton>(); button.isEnabled = true; }
// Token: 0x06000067 RID: 103 RVA: 0x000082D4 File Offset: 0x000064D4 public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type) { CharacterMgr.Preset preset = new CharacterMgr.Preset(); Texture2D texture2D = this.ThumShot(GameMain.Instance.MainCamera.camera, f_maid); MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write("CM3D2_PRESET"); binaryWriter.Write(1160); binaryWriter.Write((int)f_type); if (texture2D != null) { byte[] array = texture2D.EncodeToPNG(); binaryWriter.Write(array.Length); binaryWriter.Write(array); } else { binaryWriter.Write(0); } f_maid.SerializeProp(binaryWriter); f_maid.SerializeMultiColor(binaryWriter); f_maid.SerializeBody(binaryWriter); string text = string.Concat(new string[] { "pre_", f_maid.status.lastName, f_maid.status.firstName, "_", DateTime.Now.ToString("yyyyMMddHHmmss") }); text = UTY.FileNameEscape(text); text += ".preset"; string text2 = Path.GetFullPath(".\\") + "Preset"; if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); } File.WriteAllBytes(text2 + "\\" + text, memoryStream.ToArray()); memoryStream.Dispose(); preset.texThum = texture2D; preset.strFileName = text; preset.ePreType = f_type; return(preset); }
public static void LocalizeNTRScene(GameObject ___toggleParent) { Core.Logger.LogInfo("Fixing NTR check scene."); void Localize(string item) { var result = UTY.GetChildObject(___toggleParent, $"{item}/Result"); //.GetComponent<UILabel>(); var title = UTY.GetChildObject(___toggleParent, $"{item}/Title"); //.GetComponent<UILabel>(); var resultLoc = result.AddComponent <Localize>(); resultLoc.SetTerm($"SceneNetorareCheck/{item}_Result"); var titleLoc = title.AddComponent <Localize>(); titleLoc.SetTerm($"SceneNetorareCheck/{item}_Title"); } Localize("Toggle_LockUserDraftMaid"); Localize("Toggle_IsComPlayer"); }
public void Call(Maid maid, ScheduleMgr.ScheduleTime scheduleTime, Dictionary <ScheduleTaskCtrl.TaskType, List <ScheduleTaskViewer.ViewData> > viewDic, Dictionary <ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> currentSetWorkDic) { if (this.category_button_dic_ == null) { this.Awake(); } ScheduleTaskViewer.scheduleTime = scheduleTime; HashSet <int> hashSet = new HashSet <int>(); int maxValue = int.MaxValue; UIWFTabButton uiwftabButton = null; UIWFTabButton uiwftabButton2 = null; foreach (KeyValuePair <ScheduleTaskCtrl.TaskType, List <ScheduleTaskViewer.ViewData> > keyValuePair in viewDic) { this.CallEnableButton(maid, keyValuePair.Key, keyValuePair.Value, ref hashSet, ref maxValue); } this.currentWorkDic = currentSetWorkDic; int num = maxValue; ScheduleCSVData.ScheduleBase work_data = null; foreach (KeyValuePair <int, UIButton> keyValuePair2 in this.category_button_dic_) { keyValuePair2.Value.onClick.Clear(); bool flag = hashSet.Contains(keyValuePair2.Key); keyValuePair2.Value.transform.parent.gameObject.SetActive(flag); if (flag) { EventDelegate.Add(keyValuePair2.Value.onClick, new EventDelegate.Callback(this.OnClickFromMainCategoryButton)); if (uiwftabButton2 == null && num == keyValuePair2.Key) { uiwftabButton2 = keyValuePair2.Value.gameObject.GetComponent <UIWFTabButton>(); } ScheduleCSVData.ScheduleBase scheduleBase = currentSetWorkDic[scheduleTime]; if (uiwftabButton == null && scheduleBase != null && scheduleBase.categoryID == keyValuePair2.Key) { work_data = scheduleBase; uiwftabButton = keyValuePair2.Value.gameObject.GetComponent <UIWFTabButton>(); } } } if (uiwftabButton == null) { uiwftabButton = uiwftabButton2; } Utility.ResetNGUI(this.CategoryGrid); Utility.ResetNGUI(this.CategoryScrollView); UIWFTabPanel componentInChildren = this.CategoryGrid.GetComponentInChildren <UIWFTabPanel>(); componentInChildren.ResetSelect(); componentInChildren.UpdateChildren(); if (uiwftabButton != null) { componentInChildren.Select(uiwftabButton); } if (this.descDic == null) { DescScheduleYotogi component = UTY.GetChildObject(base.gameObject, "DescScheduleYotogi", false).GetComponent <DescScheduleYotogi>(); component.Init(this.taskCtrl); DescScheduleTraining component2 = UTY.GetChildObject(base.gameObject, "DescScheduleTraining", false).GetComponent <DescScheduleTraining>(); component2.Init(this.taskCtrl); DescScheduleWork component3 = UTY.GetChildObject(base.gameObject, "DescScheduleWork", false).GetComponent <DescScheduleWork>(); component3.Init(this.taskCtrl); this.descDic = new Dictionary <ScheduleTaskCtrl.TaskType, DescScheduleBase>(); this.descDic.Add(ScheduleTaskCtrl.TaskType.Yotogi, component); this.descDic.Add(ScheduleTaskCtrl.TaskType.Training, component2); this.descDic.Add(ScheduleTaskCtrl.TaskType.Work, component3); } this.UpdateForDescriptionViewer(work_data); }
void originalMoveHead(TBody tbody, ref Vector3 thatHeadEulerAngle, ref Vector3 thatHeadEulerAngleG, ref Vector3 thatEyeEulerAngle, Vector3 eyeTargetWorldPos) { TBody that = tbody; // CameraMain mainCamera = GameMain.Instance.MainCamera; // eulerAngles1:顔の正面向きのベクトルから見た、視線ターゲットまでの回転量 Vector3 eulerAngles1; Quaternion quaternion1 = new Quaternion(); { // toDirection1:顔からターゲットを見た向き(顔の座標系) Vector3 toDirection1 = Quaternion.Inverse(that.trsNeck.rotation) * (eyeTargetWorldPos - that.trsNeck.position); // quaternion1:(0,1,0) (顔の正面向きのベクトル) から見たときの、toDirection1 までの回転量 quaternion1.SetFromToRotation(Vector3.up, toDirection1); eulerAngles1 = PluginHelper.NormalizeEulerAngles(quaternion1.eulerAngles); } if (that.boHeadToCamInMode) { // 追従範囲外かどうかを判定 if (-80.0f >= eulerAngles1.x || eulerAngles1.x >= 80.0f || -50.0f >= eulerAngles1.z || eulerAngles1.z >= 60.0f) { that.boHeadToCamInMode = false; } } else { // 追従範囲内かどうかを判定 if (-60.0f < eulerAngles1.x && eulerAngles1.x < 60.0f && -40.0f < eulerAngles1.z && eulerAngles1.z < 50.0f) { that.boHeadToCamInMode = true; } } if (that.boHeadToCamInMode) { // 追従モード that.boChkEye = true; float num = 0.3f; if (eulerAngles1.x > thatHeadEulerAngle.x + 10.0f) { thatHeadEulerAngleG.x += num; } else if (eulerAngles1.x < thatHeadEulerAngle.x - 10.0f) { thatHeadEulerAngleG.x -= num; } else { thatHeadEulerAngleG.x *= 0.95f; } if (eulerAngles1.z > thatHeadEulerAngle.z + 10.0f) { thatHeadEulerAngleG.z += num; } else if (eulerAngles1.z < thatHeadEulerAngle.z - 10.0f) { thatHeadEulerAngleG.z -= num; } else { thatHeadEulerAngleG.z *= 0.95f; } } else { // 自由モード float num = 0.1f; if (0.0f > thatHeadEulerAngle.x + 10.0) { thatHeadEulerAngleG.x += num; } if (0.0f < thatHeadEulerAngle.x - 10.0f) { thatHeadEulerAngleG.x -= num; } if (0.0f > thatHeadEulerAngle.z + 10.0f) { thatHeadEulerAngleG.z += num; } if (0.0f < thatHeadEulerAngle.z - 10.0f) { thatHeadEulerAngleG.z -= num; } } thatHeadEulerAngleG *= 0.95f; thatHeadEulerAngle += thatHeadEulerAngleG; float uScale = 0.4f; that.trsHead.localRotation = Quaternion.Slerp( that.trsHead.localRotation, that.quaDefHead * Quaternion.Euler( thatHeadEulerAngle.x * uScale, 0.0f, thatHeadEulerAngle.z * uScale), UTY.COSS(that.HeadToCamPer)); }
private void SetUIEnabled(bool enable) { UTY.GetChildObject(this.windowMgr.gameObject, "WindowVisibleBtnsParent", false).SetActive(enable); Base.SetActive(enable); Gear.SetActive(enable); }
public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, bool f_bMan, out string IconTex) { var fetchedField = AccessTools.DeclaredField(typeof(SceneEdit), "m_byItemFileBuffer"); var fetchedVal = fetchedField.GetValue(@this) as byte[]; IconTex = null; if (f_strMenuFileName.IndexOf("mod_") == 0) { string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName); return(!string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName)); } try { using (AFileBase afileBase = GameUty.FileOpen(f_strMenuFileName, null)) { NDebug.Assert(afileBase.IsValid(), "メニューファイルが存在しません。 :" + f_strMenuFileName); if (fetchedVal == null) { fetchedVal = new byte[System.Math.Max(500000, afileBase.GetSize())]; } else if (fetchedVal.Length < afileBase.GetSize()) { fetchedVal = new byte[afileBase.GetSize()]; } afileBase.Read(ref fetchedVal, afileBase.GetSize()); } } catch (Exception ex) { Main.logger.LogError(string.Concat(new string[] { "メニューファイルがが読み込めませんでした。 : ", f_strMenuFileName, " : ", ex.Message, " : StackTrace :\n", ex.StackTrace })); throw ex; } BinaryReader binaryReader = new BinaryReader(new MemoryStream(fetchedVal), Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text); int num = binaryReader.ReadInt32(); string path = binaryReader.ReadString(); string text2 = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); string text4 = binaryReader.ReadString(); long num2 = (long)binaryReader.ReadInt32(); int num3 = 0; string text5 = null; string text6 = string.Empty; string text7 = string.Empty; try { for (; ;) { int num4 = (int)binaryReader.ReadByte(); text7 = text6; text6 = string.Empty; if (num4 == 0) { break; } for (int i = 0; i < num4; i++) { text6 = text6 + "\"" + binaryReader.ReadString() + "\" "; } if (!(text6 == string.Empty)) { string stringCom = UTY.GetStringCom(text6); string[] stringList = UTY.GetStringList(text6); if (stringCom == "name") { string text8 = stringList[1]; string text9 = string.Empty; string arg = string.Empty; int j = 0; while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ') { text9 += text8[j]; j++; } while (j < text8.Length) { arg += text8[j]; j++; } mi.m_strMenuName = text9; } else if (stringCom == "setumei") { mi.m_strInfo = stringList[1]; mi.m_strInfo = mi.m_strInfo.Replace("《改行》", "\n"); } else if (stringCom == "category") { string strCateName = stringList[1].ToLower(); mi.m_strCateName = strCateName; try { mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName); } catch { Main.logger.LogWarning("カテゴリがありません。" + mi.m_strCateName); mi.m_mpn = MPN.null_mpn; } } else if (stringCom == "color_set") { try { mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower()); } catch { Main.logger.LogWarning("カテゴリがありません。" + mi.m_strCateName); } if (stringList.Length >= 3) { mi.m_strMenuNameInColorSet = stringList[2].ToLower(); } } else if (stringCom == "tex" || stringCom == "テクスチャ変更") { MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE; if (stringList.Length == 6) { string text10 = stringList[5]; try { pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper()); } catch { NDebug.Assert("無限色IDがありません。" + text10, false); } mi.m_pcMultiColorID = pcMultiColorID; } } else if (stringCom == "icon" || stringCom == "icons") { text5 = stringList[1]; } else if (!(stringCom == "iconl")) { if (!(stringCom == "setstr")) { if (!(stringCom == "アイテムパラメータ")) { if (stringCom == "saveitem") { string text11 = stringList[1]; if (text11 == string.Empty) { Main.logger.LogError("err SaveItem \"" + text11); } if (text11 == null) { Main.logger.LogError("err SaveItem null=\"" + text11); } if (text11 != string.Empty) { } } else if (!(stringCom == "catno")) { if (stringCom == "additem") { num3++; } else if (stringCom == "unsetitem") { mi.m_boDelOnly = true; } else if (stringCom == "priority") { mi.m_fPriority = float.Parse(stringList[1]); } else if (stringCom == "メニューフォルダ" && stringList[1].ToLower() == "man") { mi.m_bMan = true; } } } } } } } } catch (Exception ex2) { Main.logger.LogError(string.Concat(new string[] { "Exception ", Path.GetFileName(path), " 現在処理中だった行 = ", text6, " 以前の行 = ", text7, " ", ex2.Message, "StackTrace:\n", ex2.StackTrace })); throw ex2; } if (text5 != null && text5 != string.Empty) { try { IconTex = text5; //mi.m_texIcon = ImportCM.CreateTexture(text5); } catch (Exception) { Main.logger.LogError("Error:"); } } binaryReader.Close(); return(true); }
public static MenuInfo LoadMenu(string menuFileName) { AFileBase file = GameUty.FileOpen(menuFileName); if (!file.IsValid() || file.GetSize() == 0) { string name = menuFileName.Replace(@"menu\", ""); file = GameUty.FileOpen(name); if (file.GetSize() == 0 || !file.IsValid()) { name = menuFileName.Replace(@"menu\man\", ""); file = GameUty.FileOpen(name); if (file.GetSize() == 0 || !file.IsValid()) { throw new FileNotFoundException(name); } } } MenuInfo mi = new MenuInfo(); mi.menuFileName = menuFileName; BinaryReader binaryReader = new BinaryReader(new MemoryStream(file.ReadAll()), System.Text.Encoding.UTF8); string str1 = binaryReader.ReadString(); NDebug.Assert(str1 == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + str1); binaryReader.ReadInt32(); string path = binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); long num1 = (long)binaryReader.ReadInt32(); string sss = string.Empty; string str2 = string.Empty; string empty1 = string.Empty; try { while (true) { string stringCom; string[] stringList; do { do { do { MaidParts.PARTS_COLOR partsColor = MaidParts.PARTS_COLOR.NONE; do { sss = readCom(binaryReader); if (sss == null) { goto label_61; } stringCom = UTY.GetStringCom(sss); stringList = UTY.GetStringList(sss); if (readMenuProp(stringCom, stringList, ref partsColor, ref mi) == true) { goto label_40; } }while (stringList.Length != 6); string str4 = stringList[5]; try { partsColor = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), str4.ToUpper()); } catch { NDebug.Assert("無限色IDがありません。" + str4); } mi.partsColor = partsColor; continue; label_40: if (stringCom == "icon" || stringCom == "icons") { mi.iconTextureName = stringList[1]; } }while (stringCom == "iconl" || stringCom == "setstr" || stringCom == "アイテムパラメータ"); if (stringCom == "saveitem") { string str3 = stringList[1]; if (str3 == string.Empty) { UnityEngine.Debug.LogError("err SaveItem \"" + str3); } if (str3 == null) { UnityEngine.Debug.LogError("err SaveItem null=\"" + str3); } } }while (stringCom == "catno"); if (stringCom == "additem") { mi.modelName = stringList[1]; } else if (stringCom == "delitem" || stringCom == "unsetitem") { mi.delOnly = true; } else if (stringCom == "priority") { mi.priority = float.Parse(stringList[1]); } }while (!(stringCom == "メニューフォルダ") || !(stringList[1].ToLower() == "man")); mi.isMan = true; } } catch { UnityEngine.Debug.LogError("Failed to parse menu file " + Path.GetFileName(path)); // UnityEngine.Debug.LogError(("Exception " + Path.GetFileName(path) + " 現在処理中だった行 = " + sss + " 以前の行 = " + str2 + " " + ex.Message + "StackTrace:\n" + ex.StackTrace)); throw; } label_61: binaryReader.Close(); return(mi); }
private static MenuObj getMenu(string menuFileName) { //UnityEngine.Debug.Log("Fetching Menu " + menuFileName); MenuObj menu = new MenuObj(); byte[] cd; using (AFileBase afileBase = GameUty.FileOpen(menuFileName, (AFileSystemBase)null)) { if (afileBase != null && afileBase.IsValid()) { //UnityEngine.Debug.Log("Reading bytes"); cd = afileBase.ReadAll(); using (BinaryReader binaryReader = new BinaryReader((Stream) new MemoryStream(cd), Encoding.UTF8)) { //Useless header info??? //UnityEngine.Debug.Log("Reading header"); menu.header.CM3D2_MENU = binaryReader.ReadString(); menu.header.temp1 = binaryReader.ReadInt32(); menu.header.temp2 = binaryReader.ReadString(); menu.header.temp3 = binaryReader.ReadString(); menu.header.temp4 = binaryReader.ReadString(); menu.header.temp5 = binaryReader.ReadString(); menu.header.temp6 = binaryReader.ReadInt32(); bool end = false; //UnityEngine.Debug.Log("Reading commands"); //Blocks do { MenuCommandObj command = new MenuCommandObj(); string str4; do { byte byt = binaryReader.ReadByte(); command.byt = byt; int num2 = (int)byt; str4 = string.Empty; if (num2 != 0) { for (int index = 0; index < num2; ++index) { string str = binaryReader.ReadString(); command.nativeStrings.Add(str); str4 = str4 + "\"" + str + "\" "; } } else { end = true; } }while (str4 == string.Empty && !end); if (!end) { string stringCom = UTY.GetStringCom(str4); string[] stringList = UTY.GetStringList(str4); command.stringCom = stringCom; command.stringList = stringList; menu.commands.Add(command); if (stringCom.Equals("category")) { //Get the category menu.category = stringList[1]; } } }while (!end); } } else { if (afileBase == null) { UnityEngine.Debug.Log("Split Hair Sliders: null AFileBase"); } else { if (!afileBase.IsValid()) { UnityEngine.Debug.Log("Split Hair Sliders: invalid AFileBase"); } } } } return(menu); }
public unsafe static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) GameObject goButton = null; if (Contains(name)) { Remove(name); } if (action == null) { return(goButton); } try { goButton = NGUITools.AddChild(Grid, UTY.GetChildObject(Grid, "Config", true)); if (name != null) { goButton.name = name; } EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, () => { action(goButton); }); UIEventTrigger component = goButton.GetComponent <UIEventTrigger>(); EventDelegate.Add(component.onHoverOut, () => { SysShortcut.VisibleExplanation(null, false); }); EventDelegate.Add(component.onDragStart, () => { SysShortcut.VisibleExplanation(null, false); }); SetText(goButton, label); if (pngData == null) { pngData = DefaultIcon.Png; } UISprite component2 = goButton.GetComponent <UISprite>(); component2.type = (UIBasicSprite.Type) 3; component2.fillAmount = 0f; Texture2D val3 = new Texture2D(1, 1); val3.LoadImage(pngData); UITexture obj = NGUITools.AddWidget <UITexture>(goButton); obj.material = new Material(obj.shader); obj.material.mainTexture = val3; obj.MakePixelPerfect(); Reposition(); } catch { if (goButton != null) { NGUITools.Destroy(goButton); goButton = null; } throw; } return(goButton); }
public static EditMenuItemDataPlus ReadMenuFile(BinaryReader binaryReader, String menuFileName) { var menuSignature = binaryReader.ReadString(); if (menuSignature == "CM3D2_MENU") { var editMenuItemDataPlus = new EditMenuItemDataPlus(); var menuVersion = binaryReader.ReadInt32(); var txtPath = binaryReader.ReadString(); var partsName = binaryReader.ReadString(); var partsCategory = binaryReader.ReadString(); var partsDescription = binaryReader.ReadString(); binaryReader.ReadInt32(); var iconFileName = ""; var priority = 0F; var mpnColorSet = "null_mpn"; var colorSetFilesName = ""; var menuId = UnityEngine.Random.Range(int.MinValue, int.MaxValue); var isDelete = false; var multiColorID = "NONE"; var isNotEnd = true; while (isNotEnd) { var num = binaryReader.ReadByte(); var text = ""; for (int i = 0; i < num; i++) { text = text + "\"" + binaryReader.ReadString() + "\" "; } if (text != string.Empty) { var stringCom = UTY.GetStringCom(text); var stringList = UTY.GetStringList(text); switch (stringCom) { case "icons": iconFileName = stringList[1]; break; case "priority": priority = float.Parse(stringList[1]); break; case "color_set": mpnColorSet = stringList[1]; colorSetFilesName = stringList[2]; break; case "リソース参照": switch (stringList[1]) { case "パンツずらし": editMenuItemDataPlus.zurashiMenuFileName = stringList[2]; break; case "めくれスカート": editMenuItemDataPlus.mekureMenuFileName = stringList[2]; break; case "めくれスカート後ろ": editMenuItemDataPlus.mekureBackMenuFileName = stringList[2]; break; } break; } } else { isNotEnd = false; } } var editMenuItemData = new EditMenuItemData(); var editMenuItemDataType = typeof(EditMenuItemData); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "MenuRID", menuId); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "MenuFileName", menuFileName); if (!MODManager.fileSystem.loadFilePathList.ContainsKey(iconFileName)) { iconFileName = iconFileName.Replace("_I_", "_i_"); } if (!MODManager.fileSystem.loadFilePathList.ContainsKey(iconFileName)) { iconFileName = iconFileName.ToLower(); } Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "IconFileName", iconFileName); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "ItemName", partsName); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "Mpn", (MPN)Enum.Parse(typeof(MPN), partsCategory)); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "MpnColorSet", (MPN)Enum.Parse(typeof(MPN), mpnColorSet)); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "ColorSetFilesName", colorSetFilesName); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "Priority", priority); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "ParentMenu", null); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "IsDelete", isDelete); Util.invokePrivateSetter(editMenuItemDataType, editMenuItemData, "MultiColorID", (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), multiColorID)); editMenuItemDataPlus.editMenuItemData = editMenuItemData; var baseMenuFileName = menuFileName.Replace("_i_.menu", ".menu").Replace(".menu", ""); if (baseMenuFileName.IndexOf("zurashi") == -1 && baseMenuFileName.IndexOf("mekure") == -1 && baseMenuFileName.IndexOf("porori") == -1) { var pororiMenuDic = MODManager.fileSystem.loadFilePathList.Where(x => { var fileNmae = x.Key.Replace("_i_.menu", ".menu").Replace("_i_", ""); if (Regex.IsMatch(fileNmae, baseMenuFileName + pororiRegex)) { if (Path.GetExtension(fileNmae) == ".menu") { return(true); } } return(false); }); var pororiListKeyValue = pororiMenuDic.ToList(); var pororiList = new List <String>(); foreach (var item in pororiListKeyValue) { pororiList.Add(item.Key); } editMenuItemDataPlus.pororiMenuFilesName = pororiList; } return(editMenuItemDataPlus); } else { return(null); } }
// Token: 0x06000375 RID: 885 RVA: 0x0001F3F4 File Offset: 0x0001D5F4 private Texture ChangeTexFile(string dir, string filename, int matNo1, string propName) { Texture2D texture2D = this.material.GetTexture(propName) as Texture2D; string text = Path.GetExtension(filename).ToLower(); Texture texture; if (text.Length == 0 || text == FileConst.EXT_TEXTURE) { string name; if (text.Length == 0) { name = filename; filename += FileConst.EXT_TEXTURE; } else { name = filename.Substring(0, filename.Length - 4); } LogUtil.Debug(new object[] { "ChangeTex:", filename, ", propName:", propName }); ACCTexturesView.holder.CurrentMaid.body0.ChangeTex(ACCTexturesView.holder.CurrentSlot.Name, matNo1, propName, filename, null, MaidParts.PARTS_COLOR.NONE); texture = this.material.GetTexture(propName); if (texture != null) { texture.name = name; } } else { TBodySkin slot = ACCTexturesView.holder.CurrentMaid.body0.GetSlot((int)ACCTexturesView.holder.CurrentSlot.Id); Material material = ACCTexturesView.holder.GetMaterial(slot, matNo1); if (material == null) { return(null); } byte[] data = UTY.LoadImage(Path.Combine(dir, filename)); Texture2D texture2D2 = new Texture2D(1, 1, TextureFormat.ARGB32, false); texture2D2.LoadImage(data); slot.listDEL.Add(texture2D2); texture2D2.name = filename; LogUtil.Debug(new object[] { "SetTexture:", filename, ", propName:", propName, ", (", texture2D2.width, ",", texture2D2.height, ")" }); material.SetTexture(propName, texture2D2); texture = texture2D2; } if (texture2D == null) { return(texture); } ACCTexturesView.textureModifier.RemoveCache(texture2D); ACCTexturesView.textureModifier.RemoveFilter(ACCTexturesView.holder.CurrentMaid, ACCTexturesView.holder.CurrentSlot.Name, this.material, texture2D); return(texture); }
/// <summary> /// 歯車メニューにボタンを追加 /// </summary> /// <param name="name">ボタンオブジェクト名。null可</param> /// <param name="label">ツールチップテキスト。null可(ツールチップ非表示)。アイコンへのマウスオーバー時に表示される</param> /// <param name="pngData">アイコン画像。null可(システムアイコン使用)。32x32ピクセルのPNGファイル</param> /// <param name="action">コールバック。null可(コールバック削除)。アイコンクリック時に呼び出されるコールバック</param> /// <returns>生成されたボタンのGameObject</returns> /// <example> /// ボタン追加例 /// <code> /// public class MyPlugin : UnityInjector.PluginBase { /// void Awake() { /// GearMenu.Buttons.Add(GetType().Name, "テスト", null, GearMenuCallback); /// } /// void GearMenuCallback(GameObject goButton) { /// Debug.LogWarning("GearMenuCallback呼び出し"); /// } /// } /// </code> /// </example> public static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action) { GameObject goButton = null; // 既に存在する場合は削除して続行 if (Contains(name)) { Remove(name); } if (action == null) { return(goButton); } try { // ギアメニューの子として、コンフィグパネル呼び出しボタンを複製 goButton = NGUITools.AddChild(Grid, UTY.GetChildObject(Grid, "Config", true)); // 名前を設定 if (name != null) { goButton.name = name; } // イベントハンドラ設定(同時に、元から持っていたハンドラは削除) EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, () => { action(goButton); }); // ポップアップテキストを追加 { UIEventTrigger t = goButton.GetComponent <UIEventTrigger>(); EventDelegate.Add(t.onHoverOut, () => { SysShortcut.VisibleExplanation(null, false); }); EventDelegate.Add(t.onDragStart, () => { SysShortcut.VisibleExplanation(null, false); }); SetText(goButton, label); } // PNG イメージを設定 { if (pngData == null) { pngData = DefaultIcon.Png; } // 本当はスプライトを削除したいが、削除するとパネルのα値とのTween同期が動作しない // (動作させる方法が分からない) ので、スプライトを描画しないように設定する // もともと持っていたスプライトを削除する場合は以下のコードを使うと良い // NGUITools.Destroy(goButton.GetComponent<UISprite>()); UISprite us = goButton.GetComponent <UISprite>(); us.type = UIBasicSprite.Type.Filled; us.fillAmount = 0.0f; // テクスチャを生成 var tex = new Texture2D(1, 1); tex.LoadImage(pngData); // 新しくテクスチャスプライトを追加 UITexture ut = NGUITools.AddWidget <UITexture>(goButton); ut.material = new Material(ut.shader); ut.material.mainTexture = tex; ut.MakePixelPerfect(); } // グリッド内のボタンを再配置 Reposition(); } catch { // 既にオブジェクトを作っていた場合は削除 if (goButton != null) { NGUITools.Destroy(goButton); goButton = null; } throw; } return(goButton); }
private Texture ChangeTexFile(string dir, string filename, int matNo1, string propName) { Texture changedTex; // キャッシュ削除用に変更前のテクスチャを取得 var srcTex = material.GetTexture(propName) as Texture2D; // ReSharper disable once PossibleNullReferenceException nullを返すのはnull入力時のみ.ここではありえない var extension = Path.GetExtension(filename).ToLower(); if (extension.Length == 0 || extension == FileConst.EXT_TEXTURE) { string texName; if (extension.Length == 0) { texName = filename; filename += FileConst.EXT_TEXTURE; } else { texName = filename.Substring(0, filename.Length - 4); } LogUtil.Debug("ChangeTex:", filename, ", propName:", propName); holder.CurrentMaid.body0.ChangeTex(holder.CurrentSlot.Name, 0, matNo1, propName, filename, null, MaidParts.PARTS_COLOR.NONE); // ChangeTexは、Materialからロードした時と違い、nameにファイル名が設定されてしまうため、 // 拡張子を除いた名前を再設定 changedTex = material.GetTexture(propName); if (changedTex != null) { changedTex.name = texName; } } else { var slot = holder.CurrentMaid.body0.GetSlot((int)holder.CurrentSlot.Id); // 直接イメージをロードして適用(要dir指定) var mat = holder.GetMaterial(slot, matNo1); if (mat == null) { return(null); } var img = UTY.LoadImage(Path.Combine(dir, filename)); var tex2D = new Texture2D(1, 1, TextureFormat.ARGB32, false); tex2D.LoadImage(img); slot.listDEL.Add(tex2D); // tex以外は拡張子を付与したままとする tex2D.name = filename; //Path.GetFileNameWithoutExtension(filename); LogUtil.Debug("SetTexture:", filename, ", propName:", propName, ", (", tex2D.width, ",", tex2D.height, ")"); mat.SetTexture(propName, tex2D); changedTex = tex2D; } // テクスチャ変更後は、以前のFilterParamやキャッシュをリセット if (srcTex == null) { return(changedTex); } textureModifier.RemoveCache(srcTex); textureModifier.RemoveFilter(holder.CurrentMaid, holder.CurrentSlot.Name, material, srcTex); return(changedTex); }
public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, out string IconTex) { IconTex = null; if (f_strMenuFileName.IndexOf("mod_") == 0) { string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName); return(!string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName)); } if (MenuCache.ContainsKey(f_strMenuFileName)) { try { MenuStub tempStub = MenuCache[f_strMenuFileName]; if (tempStub.DateModified == File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName])) { if (tempStub.Name != null) { mi.m_strMenuName = tempStub.Name; } if (tempStub.Description != null) { mi.m_strInfo = tempStub.Description; } if (tempStub.Category != null) { mi.m_strCateName = tempStub.Category; mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), tempStub.Category); } else { mi.m_mpn = MPN.null_mpn; } if (tempStub.ColorSetMPN != null) { mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), tempStub.ColorSetMPN); } if (tempStub.ColorSetMenu != null) { mi.m_strMenuNameInColorSet = tempStub.ColorSetMenu; } if (tempStub.MultiColorID == null) { mi.m_pcMultiColorID = MaidParts.PARTS_COLOR.NONE; } else if (tempStub.MultiColorID != null) { mi.m_pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), tempStub.MultiColorID); } mi.m_boDelOnly = tempStub.DelMenu; mi.m_fPriority = tempStub.Priority; mi.m_bMan = tempStub.ManMenu; IconTex = tempStub.Icon; return(true); } else { Main.logger.LogWarning($"A cache entry was found outdated. This should be automatically fixed and the cache reloaded."); } } catch (Exception ex) { Main.logger.LogError(string.Concat(new string[] { $"Encountered an issue while trying to load menu {f_strMenuFileName} from cache. This should be automatically fixed and the cache reloaded.", "\n\n", ex.Message, "\n", ex.StackTrace })); } } try { if (FilesToRead[f_strMenuFileName] == null) { FilesToRead[f_strMenuFileName] = new MemoryStream(File.ReadAllBytes(FilesDictionary[f_strMenuFileName])); } } catch (Exception ex) { Main.logger.LogError(string.Concat(new string[] { "The following menu file could not be read! (メニューファイルがが読み込めませんでした。): ", f_strMenuFileName, "\n\n", ex.Message, "\n", ex.StackTrace })); return(false); } string text6 = string.Empty; string text7 = string.Empty; string path = ""; MenuStub cacheEntry = new MenuStub(); try { cacheEntry.DateModified = File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]); BinaryReader binaryReader = new BinaryReader(FilesToRead[f_strMenuFileName], Encoding.UTF8); string text = binaryReader.ReadString(); if (text != "CM3D2_MENU") { Main.logger.LogError("ProcScriptBin (例外 : ヘッダーファイルが不正です。) The header indicates a file type that is not a menu file!" + text + " @ " + f_strMenuFileName); return(false); } binaryReader.ReadInt32(); path = binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadInt32(); string text5 = null; while (true) { int num4 = binaryReader.ReadByte(); text7 = text6; text6 = string.Empty; if (num4 == 0) { break; } for (int i = 0; i < num4; i++) { text6 = text6 + "\"" + binaryReader.ReadString() + "\" "; } if (!(text6 == string.Empty)) { string stringCom = UTY.GetStringCom(text6); string[] stringList = UTY.GetStringList(text6); if (stringCom == "name") { if (stringList.Length > 1) { string text8 = stringList[1]; string text9 = string.Empty; string arg = string.Empty; int j = 0; while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ') { text9 += text8[j]; j++; } while (j < text8.Length) { arg += text8[j]; j++; } mi.m_strMenuName = text9; cacheEntry.Name = mi.m_strMenuName; } else { Main.logger.LogWarning("Menu file has no name and an empty description will be used instead." + " @ " + f_strMenuFileName); mi.m_strMenuName = ""; cacheEntry.Name = mi.m_strMenuName; } } else if (stringCom == "setumei") { if (stringList.Length > 1) { mi.m_strInfo = stringList[1]; mi.m_strInfo = mi.m_strInfo.Replace("《改行》", "\n"); cacheEntry.Description = mi.m_strInfo; } else { Main.logger.LogWarning("Menu file has no description (setumei) and an empty description will be used instead." + " @ " + f_strMenuFileName); mi.m_strInfo = ""; cacheEntry.Description = mi.m_strInfo; } } else if (stringCom == "category") { if (stringList.Length > 1) { string strCateName = stringList[1].ToLower(); mi.m_strCateName = strCateName; cacheEntry.Category = mi.m_strCateName; try { mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName); cacheEntry.Category = mi.m_mpn.ToString(); } catch { Main.logger.LogWarning("There is no category called (カテゴリがありません。): " + mi.m_strCateName + " @ " + f_strMenuFileName); return(false); } } else { Main.logger.LogWarning("The following menu file has a category parent with no category: " + f_strMenuFileName); return(false); } } else if (stringCom == "color_set") { if (stringList.Length > 1) { try { mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower()); cacheEntry.ColorSetMPN = mi.m_eColorSetMPN.ToString(); } catch { Main.logger.LogWarning("There is no category called(カテゴリがありません。): " + mi.m_strCateName + " @ " + f_strMenuFileName); return(false); } if (stringList.Length >= 3) { mi.m_strMenuNameInColorSet = stringList[2].ToLower(); cacheEntry.ColorSetMenu = mi.m_strMenuNameInColorSet; } } else { Main.logger.LogWarning("A color_set entry exists but is otherwise empty" + " @ " + f_strMenuFileName); } } else if (stringCom == "tex" || stringCom == "テクスチャ変更") { MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE; if (stringList.Length == 6) { string text10 = stringList[5]; try { pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper()); } catch { Main.logger.LogError("無限色IDがありません。(The following free color ID does not exist: )" + text10 + " @ " + f_strMenuFileName); return(false); } mi.m_pcMultiColorID = pcMultiColorID; cacheEntry.MultiColorID = mi.m_pcMultiColorID.ToString(); } } else if (stringCom == "icon" || stringCom == "icons") { if (stringList.Length > 1) { text5 = stringList[1]; } else { Main.logger.LogError("The following menu file has an icon entry but no field set: " + f_strMenuFileName); return(false); } } else if (stringCom == "saveitem") { if (stringList.Length > 1) { string text11 = stringList[1]; if (String.IsNullOrEmpty(text11)) { Main.logger.LogWarning("SaveItem is either null or empty." + " @ " + f_strMenuFileName); } } else { Main.logger.LogWarning("A saveitem entry exists with nothing set in the field @ " + f_strMenuFileName); } } else if (stringCom == "unsetitem") { mi.m_boDelOnly = true; cacheEntry.DelMenu = mi.m_boDelOnly; } else if (stringCom == "priority") { if (stringList.Length > 1) { mi.m_fPriority = float.Parse(stringList[1]); cacheEntry.Priority = mi.m_fPriority; } else { Main.logger.LogError("The following menu file has a priority entry but no field set. A default value of 10000 will be used: " + f_strMenuFileName); mi.m_fPriority = 10000f; cacheEntry.Priority = mi.m_fPriority; } } else if (stringCom == "メニューフォルダ") { if (stringList.Length > 1) { if (stringList[1].ToLower() == "man") { mi.m_bMan = true; cacheEntry.ManMenu = mi.m_bMan; } } else { Main.logger.LogError("A a menu with a menu folder setting (メニューフォルダ) has an entry but no field set: " + f_strMenuFileName); return(false); } } } } if (!String.IsNullOrEmpty(text5)) { try { IconTex = text5; cacheEntry.Icon = text5; //mi.m_texIcon = ImportCM.CreateTexture(text5); } catch (Exception) { Main.logger.LogError("Error setting some icon tex from a normal mod." + " @ " + f_strMenuFileName); return(false); } } binaryReader.Close(); } catch (Exception ex2) { Main.logger.LogError(string.Concat(new string[] { "Exception when reading: ", f_strMenuFileName, "\nThe line currently being processed, likely the issue (現在処理中だった行): ", text6, "\nPrevious line (以前の行): ", text7, "\n\n", ex2.Message, "\n", ex2.StackTrace })); return(false); } MenuCache[f_strMenuFileName] = cacheEntry; return(true); }
public static bool InitMenuItemScript(SceneEdit.SMenuItem mi, string f_strMenuFileName, out string IconTex) { IconTex = null; if (f_strMenuFileName.IndexOf("mod_") == 0) { string modPathFileName = Menu.GetModPathFileName(f_strMenuFileName); return(!string.IsNullOrEmpty(modPathFileName) && SceneEdit.InitModMenuItemScript(mi, modPathFileName)); } try { if (MenuCache.ContainsKey(f_strMenuFileName)) { MenuStub tempStub = MenuCache[f_strMenuFileName]; if (tempStub.DateModified == File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName])) { if (tempStub.Name != null) { mi.m_strMenuName = tempStub.Name; } if (tempStub.Description != null) { mi.m_strInfo = tempStub.Description; } if (tempStub.Category != null) { mi.m_strCateName = tempStub.Category; mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), tempStub.Category); } else { mi.m_mpn = MPN.null_mpn; } if (tempStub.ColorSetMPN != null) { mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), tempStub.ColorSetMPN); } if (tempStub.ColorSetMenu != null) { mi.m_strMenuNameInColorSet = tempStub.ColorSetMenu; } if (tempStub.MultiColorID == "null") { mi.m_pcMultiColorID = MaidParts.PARTS_COLOR.NONE; } else if (tempStub.MultiColorID != null) { mi.m_pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), tempStub.MultiColorID); } mi.m_boDelOnly = tempStub.DelMenu; mi.m_fPriority = tempStub.Priority; mi.m_bMan = tempStub.ManMenu; IconTex = tempStub.Icon; return(true); } else { Debug.Log($"A cache entry was found outdated. This should be automatically fixed and the cache reloaded."); } } if (FilesToRead[f_strMenuFileName] == null) { FilesToRead[f_strMenuFileName] = new MemoryStream(File.ReadAllBytes(FilesDictionary[f_strMenuFileName])); } } catch (Exception ex) { Debug.LogError(string.Concat(new string[] { "メニューファイルがが読み込めませんでした。 : ", f_strMenuFileName, " : ", ex.Message, " : StackTrace :\n", ex.StackTrace })); throw ex; } string text6 = string.Empty; string text7 = string.Empty; string path = ""; MenuStub cacheEntry = new MenuStub(); try { cacheEntry.DateModified = File.GetLastWriteTimeUtc(FilesDictionary[f_strMenuFileName]); BinaryReader binaryReader = new BinaryReader(FilesToRead[f_strMenuFileName], Encoding.UTF8); string text = binaryReader.ReadString(); NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text); binaryReader.ReadInt32(); path = binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadString(); binaryReader.ReadInt32(); string text5 = null; while (true) { int num4 = binaryReader.ReadByte(); text7 = text6; text6 = string.Empty; if (num4 == 0) { break; } for (int i = 0; i < num4; i++) { text6 = text6 + "\"" + binaryReader.ReadString() + "\" "; } if (!(text6 == string.Empty)) { string stringCom = UTY.GetStringCom(text6); string[] stringList = UTY.GetStringList(text6); if (stringCom == "name") { string text8 = stringList[1]; string text9 = string.Empty; string arg = string.Empty; int j = 0; while (j < text8.Length && text8[j] != '\u3000' && text8[j] != ' ') { text9 += text8[j]; j++; } while (j < text8.Length) { arg += text8[j]; j++; } mi.m_strMenuName = text9; cacheEntry.Name = mi.m_strMenuName; } else if (stringCom == "setumei") { mi.m_strInfo = stringList[1]; mi.m_strInfo = mi.m_strInfo.Replace("《改行》", "\n"); cacheEntry.Description = mi.m_strInfo; } else if (stringCom == "category") { string strCateName = stringList[1].ToLower(); mi.m_strCateName = strCateName; cacheEntry.Category = mi.m_strCateName; try { mi.m_mpn = (MPN)Enum.Parse(typeof(MPN), mi.m_strCateName); cacheEntry.Category = mi.m_mpn.ToString(); } catch { Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName); mi.m_mpn = MPN.null_mpn; } } else if (stringCom == "color_set") { try { mi.m_eColorSetMPN = (MPN)Enum.Parse(typeof(MPN), stringList[1].ToLower()); cacheEntry.ColorSetMPN = mi.m_eColorSetMPN.ToString(); } catch { Debug.LogWarning("カテゴリがありません。" + mi.m_strCateName); } if (stringList.Length >= 3) { mi.m_strMenuNameInColorSet = stringList[2].ToLower(); cacheEntry.ColorSetMenu = mi.m_strMenuNameInColorSet; } } else if (stringCom == "tex" || stringCom == "テクスチャ変更") { MaidParts.PARTS_COLOR pcMultiColorID = MaidParts.PARTS_COLOR.NONE; cacheEntry.MultiColorID = "null"; if (stringList.Length == 6) { string text10 = stringList[5]; try { pcMultiColorID = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), text10.ToUpper()); } catch { NDebug.Assert("無限色IDがありません。" + text10, false); } mi.m_pcMultiColorID = pcMultiColorID; cacheEntry.MultiColorID = mi.m_pcMultiColorID.ToString(); } } else if (stringCom == "icon" || stringCom == "icons") { text5 = stringList[1]; } else if (!(stringCom == "iconl")) { if (!(stringCom == "setstr")) { if (!(stringCom == "アイテムパラメータ")) { if (stringCom == "saveitem") { string text11 = stringList[1]; if (text11 == string.Empty) { Debug.LogError("err SaveItem \"" + text11); } if (text11 == null) { Debug.LogError("err SaveItem null=\"" + text11); } } else if (!(stringCom == "catno")) { if (stringCom == "unsetitem") { mi.m_boDelOnly = true; cacheEntry.DelMenu = mi.m_boDelOnly; } else if (stringCom == "priority") { mi.m_fPriority = float.Parse(stringList[1]); cacheEntry.Priority = mi.m_fPriority; } else if (stringCom == "メニューフォルダ" && stringList[1].ToLower() == "man") { mi.m_bMan = true; cacheEntry.ManMenu = mi.m_bMan; } } } } } } } if (text5 != null && text5 != string.Empty) { try { IconTex = text5; cacheEntry.Icon = text5; //mi.m_texIcon = ImportCM.CreateTexture(text5); } catch (Exception) { Debug.LogError("Error:"); } } binaryReader.Close(); } catch (Exception ex2) { Debug.LogError(string.Concat(new string[] { "Exception ", Path.GetFileName(path), " 現在処理中だった行 = ", text6, " 以前の行 = ", text7, " ", ex2.Message, "StackTrace:\n", ex2.StackTrace })); throw ex2; } MenuCache[f_strMenuFileName] = cacheEntry; return(true); }