66 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| //------------------------------------------------------------------------------
 | |
| // <auto-generated>
 | |
| //     This code was generated by a tool.
 | |
| //     Changes to this file may cause incorrect behavior and will be lost if
 | |
| //     the code is regenerated.
 | |
| // </auto-generated>
 | |
| //------------------------------------------------------------------------------
 | |
| using Bright.Serialization;
 | |
| using System.Collections.Generic;
 | |
| 
 | |
| 
 | |
| namespace Config.config
 | |
| {
 | |
|    
 | |
| /// <summary>
 | |
| /// 关卡配置
 | |
| /// </summary>
 | |
| public partial class TbLevelConfig
 | |
| {
 | |
|     private readonly Dictionary<string, config.LevelConfig> _dataMap;
 | |
|     private readonly List<config.LevelConfig> _dataList;
 | |
|     
 | |
|     public TbLevelConfig(ByteBuf _buf)
 | |
|     {
 | |
|         _dataMap = new Dictionary<string, config.LevelConfig>();
 | |
|         _dataList = new List<config.LevelConfig>();
 | |
|         
 | |
|         for(int n = _buf.ReadSize() ; n > 0 ; --n)
 | |
|         {
 | |
|             config.LevelConfig _v;
 | |
|             _v = config.LevelConfig.DeserializeLevelConfig(_buf);
 | |
|             _dataList.Add(_v);
 | |
|             _dataMap.Add(_v.Id, _v);
 | |
|         }
 | |
|         PostInit();
 | |
|     }
 | |
| 
 | |
|     public Dictionary<string, config.LevelConfig> DataMap => _dataMap;
 | |
|     public List<config.LevelConfig> DataList => _dataList;
 | |
| 
 | |
|     public config.LevelConfig GetOrDefault(string key) => _dataMap.TryGetValue(key, out var v) ? v : null;
 | |
|     public config.LevelConfig Get(string key) => _dataMap[key];
 | |
|     public config.LevelConfig this[string key] => _dataMap[key];
 | |
| 
 | |
|     public void Resolve(Dictionary<string, object> _tables)
 | |
|     {
 | |
|         foreach(var v in _dataList)
 | |
|         {
 | |
|             v.Resolve(_tables);
 | |
|         }
 | |
|         PostResolve();
 | |
|     }
 | |
| 
 | |
|     public void TranslateText(System.Func<string, string, string> translator)
 | |
|     {
 | |
|         foreach(var v in _dataList)
 | |
|         {
 | |
|             v.TranslateText(translator);
 | |
|         }
 | |
|     }
 | |
|     
 | |
|     partial void PostInit();
 | |
|     partial void PostResolve();
 | |
| }
 | |
| 
 | |
| } |