public static void Test() { DataStorage ds = new DataStorage(); Sl.Data data = ProtoTest.TestDeserialize(); ds.Init(data, new DataWrapper(data, "data_", null)); Console.WriteLine(data); Sl.Player player = ds.Data.Player.Get(); Console.WriteLine(player); }
static public int GetProtoBytes_s(IntPtr l) { try { var ret = ProtoTest.GetProtoBytes(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int SetProtoBytes_s(IntPtr l) { try { SLua.ByteArray a1; checkType(l, 1, out a1); ProtoTest.SetProtoBytes(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public static void TestPerformance() { var dataStorage = new DataStorage(); var data = ProtoTest.TestDeserialize(); dataStorage.Init(data, new DataWrapper(data, "data_", null)); Stopwatch s = new Stopwatch(); s.Start(); for (int i = 0; i < 100000; ++i) { dataStorage.Data.Player.Id.Set("testId"); } s.Stop(); Console.WriteLine("ds set = " + s.Elapsed); s.Reset(); s.Start(); for (int i = 0; i < 100000; ++i) { data.Player.Id = "testId"; } s.Stop(); Console.WriteLine("default set = " + s.Elapsed); }