Esempio n. 1
0
 public void MemberInit()
 {
     this.clothes            = new ChaFileClothes();
     this.accessory          = new ChaFileAccessory();
     this.coordinateFileName = string.Empty;
     this.coordinateName     = string.Empty;
     this.pngData            = (byte[])null;
     this.lastLoadErrorCode  = 0;
 }
Esempio n. 2
0
 public bool LoadBytes(byte[] data, Version ver)
 {
     using (MemoryStream memoryStream = new MemoryStream(data))
     {
         using (BinaryReader binaryReader = new BinaryReader((Stream)memoryStream))
         {
             try
             {
                 int count1 = binaryReader.ReadInt32();
                 this.clothes = (ChaFileClothes)MessagePackSerializer.Deserialize <ChaFileClothes>(binaryReader.ReadBytes(count1));
                 int count2 = binaryReader.ReadInt32();
                 this.accessory = (ChaFileAccessory)MessagePackSerializer.Deserialize <ChaFileAccessory>(binaryReader.ReadBytes(count2));
             }
             catch (EndOfStreamException ex)
             {
                 Debug.LogError((object)("データが破損している可能性があります:" + ex.GetType().Name));
                 return(false);
             }
             this.clothes.ComplementWithVersion();
             this.accessory.ComplementWithVersion();
             return(true);
         }
     }
 }
Esempio n. 3
0
        public static bool CheckDataRangeCoordinate(
            ChaFileCoordinate coorde,
            int sex,
            List <string> checkInfo = null)
        {
            ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
            bool           flag        = false;

            string[] strArray = new string[8]
            {
                "トップス",
                "ボトムス",
                "インナー上",
                "インナー下",
                "手袋",
                "パンスト",
                "靴下",
                "靴"
            };
            ChaListDefine.CategoryNo[] categoryNoArray = new ChaListDefine.CategoryNo[8]
            {
                sex != 0 ? ChaListDefine.CategoryNo.fo_top : ChaListDefine.CategoryNo.mo_top,
                sex != 0 ? ChaListDefine.CategoryNo.fo_bot : ChaListDefine.CategoryNo.mo_bot,
                sex != 0 ? ChaListDefine.CategoryNo.fo_inner_t : ChaListDefine.CategoryNo.unknown,
                sex != 0 ? ChaListDefine.CategoryNo.fo_inner_b : ChaListDefine.CategoryNo.unknown,
                sex != 0 ? ChaListDefine.CategoryNo.fo_gloves : ChaListDefine.CategoryNo.mo_gloves,
                sex != 0 ? ChaListDefine.CategoryNo.fo_panst : ChaListDefine.CategoryNo.unknown,
                sex != 0 ? ChaListDefine.CategoryNo.fo_socks : ChaListDefine.CategoryNo.unknown,
                sex != 0 ? ChaListDefine.CategoryNo.fo_shoes : ChaListDefine.CategoryNo.mo_shoes
            };
            int[] numArray1 = new int[8] {
                0, 1, 2, 3, 4, 5, 6, 7
            };
            int[] numArray2 = new int[8]
            {
                sex != 0 ? 0 : 0,
                sex != 0 ? 0 : 0,
                sex != 0 ? 0 : -1,
                sex != 0 ? 0 : -1,
                sex != 0 ? 0 : 0,
                sex != 0 ? 0 : -1,
                sex != 0 ? 0 : -1,
                sex != 0 ? 0 : 0
            };
            ChaFileClothes clothes = coorde.clothes;

            for (int index1 = 0; index1 < numArray1.Length; ++index1)
            {
                if (categoryNoArray[index1] != ChaListDefine.CategoryNo.unknown)
                {
                    if (!chaListCtrl.GetCategoryInfo(categoryNoArray[index1]).ContainsKey(clothes.parts[numArray1[index1]].id))
                    {
                        checkInfo?.Add(string.Format("【{0}】値:{1}", (object)strArray[index1], (object)clothes.parts[numArray1[index1]].id));
                        flag = true;
                        clothes.parts[numArray1[index1]].id = numArray2[index1];
                    }
                    Dictionary <int, ListInfoBase> categoryInfo = chaListCtrl.GetCategoryInfo(ChaListDefine.CategoryNo.st_pattern);
                    for (int index2 = 0; index2 < clothes.parts[numArray1[index1]].colorInfo.Length; ++index2)
                    {
                        if (!categoryInfo.ContainsKey(clothes.parts[numArray1[index1]].colorInfo[index2].pattern))
                        {
                            checkInfo?.Add(string.Format("【柄】値:{0}", (object)clothes.parts[numArray1[index1]].colorInfo[index2].pattern));
                            flag = true;
                            clothes.parts[numArray1[index1]].colorInfo[index2].pattern = 0;
                        }
                    }
                }
            }
            ChaFileAccessory accessory = coorde.accessory;

            for (int index = 0; index < accessory.parts.Length; ++index)
            {
                int type = accessory.parts[index].type;
                int id   = accessory.parts[index].id;
                Dictionary <int, ListInfoBase> categoryInfo = chaListCtrl.GetCategoryInfo((ChaListDefine.CategoryNo)type);
                if (categoryInfo != null && !categoryInfo.ContainsKey(accessory.parts[index].id))
                {
                    checkInfo?.Add(string.Format("【{0}】値:{1}", (object)ChaAccessoryDefine.GetAccessoryTypeName((ChaListDefine.CategoryNo)type), (object)accessory.parts[index].id));
                    flag = true;
                    accessory.parts[index].MemberInit();
                }
            }
            return(flag);
        }