public static MaidProp CreateProp(int minval, int maxval, int defval, MPN mpn, int type) { //NDebug.Assert(type == 0 || type == 1 || type == 2, "プロパティオブジェクトのタイプが不正です。"); if (type > 2 || type < 0) { MyLog.Log("プロパティオブジェクトのタイプが不正です"); return(null); } MaidProp maidProp = new MaidProp(); maidProp.name = mpn.ToString(); maidProp.type = type; maidProp.min = minval; maidProp.max = maxval; if (defval < minval) { defval = minval; } if (defval > maxval) { defval = maxval; } maidProp.value_Default = defval; maidProp.listSubProp = null; maidProp.strFileName = string.Empty; maidProp.temp_value = (maidProp.value = defval); maidProp.idx = (int)mpn; maidProp.boDut = true; maidProp.boTempDut = false; return(maidProp); }
private void button4_Click(object sender, EventArgs e) { MyLog.Log("처리 시작"); PresetUtill.GetUniqueProcSub(Preset.PresetListLoad(), PresetType.Wear); PresetUtill.GetUniqueProcSub(Preset.PresetListLoad(), PresetType.Body); PresetUtill.GetUniqueProcSub(Preset.PresetListLoad(), PresetType.All); MyLog.Log("처리 완료"); }
void Form1_DragDrop(object sender, DragEventArgs e) { string[] directoryName = (string[])e.Data.GetData(DataFormats.FileDrop); MyLog.Log("directoryName:" + directoryName[0]); //string[] dirs = Directory.GetDirectories(directoryName[0]); //MyLog.Log("dirs:" + dirs[0]); PresetUtill.PresetDirectory = ((TextBox)sender).Text = directoryName[0]; }
public static bool DeserializeBodyRead(BinaryReader f_brRead) { string a = f_brRead.ReadString(); if (a != "CM3D2_MAID_BODY") { MyLog.Log("메이드 Body 헤더가 잘못되었습니다."); return(false); } //NDebug.Assert(a == "CM3D2_MAID_BODY", "메이드 Body 헤더가 잘못되었습니다."); int num = f_brRead.ReadInt32(); return(true); }
public static Preset PresetLoad(BinaryReader brRead, string f_strFileName) { Preset preset = new Preset(); preset.strFileName = f_strFileName; string a = brRead.ReadString(); if (a != "CM3D2_PRESET") { MyLog.Log("프리셋 파일의 헤더가 잘못되었습니다。"); return(null); } //NDebug.Assert(a == "CM3D2_PRESET", "프리셋 파일의 헤더가 잘못되었습니다。"); int num = brRead.ReadInt32(); preset.nVersion = num; int ePreType = brRead.ReadInt32(); preset.ePreType = (PresetType)ePreType; int num2 = brRead.ReadInt32(); if (num2 != 0) { byte[] data = brRead.ReadBytes(num2); //preset.texThum = new Texture2D(1, 1); //preset.texThum.LoadImage(data); //preset.texThum.wrapMode = TextureWrapMode.Clamp; } else { //preset.texThum = null; } preset.listMprop = Maid.DeserializePropPre(brRead); if (num >= 2) { preset.aryPartsColor = MaidParts.DeserializePre(brRead); } if (num >= 200) { Maid.DeserializeBodyRead(brRead); } return(preset); }
public static List <Preset> PresetListLoad() { List <Preset> list = new List <Preset>(); string presetDirectory = PresetUtill.PresetDirectory; if (!Directory.Exists(presetDirectory)) { return(null); } foreach (string f_strFileName in Directory.GetFiles(presetDirectory, "*.preset")) { MyLog.Log(f_strFileName); Preset item = PresetLoad(f_strFileName); if (item == null) { continue; } list.Add(item); } return(list); }
public static List <MaidProp> DeserializePropPre(BinaryReader f_brRead) { List <MaidProp> list = new List <MaidProp>(); string a = f_brRead.ReadString(); if (a != "CM3D2_MPROP_LIST") { MyLog.Log("메이드 속성 목록의 헤더가 잘못되었습니다。"); return(null); } //NDebug.Assert(a == "CM3D2_MPROP_LIST", "메이드 속성 목록의 헤더가 잘못되었습니다。"); int num = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); HashSet <MPN> hashSet = new HashSet <MPN>(); for (int i = 0; i < num2; i++) { if (4 <= num) { string text = f_brRead.ReadString(); } MaidProp maidProp = new MaidProp(); if (maidProp.Deserialize(f_brRead)) { continue; } hashSet.Add((MPN)maidProp.idx); list.Add(maidProp); if (num <= 110 && maidProp.idx == 10) { list.Add(new MaidProp { type = maidProp.type, idx = 11, name = MPN.EyeSclX.ToString(), value = maidProp.value, min = maidProp.min, max = maidProp.max, boDut = true }); list.Add(new MaidProp { type = maidProp.type, idx = 12, name = MPN.EyeSclY.ToString(), value = maidProp.value, min = maidProp.min, max = maidProp.max, boDut = true }); } } if (num < 200) { list.Add(Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2)); list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuY, 2)); } if (num < 210) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2)); list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2)); } if (!hashSet.Contains(MPN.FaceShapeSlim)) { list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2)); } if (!hashSet.Contains(MPN.EarNone)) { list.Add(Maid.CreateProp(0, 1, 0, MPN.EarNone, 2)); } if (!hashSet.Contains(MPN.EarElf)) { list.Add(Maid.CreateProp(0, 100, 0, MPN.EarElf, 2)); } if (!hashSet.Contains(MPN.EarRot)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EarRot, 2)); } if (!hashSet.Contains(MPN.EarScl)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.EarScl, 2)); } if (!hashSet.Contains(MPN.NosePos)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.NosePos, 2)); } if (!hashSet.Contains(MPN.NoseScl)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2)); } if (!hashSet.Contains(MPN.MayuShapeIn)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2)); } if (!hashSet.Contains(MPN.MayuShapeOut)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2)); } if (!hashSet.Contains(MPN.MayuRot)) { list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2)); } return(list); }
// Token: 0x06001C6B RID: 7275 RVA: 0x000D1DB0 File Offset: 0x000D01B0 public bool Deserialize(BinaryReader f_brRead) { bool result = true; //NDebug.Assert(f_brRead.ReadString() == "CM3D2_MPROP", "メイドプロパティのヘッダーが不正です。"); if (f_brRead.ReadString() != "CM3D2_MPROP") { MyLog.Log("メイドプロパティのヘッダーが不正です"); return(false); } int num = f_brRead.ReadInt32(); this.idx = f_brRead.ReadInt32(); if (num <= 110 && 10 <= this.idx) { this.idx += 2; } this.name = f_brRead.ReadString(); try { this.idx = (int)Enum.Parse(typeof(MPN), this.name, true); } catch (Exception e) { MyLog.Log("Enum.Parse1 error : " + e.ToString()); result = false; } this.type = f_brRead.ReadInt32(); this.value_Default = f_brRead.ReadInt32(); this.value = f_brRead.ReadInt32(); if (101 <= num) { this.temp_value = f_brRead.ReadInt32(); } this.value_LinkMAX = f_brRead.ReadInt32(); this.strFileName = f_brRead.ReadString().ToLower(); this.nFileNameRID = f_brRead.ReadInt32(); this.boDut = f_brRead.ReadBoolean(); this.max = f_brRead.ReadInt32(); this.min = f_brRead.ReadInt32(); if (this.listSubProp != null && this.listSubProp.Count != 0) { this.listSubProp = null; } if (200 <= num) { int num2 = f_brRead.ReadInt32(); if (num2 != 0) { this.listSubProp = new List <SubProp>(); } for (int i = 0; i < num2; i++) { bool flag = f_brRead.ReadBoolean(); if (flag) { SubProp subProp = new SubProp(); subProp.bDut = f_brRead.ReadBoolean(); subProp.strFileName = f_brRead.ReadString(); subProp.nFileNameRID = f_brRead.ReadInt32(); if (211 <= num) { subProp.fTexMulAlpha = f_brRead.ReadSingle(); } subProp.bDut = true; this.listSubProp.Add(subProp); } else { this.listSubProp.Add(null); } } } else if (this.type == 3 && (this.name == "acctatoo" || this.name == "hokuro") && !string.IsNullOrEmpty(this.strFileName) && !this.strFileName.Contains("_del")) { this.listSubProp = new List <SubProp>(); SubProp subProp2 = new SubProp(); subProp2.bDut = true; subProp2.strFileName = this.strFileName; subProp2.nFileNameRID = this.nFileNameRID; this.listSubProp.Add(subProp2); this.strFileName = CM3.dicDelItem[(MPN)Enum.Parse(typeof(MPN), this.name, true)].ToLower(); this.nFileNameRID = this.strFileName.GetHashCode(); } if (this.name == "eye_hi" && string.IsNullOrEmpty(this.strFileName)) { this.strFileName = "_I_SkinHi.menu".ToLower(); this.nFileNameRID = this.strFileName.GetHashCode(); } else if (this.name == "mayu" && string.IsNullOrEmpty(this.strFileName)) { this.strFileName = "_I_mayu_001_mugen.menu".ToLower(); this.nFileNameRID = this.strFileName.GetHashCode(); } if (num <= 208 && this.idx == 65 && this.strFileName.ToLower() == "_I_acctatoo_del.menu".ToLower()) { this.strFileName = CM3.dicDelItem[MPN.accnail].ToLower(); this.nFileNameRID = this.strFileName.GetHashCode(); } this.m_dicTBodySkinPos.Clear(); this.m_dicTBodyAttachPos.Clear(); this.m_dicMaterialProp.Clear(); this.m_dicBoneLength.Clear(); if (200 <= num) { int num3 = f_brRead.ReadInt32(); for (int j = 0; j < num3; j++) { TBody.SlotID key = (TBody.SlotID)f_brRead.ReadInt32(); int key2 = f_brRead.ReadInt32(); BoneAttachPos boneAttachPos = new BoneAttachPos(); boneAttachPos.bEnable = f_brRead.ReadBoolean(); boneAttachPos.pss.position.x = f_brRead.ReadSingle(); boneAttachPos.pss.position.y = f_brRead.ReadSingle(); boneAttachPos.pss.position.z = f_brRead.ReadSingle(); boneAttachPos.pss.rotation.x = f_brRead.ReadSingle(); boneAttachPos.pss.rotation.y = f_brRead.ReadSingle(); boneAttachPos.pss.rotation.z = f_brRead.ReadSingle(); boneAttachPos.pss.rotation.w = f_brRead.ReadSingle(); boneAttachPos.pss.scale.x = f_brRead.ReadSingle(); boneAttachPos.pss.scale.y = f_brRead.ReadSingle(); boneAttachPos.pss.scale.z = f_brRead.ReadSingle(); KeyValuePair <int, BoneAttachPos> keyValuePair = new KeyValuePair <int, BoneAttachPos>(key2, boneAttachPos); this.m_dicTBodySkinPos[key] = keyValuePair; } int num4 = f_brRead.ReadInt32(); for (int k = 0; k < num4; k++) { TBody.SlotID key3 = (TBody.SlotID)f_brRead.ReadInt32(); int num5 = f_brRead.ReadInt32(); Dictionary <string, KeyValuePair <int, VtxAttachPos> > dictionary = new Dictionary <string, KeyValuePair <int, VtxAttachPos> >(); for (int l = 0; l < num5; l++) { string key4 = f_brRead.ReadString(); int key5 = f_brRead.ReadInt32(); VtxAttachPos vtxAttachPos = new VtxAttachPos(); vtxAttachPos.bEnable = f_brRead.ReadBoolean(); vtxAttachPos.vtxcount = f_brRead.ReadInt32(); vtxAttachPos.vidx = f_brRead.ReadInt32(); vtxAttachPos.prs.position.x = f_brRead.ReadSingle(); vtxAttachPos.prs.position.y = f_brRead.ReadSingle(); vtxAttachPos.prs.position.z = f_brRead.ReadSingle(); vtxAttachPos.prs.rotation.x = f_brRead.ReadSingle(); vtxAttachPos.prs.rotation.y = f_brRead.ReadSingle(); vtxAttachPos.prs.rotation.z = f_brRead.ReadSingle(); vtxAttachPos.prs.rotation.w = f_brRead.ReadSingle(); vtxAttachPos.prs.scale.x = f_brRead.ReadSingle(); vtxAttachPos.prs.scale.y = f_brRead.ReadSingle(); vtxAttachPos.prs.scale.z = f_brRead.ReadSingle(); dictionary.Add(key4, new KeyValuePair <int, VtxAttachPos>(key5, vtxAttachPos)); } this.m_dicTBodyAttachPos.Add(key3, dictionary); } int num6 = f_brRead.ReadInt32(); for (int m = 0; m < num6; m++) { TBody.SlotID slotID = (TBody.SlotID)f_brRead.ReadInt32(); int key6 = f_brRead.ReadInt32(); MatPropSave matPropSave = new MatPropSave(); matPropSave.nMatNo = f_brRead.ReadInt32(); matPropSave.strPropName = f_brRead.ReadString(); matPropSave.strTypeName = f_brRead.ReadString(); matPropSave.strValue = f_brRead.ReadString(); if (num < 204 && slotID == TBody.SlotID.head && matPropSave.nMatNo == 3 && (matPropSave.strPropName == "_ZTest" || matPropSave.strPropName == "ZTest")) { matPropSave.strPropName = "_ZTest2"; matPropSave.strValue = ((!(matPropSave.strValue == "8")) ? "1" : "7"); } this.m_dicMaterialProp.Add(slotID, new KeyValuePair <int, MatPropSave>(key6, matPropSave)); } if (213 <= num) { int num7 = f_brRead.ReadInt32(); for (int n = 0; n < num7; n++) { TBody.SlotID key7 = (TBody.SlotID)f_brRead.ReadInt32(); int key8 = f_brRead.ReadInt32(); int num8 = f_brRead.ReadInt32(); Dictionary <string, float> dictionary2 = new Dictionary <string, float>(); for (int num9 = 0; num9 < num8; num9++) { string key9 = f_brRead.ReadString(); float num10 = f_brRead.ReadSingle(); dictionary2.Add(key9, num10); } this.m_dicBoneLength[key7] = new KeyValuePair <int, Dictionary <string, float> >(key8, dictionary2); } } } if (num < 200 && this.idx == 58 && Path.GetFileNameWithoutExtension(this.strFileName.ToLower()) == "hair_r095_i_") { this.strFileName = "hair_r110_i_.menu".ToLower(); this.nFileNameRID = this.strFileName.GetHashCode(); } this.boDut = true; this.boTempDut = false; this.strTempFileName = string.Empty; this.nTempFileNameRID = 0; return(result); }
public unsafe static MaidParts.PartsColor[] DeserializePre(BinaryReader f_brRead) { MaidParts.PartsColor[] array = new MaidParts.PartsColor[13]; for (int i = 0; i < 13; i++) { array[i] = MaidParts.m_aryPartsColorDefault[i]; } string a = f_brRead.ReadString(); if (a != "CM3D2_MULTI_COL") { MyLog.Log("無限色のヘッダーが不正です。"); return(null); } //NDebug.Assert(a == "CM3D2_MULTI_COL", "無限色のヘッダーが不正です。"); int num = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); if (num <= 1200 && ((200 > num) ? (7 != num2) : (9 != num2))) { //NDebug.Assert("無限色数が異なります。セーブデータが破損しています。", false); return(null); } if (num <= 1200) { string[] array2 = new string[] { "EYE_L", "EYE_R", "HAIR", "EYE_BROW", "UNDER_HAIR", "SKIN", "NIPPLE", "HAIR_OUTLINE", "SKIN_OUTLINE" }; for (int j = 0; j < num2; j++) { MaidParts.PartsColor partsColor = default(MaidParts.PartsColor); partsColor.m_bUse = f_brRead.ReadBoolean(); partsColor.m_nMainHue = f_brRead.ReadInt32(); partsColor.m_nMainChroma = f_brRead.ReadInt32(); partsColor.m_nMainBrightness = f_brRead.ReadInt32(); partsColor.m_nMainContrast = f_brRead.ReadInt32(); partsColor.m_nShadowRate = f_brRead.ReadInt32(); partsColor.m_nShadowHue = f_brRead.ReadInt32(); partsColor.m_nShadowChroma = f_brRead.ReadInt32(); partsColor.m_nShadowBrightness = f_brRead.ReadInt32(); partsColor.m_nShadowContrast = f_brRead.ReadInt32(); MaidParts.PARTS_COLOR parts_COLOR = (MaidParts.PARTS_COLOR)Enum.Parse(typeof(MaidParts.PARTS_COLOR), array2[j], true); array[(int)parts_COLOR] = partsColor; } } else { string value; while ((value = f_brRead.ReadString()) != MaidParts.PARTS_COLOR.MAX.ToString()) { PARTS_COLOR parts_COLOR2 = (PARTS_COLOR)Enum.Parse(typeof(PARTS_COLOR), value, true); fixed(MaidParts.PartsColor *ptr = &array[(int)parts_COLOR2]) { ptr->m_bUse = f_brRead.ReadBoolean(); ptr->m_nMainHue = f_brRead.ReadInt32(); ptr->m_nMainChroma = f_brRead.ReadInt32(); ptr->m_nMainBrightness = f_brRead.ReadInt32(); ptr->m_nMainContrast = f_brRead.ReadInt32(); ptr->m_nShadowRate = f_brRead.ReadInt32(); ptr->m_nShadowHue = f_brRead.ReadInt32(); ptr->m_nShadowChroma = f_brRead.ReadInt32(); ptr->m_nShadowBrightness = f_brRead.ReadInt32(); ptr->m_nShadowContrast = f_brRead.ReadInt32(); } } } return(array); }