123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- [Serializable]
- public class MaidProp
- {
- public bool Serialize(BinaryWriter f_bwWrite)
- {
- f_bwWrite.Write("CM3D2_MPROP");
- f_bwWrite.Write(1430);
- f_bwWrite.Write(this.idx);
- f_bwWrite.Write(this.name);
- f_bwWrite.Write(this.type);
- f_bwWrite.Write(this.value_Default);
- f_bwWrite.Write(this.value);
- f_bwWrite.Write(this.temp_value);
- f_bwWrite.Write(this.value_LinkMAX);
- f_bwWrite.Write(this.strFileName);
- f_bwWrite.Write(this.nFileNameRID);
- f_bwWrite.Write(this.boDut);
- f_bwWrite.Write(this.max);
- f_bwWrite.Write(this.min);
- f_bwWrite.Write((this.listSubProp != null) ? this.listSubProp.Count : 0);
- if (this.listSubProp != null)
- {
- for (int i = 0; i < this.listSubProp.Count; i++)
- {
- SubProp subProp = this.listSubProp[i];
- f_bwWrite.Write(subProp != null);
- if (subProp != null)
- {
- f_bwWrite.Write(subProp.bDut);
- f_bwWrite.Write(subProp.strFileName);
- f_bwWrite.Write(subProp.nFileNameRID);
- f_bwWrite.Write(subProp.fTexMulAlpha);
- }
- }
- }
- f_bwWrite.Write(this.m_dicTBodySkinPos.Count);
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, BoneAttachPos>> keyValuePair in this.m_dicTBodySkinPos)
- {
- f_bwWrite.Write((int)keyValuePair.Key);
- f_bwWrite.Write(keyValuePair.Value.Key);
- f_bwWrite.Write(keyValuePair.Value.Value.bEnable);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.position.x);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.position.y);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.position.z);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.rotation.x);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.rotation.y);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.rotation.z);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.rotation.w);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.scale.x);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.scale.y);
- f_bwWrite.Write(keyValuePair.Value.Value.pss.scale.z);
- }
- f_bwWrite.Write(this.m_dicTBodyAttachPos.Count);
- foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair2 in this.m_dicTBodyAttachPos)
- {
- f_bwWrite.Write((int)keyValuePair2.Key);
- f_bwWrite.Write(keyValuePair2.Value.Count);
- foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair3 in keyValuePair2.Value)
- {
- f_bwWrite.Write(keyValuePair3.Key);
- f_bwWrite.Write(keyValuePair3.Value.Key);
- VtxAttachPos vtxAttachPos = keyValuePair3.Value.Value;
- f_bwWrite.Write(vtxAttachPos.bEnable);
- f_bwWrite.Write(vtxAttachPos.vtxcount);
- f_bwWrite.Write(vtxAttachPos.vidx);
- f_bwWrite.Write(vtxAttachPos.prs.position.x);
- f_bwWrite.Write(vtxAttachPos.prs.position.y);
- f_bwWrite.Write(vtxAttachPos.prs.position.z);
- f_bwWrite.Write(vtxAttachPos.prs.rotation.x);
- f_bwWrite.Write(vtxAttachPos.prs.rotation.y);
- f_bwWrite.Write(vtxAttachPos.prs.rotation.z);
- f_bwWrite.Write(vtxAttachPos.prs.rotation.w);
- f_bwWrite.Write(vtxAttachPos.prs.scale.x);
- f_bwWrite.Write(vtxAttachPos.prs.scale.y);
- f_bwWrite.Write(vtxAttachPos.prs.scale.z);
- }
- }
- f_bwWrite.Write(this.m_dicMaterialProp.Count);
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, MatPropSave>> keyValuePair4 in this.m_dicMaterialProp)
- {
- f_bwWrite.Write((int)keyValuePair4.Key);
- f_bwWrite.Write(keyValuePair4.Value.Key);
- f_bwWrite.Write(keyValuePair4.Value.Value.nMatNo);
- f_bwWrite.Write(keyValuePair4.Value.Value.strPropName);
- f_bwWrite.Write(keyValuePair4.Value.Value.strTypeName);
- f_bwWrite.Write(keyValuePair4.Value.Value.strValue);
- }
- f_bwWrite.Write(this.m_dicBoneLength.Count);
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> keyValuePair5 in this.m_dicBoneLength)
- {
- f_bwWrite.Write((int)keyValuePair5.Key);
- f_bwWrite.Write(keyValuePair5.Value.Key);
- f_bwWrite.Write(keyValuePair5.Value.Value.Count);
- foreach (KeyValuePair<string, float> keyValuePair6 in keyValuePair5.Value.Value)
- {
- f_bwWrite.Write(keyValuePair6.Key);
- f_bwWrite.Write(keyValuePair6.Value);
- }
- }
- return true;
- }
- public bool SerializeLowCapacity(BinaryWriter writer)
- {
- writer.Write(this.value);
- writer.Write(this.nFileNameRID);
- return true;
- }
- public bool Deserialize(BinaryReader f_brRead)
- {
- NDebug.Assert(f_brRead.ReadString() == "CM3D2_MPROP", "メイドプロパティのヘッダーが不正です。");
- int num = f_brRead.ReadInt32();
- this.idx = f_brRead.ReadInt32();
- if (num <= 110 && 10 <= this.idx)
- {
- this.idx += 2;
- }
- this.name = f_brRead.ReadString();
- this.idx = (int)Enum.Parse(typeof(MPN), this.name, true);
- 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();
- 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)];
- this.nFileNameRID = this.strFileName.ToLower().GetHashCode();
- }
- if (this.name == "eye_hi" && string.IsNullOrEmpty(this.strFileName))
- {
- this.strFileName = "_I_SkinHi.menu";
- this.nFileNameRID = this.strFileName.ToLower().GetHashCode();
- }
- else if (this.name == "mayu" && string.IsNullOrEmpty(this.strFileName))
- {
- this.strFileName = "_I_mayu_001_mugen.menu";
- this.nFileNameRID = this.strFileName.ToLower().GetHashCode();
- }
- if (num <= 208 && this.idx == 54 && this.strFileName.ToLower() == "_I_acctatoo_del.menu".ToLower())
- {
- this.strFileName = CM3.dicDelItem[MPN.accnail];
- this.nFileNameRID = this.strFileName.ToLower().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 == 47 && Path.GetFileNameWithoutExtension(this.strFileName.ToLower()) == "hair_r095_i_")
- {
- this.strFileName = "hair_r110_i_.menu";
- this.nFileNameRID = this.strFileName.ToLower().GetHashCode();
- }
- this.boDut = true;
- this.boTempDut = false;
- this.strTempFileName = string.Empty;
- this.nTempFileNameRID = 0;
- return true;
- }
- public bool DeserializeLowCapacity(BinaryReader reader)
- {
- this.value = reader.ReadInt32();
- this.nFileNameRID = reader.ReadInt32();
- if (this.nFileNameRID != 0)
- {
- this.strFileName = ((!GameUty.RidMenuDic.ContainsKey(this.nFileNameRID)) ? string.Empty : GameUty.RidMenuDic[this.nFileNameRID]);
- if (string.IsNullOrEmpty(this.strFileName))
- {
- this.nFileNameRID = 0;
- }
- }
- else
- {
- this.strFileName = string.Empty;
- }
- this.boDut = true;
- this.boTempDut = false;
- this.strTempFileName = string.Empty;
- this.nTempFileNameRID = 0;
- return true;
- }
- public int idx;
- public string name;
- public int type;
- public int value_Default;
- public int value;
- public int temp_value;
- public int value_LinkMAX;
- public string strFileName = string.Empty;
- public int nFileNameRID;
- public string strTempFileName = string.Empty;
- public int nTempFileNameRID;
- public bool boDut;
- public bool boTempDut;
- public int max;
- public int min;
- public bool bSubDut;
- public List<SubProp> listSubProp;
- public bool bNoScale;
- public bool boAdjustDut;
- public Dictionary<TBody.SlotID, KeyValuePair<int, BoneAttachPos>> m_dicTBodySkinPos = new Dictionary<TBody.SlotID, KeyValuePair<int, BoneAttachPos>>();
- public Dictionary<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> m_dicTBodyAttachPos = new Dictionary<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>>();
- public Dictionary<TBody.SlotID, KeyValuePair<int, MatPropSave>> m_dicMaterialProp = new Dictionary<TBody.SlotID, KeyValuePair<int, MatPropSave>>();
- public Dictionary<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> m_dicBoneLength = new Dictionary<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>>();
- }
|