Example #1
0
        public static bool CheckDataRange(
            ChaFile chafile,
            bool chk_custom,
            bool chk_clothes,
            bool chk_parameter,
            List <string> checkInfo = null)
        {
            bool flag = false;

            if (chk_custom)
            {
                flag = flag | ChaFileControl.CheckDataRangeFace(chafile, checkInfo) | ChaFileControl.CheckDataRangeBody(chafile, checkInfo) | ChaFileControl.CheckDataRangeHair(chafile, checkInfo);
            }
            if (chk_clothes)
            {
                flag |= ChaFileControl.CheckDataRangeCoordinate(chafile, checkInfo);
            }
            if (chk_parameter)
            {
                flag |= ChaFileControl.CheckDataRangeParameter(chafile, checkInfo);
            }
            if (flag)
            {
                Debug.LogWarningFormat("【{0}】 範囲外!", new object[1]
                {
                    (object)chafile.parameter.fullname
                });
            }
            return(flag);
        }
Example #2
0
        public bool LoadCharaFile(BinaryReader br, bool noLoadPng = false, bool noLoadStatus = true)
        {
            bool flag = this.LoadFile(br, (int)Singleton <GameSystem> .Instance.language, noLoadPng, noLoadStatus);

            if (!this.skipRangeCheck)
            {
                Singleton <Character> .Instance.isMod = ChaFileControl.CheckDataRange((ChaFile)this, true, true, true, (List <string>)null);
            }
            return(flag);
        }
Example #3
0
 public bool LoadFromBytes(byte[] bytes, bool noSetPNG = false, bool noLoadStatus = true)
 {
     using (MemoryStream memoryStream = new MemoryStream())
     {
         memoryStream.Write(bytes, 0, bytes.Length);
         memoryStream.Seek(0L, SeekOrigin.Begin);
         bool flag = this.LoadCharaFile((Stream)memoryStream, noSetPNG, noLoadStatus);
         if (!this.skipRangeCheck)
         {
             Singleton <Character> .Instance.isMod = ChaFileControl.CheckDataRange((ChaFile)this, true, true, true, (List <string>)null);
         }
         return(flag);
     }
 }
Example #4
0
        public bool LoadFileLimited(
            string filename,
            byte sex        = 255,
            bool face       = true,
            bool body       = true,
            bool hair       = true,
            bool parameter  = true,
            bool coordinate = true)
        {
            string         path           = this.ConvertCharaFilePath(filename, sex, false);
            ChaFileControl chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadFile(path, (int)Singleton <GameSystem> .Instance.language, false, true))
            {
                if (!this.skipRangeCheck)
                {
                    Singleton <Character> .Instance.isMod = ChaFileControl.CheckDataRange((ChaFile)chaFileControl, true, true, true, (List <string>)null);
                }
                if (face)
                {
                    this.custom.face = (ChaFileFace)MessagePackSerializer.Deserialize <ChaFileFace>(MessagePackSerializer.Serialize <ChaFileFace>((M0)chaFileControl.custom.face));
                }
                if (body)
                {
                    this.custom.body = (ChaFileBody)MessagePackSerializer.Deserialize <ChaFileBody>(MessagePackSerializer.Serialize <ChaFileBody>((M0)chaFileControl.custom.body));
                }
                if (hair)
                {
                    this.custom.hair = (ChaFileHair)MessagePackSerializer.Deserialize <ChaFileHair>(MessagePackSerializer.Serialize <ChaFileHair>((M0)chaFileControl.custom.hair));
                }
                if (parameter)
                {
                    this.parameter.Copy(chaFileControl.parameter);
                }
                if (coordinate)
                {
                    this.CopyCoordinate(chaFileControl.coordinate);
                }
                if (face && body && (hair && parameter) && coordinate)
                {
                    this.userID = chaFileControl.userID;
                    this.dataID = chaFileControl.dataID;
                }
            }
            return(false);
        }
Example #5
0
        public static bool InitializeCharaFile(string filename, int sex)
        {
            ChaFileControl chaFileControl = new ChaFileControl();

            if (!chaFileControl.LoadCharaFile(filename, (byte)sex, false, true))
            {
                return(false);
            }
            if (chaFileControl.gameinfo.gameRegistration)
            {
                return(true);
            }
            chaFileControl.InitGameInfoParam();
            chaFileControl.gameinfo.gameRegistration = true;
            chaFileControl.SaveCharaFile(filename, (byte)sex, false);
            return(true);
        }
Example #6
0
        public bool LoadMannequinFile(
            string assetBundleName,
            string assetName,
            bool face       = true,
            bool body       = true,
            bool hair       = true,
            bool parameter  = true,
            bool coordinate = true)
        {
            ChaFileControl chaFileControl = new ChaFileControl();
            TextAsset      ta             = CommonLib.LoadAsset <TextAsset>(assetBundleName, assetName, false, string.Empty);

            if (Object.op_Equality((Object)null, (Object)ta) || !chaFileControl.LoadFromTextAsset(ta, true, true))
            {
                return(false);
            }
            if (face)
            {
                this.custom.face = (ChaFileFace)MessagePackSerializer.Deserialize <ChaFileFace>(MessagePackSerializer.Serialize <ChaFileFace>((M0)chaFileControl.custom.face));
            }
            if (body)
            {
                this.custom.body = (ChaFileBody)MessagePackSerializer.Deserialize <ChaFileBody>(MessagePackSerializer.Serialize <ChaFileBody>((M0)chaFileControl.custom.body));
            }
            if (hair)
            {
                this.custom.hair = (ChaFileHair)MessagePackSerializer.Deserialize <ChaFileHair>(MessagePackSerializer.Serialize <ChaFileHair>((M0)chaFileControl.custom.hair));
            }
            if (parameter)
            {
                this.parameter.Copy(chaFileControl.parameter);
            }
            if (coordinate)
            {
                this.CopyCoordinate(chaFileControl.coordinate);
            }
            return(false);
        }
Example #7
0
 public static bool CheckDataRangeCoordinate(ChaFile chafile, List <string> checkInfo = null)
 {
     return(ChaFileControl.CheckDataRangeCoordinate(chafile.coordinate, (int)chafile.parameter.sex, checkInfo));
 }