Example #1
0
        public static void Deserialize(string filename, bool isAssetBundle = false)
        {
            TextAsset textAsset = null;

            if (isAssetBundle && AssetBundleMgr.ContainsFile(filename, "bytes"))
            {
                textAsset = AssetBundleMgr.Load(filename, "bytes") as TextAsset;
            }
            else
            {
                textAsset = Resources.Load(filename) as TextAsset;
            }
            BinaryFormatter formatter = new BinaryFormatter();
            MemoryStream    mstream   = new MemoryStream();

            byte[] tmp = new byte[textAsset.bytes.Length];
            CsvHelper.Encode(textAsset.bytes, 0, tmp, 0, tmp.Length, ASCIIEncoding.ASCII.GetBytes("ABCDEFG2"));
            mstream.Write(tmp, 0, tmp.Length);
            mstream.Position = 0;
            Data             = formatter.Deserialize(mstream) as Dictionary <int, HeroRecord>;
            mstream.Close();
        }
        public static void Deserialize(string filename, bool isAssetBundle = false)
        {
            TextAsset textAsset = null;

            if (isAssetBundle && AssetBundleMgr.ContainsFile(filename, "bytes"))
            {
                textAsset = AssetBundleMgr.Load(filename, "bytes") as TextAsset;
            }
            else
            {
                textAsset = Resources.Load(filename) as TextAsset;
            }
            RecordIdValue.Clear();
            IdRecordValue.Clear();
            Init();
            Init2();
            BinaryFormatter formatter = new BinaryFormatter();
            Stream          stream    = new MemoryStream(textAsset.bytes);

            Data = formatter.Deserialize(stream) as Dictionary <int, LocalizationRecord>;
            stream.Close();
        }