Exemplo n.º 1
0
        //中身をコピーした新しいインスタンスを作成
        public AdvCustomSaveData Clone()
        {
            AdvCustomSaveData clone = new AdvCustomSaveData();

            foreach (string key in Buffers.Keys)
            {
                clone.Buffers.Add(key, Buffers[key]);
            }
            return(clone);
        }
Exemplo n.º 2
0
        /// <summary>
        /// ゲームのデータをセーブ
        /// </summary>
        /// <param name="engine">ADVエンジン</param>
        /// <param name="tex">セーブアイコン</param>
        public void SaveGameData(AdvEngine engine, Texture2D tex, List <IAdvCustomSaveDataIO> customSaveIoList, List <IAdvCustomSaveDataIO> verstionUpSaveIoList)
        {
            Clear();
            currentSenarioLabel      = engine.Page.ScenarioLabel;
            currentPage              = engine.Page.PageNo;
            currentGallerySceneLabel = engine.ScenarioPlayer.CurrentGallerySceneLabel;
            paramBuf            = engine.Param.ToSaveDataBuffer();
            graphicManagerBuf   = engine.GraphicManager.ToSaveDataBuffer();
            soundManagerBuf     = SoundManager.GetInstance().ToSaveDataBuffer();
            selectionManagerBuf = engine.SelectionManager.ToSaveDataBuffer();
            JumpMangerBuffer    = BinaryUtil.BinaryWrite(engine.ScenarioPlayer.JumpManager.Write);
            CustomBuffer        = new AdvCustomSaveData();
            CustomBuffer.WriteCustomSaveData(customSaveIoList);


            VersionUpBuffer = new AdvCustomSaveData();
            VersionUpBuffer.WriteCustomSaveData(verstionUpSaveIoList);

            title = engine.Page.SaveDataTitle;

            Texture = tex;
            date    = System.DateTime.Now;
        }
Exemplo n.º 3
0
        /// <summary>
        /// バイナリ読み込み
        /// </summary>
        /// <param name="reader"></param>
        public void Read(BinaryReader reader)
        {
            Clear();
            int magicID = reader.ReadInt32();

            if (magicID != MagicID)
            {
                throw new System.Exception("Read File Id Error");
            }

            this.fileVersion = reader.ReadInt32();
            if (fileVersion >= Version1)
            {
                title = reader.ReadString();
                date  = new System.DateTime(reader.ReadInt64());
                currentSenarioLabel = reader.ReadString();
                currentPage         = reader.ReadInt32();
                if (fileVersion > Version1)
                {
                    currentGallerySceneLabel = reader.ReadString();
                }

                int captureMemLen = reader.ReadInt32();
                if (captureMemLen > 0)
                {
                    byte[]    captureMem = reader.ReadBytes(captureMemLen);
                    Texture2D tex        = new Texture2D(1, 1, TextureFormat.RGB24, false);
                    tex.LoadImage(captureMem);
                    Texture = tex;
                }
                else
                {
                    Texture = null;
                }

                paramBuf            = reader.ReadBytes(reader.ReadInt32());
                graphicManagerBuf   = reader.ReadBytes(reader.ReadInt32());
                soundManagerBuf     = reader.ReadBytes(reader.ReadInt32());
                selectionManagerBuf = reader.ReadBytes(reader.ReadInt32());

                if (fileVersion > Version3)
                {
                    JumpMangerBuffer = reader.ReadBytes(reader.ReadInt32());
                }
                else
                {
                    JumpMangerBuffer = new byte[0];
                }

                if (fileVersion > Version4)
                {
                    CustomBuffer = new AdvCustomSaveData(reader);
                }
                else
                {
                    CustomBuffer = new AdvCustomSaveData();
                }

                if (fileVersion > Version5)
                {
                    VersionUpBuffer = new AdvCustomSaveData(reader);
                }
                else
                {
                    VersionUpBuffer = new AdvCustomSaveData();
                }
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion));
            }
        }