Exemple #1
0
        public static bool CheckDataRangeHair(ChaFile chafile, List <string> checkInfo = null)
        {
            ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
            ChaFileHair    hair        = chafile.custom.hair;
            byte           sex         = chafile.parameter.sex;
            bool           flag        = false;

            if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.so_hair_b).ContainsKey(hair.parts[0].id))
            {
                checkInfo?.Add(string.Format("【後ろ髪】値:{0}", (object)hair.parts[0].id));
                flag             = true;
                hair.parts[0].id = sex != (byte)0 ? 0 : 0;
            }
            if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.so_hair_f).ContainsKey(hair.parts[1].id))
            {
                checkInfo?.Add(string.Format("【前髪】値:{0}", (object)hair.parts[1].id));
                flag             = true;
                hair.parts[1].id = sex != (byte)0 ? 1 : 2;
            }
            if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.so_hair_s).ContainsKey(hair.parts[2].id))
            {
                checkInfo?.Add(string.Format("【横髪】値:{0}", (object)hair.parts[2].id));
                flag             = true;
                hair.parts[2].id = sex != (byte)0 ? 0 : 0;
            }
            if (!chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.so_hair_o).ContainsKey(hair.parts[3].id))
            {
                checkInfo?.Add(string.Format("【エクステ】値:{0}", (object)hair.parts[3].id));
                flag             = true;
                hair.parts[3].id = sex != (byte)0 ? 0 : 0;
            }
            return(flag);
        }
 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 void MemberInit()
 {
     this.face = new ChaFileFace();
     this.body = new ChaFileBody();
     this.hair = new ChaFileHair();
 }