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(1230);
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
> 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>> keyValuePair2 in this.m_dicTBodyAttachPos)
{
f_bwWrite.Write((int)keyValuePair2.Key);
f_bwWrite.Write(keyValuePair2.Value.Count);
foreach (KeyValuePair> 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> 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>> 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 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();
}
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 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 keyValuePair = new KeyValuePair(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> dictionary = new Dictionary>();
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(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(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 dictionary2 = new Dictionary();
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>(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 listSubProp;
public bool bNoScale;
public bool boAdjustDut;
public Dictionary> m_dicTBodySkinPos = new Dictionary>();
public Dictionary>> m_dicTBodyAttachPos = new Dictionary>>();
public Dictionary> m_dicMaterialProp = new Dictionary>();
public Dictionary>> m_dicBoneLength = new Dictionary>>();
}