public bool LoadBytes(byte[] data, Version ver) { using (MemoryStream memoryStream = new MemoryStream(data)) { using (BinaryReader binaryReader = new BinaryReader((Stream)memoryStream)) { int count1 = binaryReader.ReadInt32(); this.face = (ChaFileFace)MessagePackSerializer.Deserialize <ChaFileFace>(binaryReader.ReadBytes(count1)); int count2 = binaryReader.ReadInt32(); this.body = (ChaFileBody)MessagePackSerializer.Deserialize <ChaFileBody>(binaryReader.ReadBytes(count2)); int count3 = binaryReader.ReadInt32(); this.hair = (ChaFileHair)MessagePackSerializer.Deserialize <ChaFileHair>(binaryReader.ReadBytes(count3)); this.face.ComplementWithVersion(); this.body.ComplementWithVersion(); this.hair.ComplementWithVersion(); return(true); } } }
public static bool CheckDataRangeBody(ChaFile chafile, List <string> checkInfo = null) { ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl; ChaFileBody body = chafile.custom.body; byte sex = chafile.parameter.sex; bool flag = false; for (int index = 0; index < body.shapeValueBody.Length; ++index) { if (!MathfEx.RangeEqualOn <float>(0.0f, body.shapeValueBody[index], 1f)) { checkInfo?.Add(string.Format("【{0}】値:{1}", (object)ChaFileDefine.cf_bodyshapename[index], (object)body.shapeValueBody[index])); flag = true; body.shapeValueBody[index] = Mathf.Clamp(body.shapeValueBody[index], 0.0f, 1f); } } if (!MathfEx.RangeEqualOn <float>(0.0f, body.bustSoftness, 1f)) { checkInfo?.Add(string.Format("【胸の柔らかさ】値:{0}", (object)body.bustSoftness)); flag = true; body.bustSoftness = Mathf.Clamp(body.bustSoftness, 0.0f, 1f); } if (!MathfEx.RangeEqualOn <float>(0.0f, body.bustWeight, 1f)) { checkInfo?.Add(string.Format("【胸の重さ】値:{0}", (object)body.bustWeight)); flag = true; body.bustWeight = Mathf.Clamp(body.bustWeight, 0.0f, 1f); } if (!chaListCtrl.GetCategoryInfo(sex != (byte)0 ? ChaListDefine.CategoryNo.ft_skin_b : ChaListDefine.CategoryNo.mt_skin_b).ContainsKey(body.skinId)) { checkInfo?.Add(string.Format("【肌の種類】値:{0}", (object)body.skinId)); flag = true; body.skinId = 0; } if (!chaListCtrl.GetCategoryInfo(sex != (byte)0 ? ChaListDefine.CategoryNo.ft_detail_b : ChaListDefine.CategoryNo.mt_detail_b).ContainsKey(body.detailId)) { checkInfo?.Add(string.Format("【筋肉の種類】値:{0}", (object)body.detailId)); flag = true; body.detailId = 0; } if (!chaListCtrl.GetCategoryInfo(sex != (byte)0 ? ChaListDefine.CategoryNo.ft_sunburn : ChaListDefine.CategoryNo.mt_sunburn).ContainsKey(body.sunburnId)) { checkInfo?.Add(string.Format("【日焼けの種類】値:{0}", (object)body.sunburnId)); flag = true; body.sunburnId = 0; } for (int index = 0; index < 2; ++index) { if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.st_paint).ContainsKey(body.paintInfo[index].id)) { checkInfo?.Add(string.Format("【ペイントの種類】値:{0}", (object)body.paintInfo[index].id)); flag = true; body.paintInfo[index].id = 0; } } if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.st_nip).ContainsKey(body.nipId)) { checkInfo?.Add(string.Format("【乳首の種類】値:{0}", (object)body.nipId)); flag = true; body.nipId = 0; } if (!MathfEx.RangeEqualOn <float>(0.0f, body.areolaSize, 1f)) { checkInfo?.Add(string.Format("【乳輪のサイズ】値:{0}", (object)body.areolaSize)); flag = true; body.areolaSize = Mathf.Clamp(body.areolaSize, 0.0f, 1f); } if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.st_underhair).ContainsKey(body.underhairId)) { checkInfo?.Add(string.Format("【アンダーヘア種類】値:{0}", (object)body.underhairId)); flag = true; body.underhairId = 0; } return(flag); }
public void MemberInit() { this.face = new ChaFileFace(); this.body = new ChaFileBody(); this.hair = new ChaFileHair(); }