public override void ProcessEvent(MsgBase tmpMsg) { switch (tmpMsg.msgId) { case (ushort)TabToyEvent.TableTestGetSample: { TableTestMsg tmp = (TableTestMsg)tmpMsg; SampleDefine tmpsampleDefine = GetSampleDefineById(tmp.sampleDefineId); tmp.msgId = (ushort)TabToyEvent.TableTestBackSample; tmp.sampleDefine = tmpsampleDefine; SendMsg(tmp); } break; case (ushort)TabToyEvent.TableTestGetBlongs: { TableTestMsg tmp = (TableTestMsg)tmpMsg; BlongsDefine tmpsampleDefine = GetBlongsDefineById(tmp.blongsDefineId); tmp.msgId = (ushort)TabToyEvent.TableTestBackBlongs; tmp.blongsDefine = tmpsampleDefine; SendMsg(tmp); } break; } }
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); } }
public TableTestMsg(int _sampleDefineId, SampleDefine _sampleDefine, int _blongsDefineId, BlongsDefine _blongsDefine) { sampleDefineId = _sampleDefineId; sampleDefine = _sampleDefine; blongsDefineId = _blongsDefineId; blongsDefine = _blongsDefine; }