예제 #1
0
        // 加载所有表
        static void LoadAllTable()
        {
            using (var stream = new FileStream("../../../../binary/table_gen.bin", FileMode.Open))
            {
                stream.Position = 0;

                var reader = new tabtoy.TableReader(stream);

                var tab = new main.Table();

                try
                {
                    tab.Deserialize(reader);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }

                // 表遍历
                foreach (var kv in tab.ExampleData)
                {
                    Console.Write("{0} {1}\n", kv.ID, kv.Name);
                }

                // 直接取值
                Console.WriteLine(tab.ExtendData[1].Additive);

                // KV配置
                Console.WriteLine(tab.GetKeyValue_ExampleKV().ServerIP);
            }
        }
예제 #2
0
        // 指定表读取例子
        public static void LoadSpecifiedTable()
        {
            var tabData = new main.Table();

            LoadTableByName(tabData, "ExampleData");
            LoadTableByName(tabData, "ExtendData");

            Debug.Log("Load table merged into one class");
            // 表遍历
            foreach (var kv in tabData.ExampleData)
            {
                Debug.Log(kv.ID + "  " + kv.Name);
            }
            // 表遍历
            foreach (var kv in tabData.ExtendData)
            {
                Debug.Log(kv.Additive);
            }

            Debug.Log("Load KV table into one class");
            var tabKV = new main.Table();

            LoadTableByName(tabKV, "ExampleKV");

            // KV配置
            Debug.Log(tabKV.GetKeyValue_ExampleKV().ServerIP);
        }
예제 #3
0
        // 指定表读取例子
        static void LoadSpecifiedTable()
        {
            var tabData = new main.Table();

            LoadTableByName(tabData, "ExampleData");
            LoadTableByName(tabData, "ExtendData");

            Console.WriteLine("Load table merged into one class");
            // 表遍历
            foreach (var kv in tabData.ExampleData)
            {
                Console.Write("{0} {1}\n", kv.ID, kv.Name);
            }
            // 表遍历
            foreach (var kv in tabData.ExtendData)
            {
                Console.Write("{0}\n", kv.Additive);
            }

            Console.WriteLine("Load KV table into one class");
            var tabKV = new main.Table();

            LoadTableByName(tabKV, "ExampleKV");

            // KV配置
            Console.WriteLine(tabKV.GetKeyValue_ExampleKV().ServerIP);
        }
예제 #4
0
        public static void LoadAllTable()
        {
            using (var stream = new FileStream(Application.dataPath + "/Resources/Excel/table_gen.bin", FileMode.Open))
            {
                stream.Position = 0;

                var reader = new tabtoy.TableReader(stream);

                var tab = new main.Table();

                try
                {
                    tab.Deserialize(reader);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }

                // 表遍历
                foreach (var kv in tab.ExampleData)
                {
                    Debug.Log(kv.ID + "  " + kv.Name);
                }

                // 直接取值
                Debug.Log(tab.ExtendData[1].Additive);

                // KV配置
                Debug.Log(tab.GetKeyValue_ExampleKV().ServerIP);
            }
        }