Пример #1
0
        public bool SaveCharaFile(string filename, byte sex = 255, bool newFile = false)
        {
            string path          = this.ConvertCharaFilePath(filename, sex, newFile);
            string directoryName = Path.GetDirectoryName(path);

            if (!System.IO.Directory.Exists(directoryName))
            {
                System.IO.Directory.CreateDirectory(directoryName);
            }
            this.charaFileName = Path.GetFileName(path);
            string userId = this.userID;
            string dataId = this.dataID;

            if (this.userID != Singleton <GameSystem> .Instance.UserUUID)
            {
                this.dataID = YS_Assist.CreateUUID();
            }
            else if (!File.Exists(path))
            {
                this.dataID = YS_Assist.CreateUUID();
            }
            this.userID = Singleton <GameSystem> .Instance.UserUUID;
            using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                bool flag = this.SaveCharaFile((Stream)fileStream, true);
                this.userID = userId;
                this.dataID = dataId;
                return(flag);
            }
        }
Пример #2
0
        private void LoadChara()
        {
            Singleton <Character> .Instance.BeginLoadAssetBundle();

            if (this.modeNew)
            {
                this.chaCtrl = Singleton <Character> .Instance.CreateChara(this.modeSex, ((Component)this).get_gameObject(), 0, (ChaFileControl)null);

                this.chaCtrl.chaFile.pngData = (byte[])null;
                this.chaCtrl.chaFile.userID  = Singleton <GameSystem> .Instance.UserUUID;
                this.chaCtrl.chaFile.dataID  = YS_Assist.CreateUUID();
            }
            else
            {
                this.chaCtrl = Singleton <Character> .Instance.CreateChara(this.modeSex, ((Component)this).get_gameObject(), 0, (ChaFileControl)null);

                this.chaCtrl.chaFile.LoadCharaFile(this.customBase.editSaveFileName, this.modeSex, false, true);
                this.chaCtrl.ChangeNowCoordinate(false, true);
            }
            this.chaCtrl.releaseCustomInputTexture = false;
            this.chaCtrl.Load(false);
            this.chaCtrl.ChangeEyebrowPtn(0, true);
            this.chaCtrl.ChangeEyesPtn(0, true);
            this.chaCtrl.ChangeMouthPtn(0, true);
            this.chaCtrl.ChangeLookEyesPtn(1);
            this.chaCtrl.ChangeLookNeckPtn(0, 1f);
            this.chaCtrl.hideMoz = true;
            this.chaCtrl.fileStatus.visibleSon = false;
        }
Пример #3
0
 public void GenerateUserInfo(bool forceGenerate = false)
 {
     if (!forceGenerate && this.LoadIdAndPass())
     {
         return;
     }
     this.UserUUID   = YS_Assist.CreateUUID();
     this.UserPasswd = YS_Assist.GeneratePassword62(16);
     this.SaveIdAndPass();
 }
Пример #4
0
 public void Save(string _path, byte[] _pngData)
 {
     using (FileStream fileStream = new FileStream(_path, FileMode.Create, FileAccess.Write, FileShare.Write))
     {
         using (BinaryWriter binaryWriter = new BinaryWriter((Stream)fileStream))
         {
             binaryWriter.Write(_pngData);
             binaryWriter.Write(100);
             binaryWriter.Write("【AIS_Housing】");
             binaryWriter.Write(this._version.ToString());
             binaryWriter.Write(Singleton <GameSystem> .Instance.UserUUID);
             binaryWriter.Write(YS_Assist.CreateUUID());
             binaryWriter.Write(Singleton <Manager.Housing> .Instance.GetSizeType(this.AreaNo));
             binaryWriter.Write(Singleton <GameSystem> .Instance.languageInt);
             byte[] buffer = MessagePackSerializer.Serialize <CraftInfo>((M0)this);
             binaryWriter.Write(buffer);
         }
     }
 }