12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections.Generic;
- namespace etoy
- {
- /// <summary>
- /// 黑板 (这里用来存放Pileline产生的各种内存信息)
- /// </summary>
- class Blackboard
- {
- /// <summary> 配置表版本号 </summary>
- public string Version;
- /// <summary> 时间戳 </summary>
- public long Timestamp;
- /// <summary> 解析完后的配置表 </summary>
- public List<Table> Tables = new List<Table>();
- /// <summary> 解析完后的KeyValue表 </summary>
- public List<KeyValueTable> KeyValueTables = new List<KeyValueTable>();
- /// <summary> 解析完后的Metadata表 </summary>
- public List<MetadataTable> MetadataTables = new List<MetadataTable>();
- /// <summary>
- /// Metadata是否包含类型
- /// </summary>
- /// <param name="typeName"></param>
- /// <returns></returns>
- public bool ContainsMetadataType(string typeName)
- {
- foreach (var table in MetadataTables)
- if (table.Structs.ContainsKey(typeName))
- return true;
- return false;
- }
- /// <summary>
- /// 尝试获取Metadata
- /// </summary>
- /// <param name="typeName"></param>
- /// <param name="metadata"></param>
- /// <returns></returns>
- public bool TryGetMetadata(string typeName, out MetadataStruct metadata)
- {
- metadata = null;
- foreach (var table in MetadataTables)
- return table.Structs.TryGetValue(typeName, out metadata);
- return false;
- }
- }
- }
|