Ejemplo n.º 1
0
        //セーブデータ用のバイナリ読み込み
        void ReadSaveData(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version >= VERSION_0)
            {
                this.Clear();
                if (version >= VERSION)
                {
                    this.isEventMode = reader.ReadBoolean();
                }

                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    string   key   = reader.ReadString();
                    AdvLayer layer = GetLayer(key);
                    if (null != layer)
                    {
                        layer.ReadSaveData(reader);
                    }
                    else
                    {
                        Debug.LogError(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.ReadLayerSaveData, key));
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ヘッダーの解析
        /// </summary>
        /// <param name="headerRow">ヘッダー情報のある行番号</param>
        public void ParseHeader(int headerRow)
        {
            this.headerRow = headerRow;
            ColumnIndexTbl = new Dictionary <string, int>();
            if (headerRow < Rows.Count)
            {
                StringGridRow row = Rows[headerRow];
                for (int i = 0; i < row.Strings.Length; ++i)
                {
                    string key = row.Strings[i];
                    if (ColumnIndexTbl.ContainsKey(key))
                    {
                        string errorMsg = "";
//						if( string.IsNullOrWhiteSpace(key) )
//						{
//							errorMsg += row.ToErrorString( "empty header in row:" + UtageToolKit.AddColorTag(""+i,"red") );
//						}
//						else
                        {
                            errorMsg += row.ToErrorString(ColorUtil.AddColorTag(key, Color.red) + "  is already contains");
                        }
                        Debug.LogError(errorMsg);
                    }
                    else
                    {
                        ColumnIndexTbl.Add(key, i);
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.StringGridParseHaeder, headerRow, this.name));
            }
        }
Ejemplo n.º 3
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader, AdvParamData.FileType fileType)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string       key         = reader.ReadString();
                string       paramString = reader.ReadString();
                AdvParamData data;
                if (Tbl.TryGetValue(key, out data))
                {
                    if (data.SaveFileType == fileType)
                    {
                        data.Read(paramString);
                    }
                }
                else
                {
                    //セーブされていたが、パラメーター設定から消えているので読み込まない
                }
            }
        }
Ejemplo n.º 4
0
        //読み込み
        public virtual void OnRead(System.IO.BinaryReader reader)
        {
            //バージョンチェック
            int version = reader.ReadInt32();

            if (version == Version)
            {
                List <string> nameList = new List <string>();
                int           count    = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    string key    = reader.ReadString();
                    byte[] buffer = reader.ReadBytes(reader.ReadInt32());
                    nameList.Add(key);
                    BinaryUtil.BinaryRead(buffer, FindWindow(key).ReadPageData);
                }
                string currentWindowName = reader.ReadString();

                ChangeActiveWindows(nameList);
                ChangeCurrentWindow(currentWindowName);
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 5
0
        internal void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= Version)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    string key    = reader.ReadString();
                    byte[] buffer = BinaryUtil.ReadBytes(reader);
                    if (Tbl.ContainsKey(key))
                    {
                        BinaryUtil.BinaryRead(buffer, Tbl[key].Read);
                    }
                    else
                    {
                        //セーブされていたが、パラメーター設定から消えているので読み込まない
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 6
0
        const int Version1          = 1;                                               //キャッシュ情報のファイルバージョン

        /// <summary>
        /// キャッシュデータテーブルをバイナリ読み込み
        /// </summary>
        /// <param name="reader">バイナリリーダー</param>
        void Read(BinaryReader reader, AssetFileManagerSettings settings, ConvertFileListManager convertFileListManager)
        {
            int magicID = reader.ReadInt32();

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

            int fileVersion = reader.ReadInt32();

            if (fileVersion == Version)
            {
                cacheFileID = reader.ReadInt32();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Add(new AssetFileInfo(reader, settings, convertFileListManager));
                }
            }
            else if (fileVersion == Version1)
            {
                cacheFileID = reader.ReadInt32();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Add(AssetFileInfo.ReadOld(reader, settings, convertFileListManager));
                }
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion));
            }
        }
Ejemplo n.º 7
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string          layerName = reader.ReadString();
                AdvGraphicLayer layer     = FindLayer(layerName);
                if (layer != null)
                {
                    reader.ReadBuffer(layer.Read);
                }
                else
                {
                    reader.SkipBuffer();
                }
            }
        }
Ejemplo n.º 8
0
        //読み込み
        public void OnRead(System.IO.BinaryReader reader)
        {
            //バージョンチェック
            int version = reader.ReadInt32();

            if (version == Version)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    string     key       = reader.ReadString();
                    int        bufferLen = reader.ReadInt32();
                    byte[]     buffer    = reader.ReadBytes(bufferLen);
                    AdvGuiBase gui;
                    if (this.objects.TryGetValue(key, out gui))
                    {
                        gui.ReadBuffer(buffer);
                    }
                    else
                    {
                        Debug.LogError(key + " is not found in GuiManager");
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 文字列からピボットを解析する
        /// </summary>
        /// <param name="text">テキスト</param>
        /// <param name="defaultValue">デフォルト値</param>
        /// <returns>解析したピボット値。文字列が設定されてなかったらデフォルト値を。解析できなかったら例外を投げる</returns>
        public static Vector2 ParsePivotOptional(string text, Vector2 defaultValue)
        {
            //何も設定がなければデフォルト値を
            if (string.IsNullOrEmpty(text))
            {
                return(defaultValue);
            }

            Vector2 pivot = Vector2.one * 0.5f;

            Pivot pivotEnum;

            if (TryParaseEnum <Pivot>(text, out pivotEnum))
            {
                return(PivotUtil.PivotEnumToVector2(pivotEnum));
            }

            if (TryParseVector2Optional(text, pivot, out pivot))
            {
                return(pivot);
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.PivotParse, text));
            }
        }
Ejemplo n.º 10
0
        // 二項演算の計算
        static object CalcBinary(object value1, ExpressionToken token, object value2)
        {
            switch (token.name)
            {
            case Prod:                          // *
            case Div:                           // /
            case Mod:                           // %
            case Plus:                          // +
            case Minus:                         // -
            case Greater:                       // >
            case Less:                          // <
            case GreaterEq:                     // >=
            case LessEq:                        // <=
                return(CalcBinaryNumber(value1, token, value2));

            case EqEq:                                  // ==
            case NotEq:                                 // !=
                return(CalcBinaryEq(value1, token, value2));

            case And:                                   // &&
            case Or:                                    // ||
                return(CalcBinaryAndOr(value1, token, value2));

            default:
                throw new Exception(LanguageErrorMsg.LocalizeTextFormat(Utage.ErrorMsg.ExpressionOperator, token.name));
            }
        }
Ejemplo n.º 11
0
        static object CalcBinaryNumberSub(float value1, ExpressionToken token, float value2)
        {
            switch (token.name)
            {
            case Prod: return(value1 * value2);

            case Div: return(value1 / value2);

            case Mod: return(value1 % value2);

            case Plus: return(value1 + value2);

            case Minus: return(value1 - value2);

            case Greater: return(value1 > value2);

            case Less: return(value1 < value2);

            case GreaterEq: return(value1 >= value2);

            case LessEq: return(value1 <= value2);

            default:
                throw new Exception(LanguageErrorMsg.LocalizeTextFormat(Utage.ErrorMsg.ExpressionOperator, token.name));
            }
        }
Ejemplo n.º 12
0
        //セーブデータ用のバイナリ読み込み
        void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }
            reader.ReadLocalTransform(this.transform);
            reader.ReadBuffer(this.EffectColor.Read);
            reader.ReadBuffer(
                (x) =>
            {
                AdvITweenPlayer.ReadSaveData(x, this.gameObject, true, this.PixelsToUnits);
            });
            reader.ReadBuffer(
                (x) =>
            {
                AdvAnimationPlayer.ReadSaveData(x, this.gameObject, Engine);
            });

            if (version <= Version0)
            {
                return;
            }

            reader.ReadBuffer(
                (x) =>
            {
                this.TargetObject.Read(x);
            });
        }
Ejemplo n.º 13
0
        public void Read(BinaryReader reader)
        {
            int num = reader.ReadInt32();

            if ((num < 0) || (num > 0))
            {
                object[] args = new object[] { num };
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, args));
            }
            else
            {
                reader.ReadLocalTransform(base.get_transform());
                reader.ReadBuffer(new Action <BinaryReader>(this.LetterBoxCamera.Read));
                int num2 = reader.ReadInt32();
                for (int i = 0; i < num2; i++)
                {
                    ImageEffectBase base2;
                    bool            flag;
                    string          type = reader.ReadString();
                    if (!ImageEffectUtil.TryGetComonentCreateIfMissing(type, out base2, out flag, this.LetterBoxCamera.get_gameObject()))
                    {
                        Debug.LogError("Unkonwo Image Effect Type [ " + type + " ]");
                        reader.SkipBuffer();
                    }
                    else
                    {
                        reader.ReadBuffer(new Action <BinaryReader>(base2.Read));
                    }
                }
            }
        }
Ejemplo n.º 14
0
        public object CalcExp(Func <string, object> callbackGetValue, Func <string, object, bool> callbackSetValue)
        {
            bool flag = false;

            foreach (ExpressionToken token in this.tokens)
            {
                if (token.Type == ExpressionToken.TokenType.Value)
                {
                    object obj2 = callbackGetValue(token.Name);
                    if (obj2 == null)
                    {
                        object[] args = new object[] { token.Name };
                        this.AddErrorMsg(LanguageErrorMsg.LocalizeTextFormat(Utage.ErrorMsg.ExpUnknownParameter, args));
                        flag = true;
                    }
                    else
                    {
                        token.Variable = obj2;
                    }
                }
            }
            if (!flag)
            {
                return(this.Calc(callbackSetValue));
            }
            return(null);
        }
Ejemplo n.º 15
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            reader.ReadLocalTransform(this.transform);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string         key     = reader.ReadString();
                AdvGraphicInfo graphic = null;
                reader.ReadBuffer(x => graphic = AdvGraphicInfo.ReadGraphicInfo(Engine, x));
                byte[]           buffer = reader.ReadBuffer();
                AdvGraphicObject obj    = CreateObject(key, graphic);
                obj.Read(buffer, graphic);
            }
            string defaulObjectName = reader.ReadString();

            DefaultObject = Find(defaulObjectName);
        }
Ejemplo n.º 16
0
        //セーブデータ用のバイナリ読み込み
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            reader.ReadLocalTransform(this.transform);
            reader.ReadBuffer(LetterBoxCamera.Read);

            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                string          imageEffectType = reader.ReadString();
                ImageEffectBase imageEffect;
                bool            alreadyEnabled;
                if (!ImageEffectUtil.TryGetComonentCreateIfMissing(imageEffectType, out imageEffect, out alreadyEnabled, LetterBoxCamera.gameObject))
                {
                    Debug.LogError("Unkonwo Image Effect Type [ " + imageEffectType + " ]");
                    reader.SkipBuffer();
                }
                else
                {
                    reader.ReadBuffer(imageEffect.Read);
                }
            }
        }
Ejemplo n.º 17
0
        //バイナリ読み込み
        public void OnRead(BinaryReader reader)
        {
            this.ClearSub();
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    selections.Add(selection);
                }
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    spriteSelections.Add(selection);
                    AddSpriteClickEvent(selection);
                }
            }
            else if (version == VERSION_0)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvSelection selection = new AdvSelection(reader, engine);
                    selections.Add(selection);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// キャシュ書き込みの準備
 /// </summary>
 /// <param name="id">キャッシュ番号</param>
 /// <param name="cacheRootDir">キャッシュのディレクトリ</param>
 /// <param name="isDebugFileName">デバッグ用のファイル名か?(ファイル名を隠蔽しないか)</param>
 /// <returns>キャッシュファイルパス</returns>
 public string ReadyToWriteCache(int id, string cacheRootDir, bool isDebugFileName)
 {
     oldCachePath = cachePath;
     //キャッシュ書き込みするものはパスを作る
     if (StrageType == AssetFileStrageType.Web)
     {
         if (isDebugFileName)
         {
             //デバッグ用に、DL元と同じファイル構成を再現
             cachePath = FilePathUtil.Combine(cacheRootDir, new Uri(FilePath).Host + new Uri(FilePath).AbsolutePath);
         }
         else
         {
             //キャッシュファイルIDで管理
             cachePath = FilePathUtil.Combine(cacheRootDir, id.ToString());
         }
         cacheVersion = Mathf.Max(0, Version);
     }
     else
     {
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.NoChacheTypeFile));
         cachePath = "";
     }
     return(cachePath);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// ヘッダーの解析
 /// </summary>
 /// <param name="headerRow">ヘッダー情報のある行番号</param>
 public void ParseHeader(int headerRow)
 {
     UnityEngine.Profiling.Profiler.BeginSample("ParseHeader");
     this.headerRow = headerRow;
     ColumnIndexTbl = new Dictionary <string, int>();
     if (headerRow < Rows.Count)
     {
         StringGridRow row = Rows[headerRow];
         for (int i = 0; i < row.Strings.Length; ++i)
         {
             string key = row.Strings[i];
             if (ColumnIndexTbl.ContainsKey(key))
             {
                 string errorMsg = "";
                 if (!string.IsNullOrEmpty(key))
                 {
                     errorMsg += row.ToErrorString(ColorUtil.AddColorTag(key, Color.red) + "  is already contains");
                     Debug.LogError(errorMsg);
                 }
             }
             else
             {
                 ColumnIndexTbl.Add(key, i);
             }
         }
     }
     else
     {
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.StringGridParseHaeder, headerRow, this.name));
     }
     UnityEngine.Profiling.Profiler.EndSample();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// バイナリ読み込み
        /// </summary>
        /// <param name="reader">バイナリリーダー</param>
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                int max;

                eventSceneLabels.Clear();
                max = reader.ReadInt32();
                for (int i = 0; i < max; ++i)
                {
                    eventSceneLabels.Add(reader.ReadString());
                }

                eventCGLabels.Clear();
                max = reader.ReadInt32();
                for (int i = 0; i < max; ++i)
                {
                    eventCGLabels.Add(reader.ReadString());
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// バイナリ読み込み
        /// </summary>
        /// <param name="reader">バイナリリーダー</param>
        public void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                isFullScreen            = reader.ReadBoolean();
                isMouseWheelSendMessage = reader.ReadBoolean();
                isEffect                  = reader.ReadBoolean();
                isSkipUnread              = reader.ReadBoolean();
                isStopSkipInSelection     = reader.ReadBoolean();
                messageSpeed              = reader.ReadSingle();
                autoBrPageSpeed           = reader.ReadSingle();
                messageWindowTransparency = reader.ReadSingle();
                soundMasterVolume         = reader.ReadSingle();
                bgmVolume                 = reader.ReadSingle();
                seVolume                  = reader.ReadSingle();
                ambienceVolume            = reader.ReadSingle();
                voiceVolume               = reader.ReadSingle();
                voiceStopType             = (VoiceStopType)(reader.ReadInt32());
                int num = reader.ReadInt32();
                isVoiceActiveArray = new bool[num];
                for (int i = 0; i < num; i++)
                {
                    isVoiceActiveArray[i] = reader.ReadBoolean();
                }
                isAutoBrPage = reader.ReadBoolean();
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 22
0
        //セーブデータ用のバイナリ読み込み
        void ReadSaveData(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= VERSION_1)
            {
                ReadOldVersion(reader, version);
            }
            else if (version == VERSION)
            {
                this.isEventMode = reader.ReadBoolean();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    string           name            = reader.ReadString();
                    string           layerName       = reader.ReadString();
                    string           graphicDataType = reader.ReadString();
                    string           graphicKey      = reader.ReadString();
                    bool             isDefault       = reader.ReadBoolean();
                    GraphicInfoList  graphicInfo     = AdvGraphicInfoParser.FindGraphicInfo(engine, graphicDataType, graphicKey);
                    AdvGraphicLayer  layer           = FindLayer(layerName);
                    AdvGraphicObject graphic         = layer.AddObject(name, graphicInfo, isDefault);
                    graphic.Read(graphicInfo, reader);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// 独自符号化つきバイナリ読み込み
 /// </summary>
 /// <param name="path">ファイルパス</param>
 /// <param name="callbackRead">バイナリ読みこみ処理のコールバック</param>
 /// <returns>成否</returns>
 public override bool ReadBinaryDecode(string path, Action <BinaryReader> callbackRead)
 {
     try
     {
         if (!Exists(path))
         {
             return(false);
         }
         //ファイル読み込み
         byte[] bytes = CustomDecode(CryptKeyBytes, FileReadAllBytes(path));
         //各パラメーター読み込み
         using (MemoryStream stream = new MemoryStream(bytes))
         {
             using (BinaryReader reader = new BinaryReader(stream))
             {
                 callbackRead(reader);
             }
         }
         return(true);
     }
     catch (Exception e)
     {
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.FileRead, path, e.ToString()));
         return(false);
     }
 }
Ejemplo n.º 24
0
        //セーブデータ用のバイナリ読み込み
        public void ReadSaveDataBuffer(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version == VERSION)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    string          streamName = reader.ReadString();
                    SoundStreamFade stream     = GetStreamAndCreateIfMissing(streamName);
                    stream.ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(streamName));
                }
            }
            else if (version == VERSION_0)
            {
                //BGMと環境音のみを再生
                GetStreamAndCreateIfMissing(SoundManager.IdBgm).ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(SoundManager.IdBgm));
                GetStreamAndCreateIfMissing(SoundManager.IdAmbience).ReadSaveData(reader, () => SoundMangaer.GetMasterVolume(SoundManager.IdAmbience));
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 25
0
        //バイナリ読み込み
        internal void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= Version)
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    AdvParamData data = new AdvParamData();
                    AdvParamData src;
                    data.Read(reader, version);
                    if (Tbl.TryGetValue(data.Key, out src))
                    {
                        src.CopySaveData(data);
                    }
                    else
                    {
                        //セーブされていたが、パラメーター設定から消えているので読み込まない
                    }
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 26
0
        const int Version1          = 1;                                           //旧ファイルバージョン

        //バイナリ読み込み
        void ReadBinary(BinaryReader reader)
        {
            int magicID = reader.ReadInt32();

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

            int fileVersion = reader.ReadInt32();

            if (fileVersion == Version)
            {
                ReadData.Read(reader);
                Engine.Config.Read(reader);
                GalleryData.Read(reader);
                Engine.Param.ReadSystemData(reader);
            }
            else if (fileVersion == Version1)
            {
                ReadData.Read(reader);
                Engine.Config.Read(reader);
                GalleryData.Read(reader);
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion));
            }
        }
Ejemplo n.º 27
0
        //バイナリ読み込み
        internal void Read(AdvEngine engine, BinaryReader reader)
        {
            this.Clear();
            if (reader.BaseStream.Length <= 0)
            {
                return;
            }

            int version = reader.ReadInt32();

            if (version == Version)
            {
                int count = reader.ReadInt32();
                SubRoutineInfo[] array = new SubRoutineInfo[count];
                for (int i = 0; i < count; i++)
                {
                    array[i] = new SubRoutineInfo(engine, reader);
                }
                for (int i = count - 1; i >= 0; --i)
                {
                    subRoutineCallStack.Push(array[i]);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 28
0
        public override void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version < 0 || version > Version)
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
                return;
            }

            string   typeName = reader.ReadString();
            SaveType type     = (SaveType)System.Enum.Parse(typeof(SaveType), typeName);

            switch (type)
            {
            case SaveType.Animator:
            {
                int count = reader.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    int   stateNameHash  = reader.ReadInt32();
                    int   layer          = i;
                    float normalizedTime = reader.ReadSingle();
                    animator.Play(stateNameHash, layer, normalizedTime);
                }
            }
            break;

            case SaveType.Other:
            default:
                string stateName = reader.ReadString();
                ChangeAnimationState(stateName, 0);
                break;
            }
        }
Ejemplo n.º 29
0
        //セーブデータ用のバイナリ読み込み
        internal void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= Version)
            {
                int audioCount = reader.ReadInt32();
                for (int i = 0; i < audioCount; ++i)
                {
                    bool enableSave = reader.ReadBoolean();
                    if (!enableSave)
                    {
                        continue;
                    }

                    SoundData soundData = new SoundData();
                    reader.ReadBuffer(soundData.Read);
                    Play(soundData, 0.1f, 0);
                }
                string audioName = reader.ReadString();
                if (!string.IsNullOrEmpty(audioName))
                {
                    Audio = AudioList.Find(x => x.gameObject.name == audioName);
                }
                if (this.Group.AutoDestoryPlayer && AudioList.Count == 0)
                {
                    GameObject.Destroy(this.gameObject);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Ejemplo n.º 30
0
        const int Version           = 1;                                               //キャッシュ情報のファイルバージョン

        /// <summary>
        /// キャッシュデータテーブルをバイナリ読み込み
        /// </summary>
        /// <param name="reader">バイナリリーダー</param>
        public void Read(BinaryReader reader)
        {
            int magicID = reader.ReadInt32();

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

            int fileVersion = reader.ReadInt32();

            if (fileVersion == Version)
            {
                cacheFileID = reader.ReadInt32();
                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Add(new AssetFileInfo(reader));
                }
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion));
            }
        }