Esempio n. 1
0
    public static Vec3 create(tabtoy.DataReader reader)
    {
        Vec3 ins = new Vec3();
        int  len = reader.ReadInt32();

        while (len > 0)
        {
            int tag = reader.ReadInt32();
            len--;
            switch (tag)
            {
            case 0x50000:
            {
                ins.X = reader.ReadFloat();
            }
            break;

            case 0x50001:
            {
                ins.Y = reader.ReadFloat();
            }
            break;

            case 0x50002:
            {
                ins.Z = reader.ReadFloat();
            }
            break;
            }
        }
        return(ins);
    }
Esempio n. 2
0
        static void Main(string[] args)
        {
            using (var stream = new FileStream("../../Config.bin", FileMode.Open))
            {
                stream.Position = 0;

                var reader = new tabtoy.DataReader(stream);

                var config = new table.Config();

                var result = reader.ReadHeader(config.GetBuildID());
                if (result != FileState.OK)
                {
                    Console.WriteLine("combine file crack!");
                    return;
                }


                table.Config.Deserialize(config, reader);

                // 直接通过下标获取或遍历
                var directFetch = config.Sample[2];

                // 添加日志输出或自定义输出
                config.TableLogger.AddTarget(new tabtoy.DebuggerTarget());

                // 取空时, 当默认值不为空时, 输出日志
                var nullFetchOutLog = config.GetSampleByID(0);
            }
        }
Esempio n. 3
0
    void Test()
    {
        using (var stream = new FileStream(Application.dataPath + "/StreamingAssets/DataBin/TableTest.bin", FileMode.Open))
        {
            stream.Position = 0;

            var reader = new tabtoy.DataReader(stream);

            if (!reader.ReadHeader())
            {
                Console.WriteLine("combine file crack!");
                return;
            }

            var config = new TableTest.Config();
            TableTest.Config.Deserialize(config, reader);

            // 直接通过下标获取或遍历
            var directFetch = config.Sample[2];

            // 添加日志输出或自定义输出
            config.TableLogger.AddTarget(new tabtoy.DebuggerTarget());

            // 取空时, 当默认值不为空时, 输出日志
            SampleDefine sampleDefine = config.GetSampleByID(101);
            Debug.Log("sampleDefine =" + sampleDefine.Name);
        }
    }
Esempio n. 4
0
 public static Vec3[] createArray(tabtoy.DataReader reader, Int32 len)
 {
     Vec3[] temp = new Vec3[len];
     for (int i = 0; i < len; i++)
     {
         temp[i] = create(reader);
     }
     return(temp);
 }
Esempio n. 5
0
    /// <summary>
    /// 初始化数据
    /// 运行时改为手动调用
    /// </summary>
    public void InitData()
    {
        //var t = Time.realtimeSinceStartup;
        MemoryStream ms     = new MemoryStream(bytes);
        var          reader = new tabtoy.DataReader(ms, ms.Length);

        if (!reader.ReadHeader())
        {
            return;
        }

        Config.Deserialize(config, reader);
    }
Esempio n. 6
0
    void LoadBinData()
    {
        using (var stream = new FileStream(Application.dataPath + "/StreamingAssets/DataBin/TableTest.bin", FileMode.Open))
        {
            stream.Position = 0;

            var reader = new tabtoy.DataReader(stream);

            if (!reader.ReadHeader())
            {
                Console.WriteLine("combine file crack!");
                return;
            }

            config = new TableTest.Config();
            TableTest.Config.Deserialize(config, reader);
        }
    }
    public static void Init()
    {
        var stream = new FileStream(Application.streamingAssetsPath + "/Config/Config.bin", FileMode.Open);

        stream.Position = 0;

        var reader = new tabtoy.DataReader(stream);

        if (!reader.ReadHeader(  ))
        {
            Console.WriteLine("combine file crack!");
            return;
        }

        table.Config.Deserialize(m_tabtoyConfig, reader);
        var directFetch = m_tabtoyConfig.Story[0];


        m_tabtoyConfig.TableLogger.AddTarget(new tabtoy.DebuggerTarget());
    }