|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
using ProtoBuf;
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
{
|
|
|
|
[ProtoContract]
|
|
|
|
[Config]
|
|
|
|
public partial class WorldTreeConfigCategory : ProtoObject, IMerge
|
|
|
|
{
|
|
|
|
public static WorldTreeConfigCategory Instance;
|
|
|
|
|
|
|
|
[ProtoIgnore]
|
|
|
|
[BsonIgnore]
|
|
|
|
private Dictionary<int, WorldTreeConfig> dict = new Dictionary<int, WorldTreeConfig>();
|
|
|
|
|
|
|
|
[BsonElement]
|
|
|
|
[ProtoMember(1)]
|
|
|
|
private List<WorldTreeConfig> list = new List<WorldTreeConfig>();
|
|
|
|
|
|
|
|
public WorldTreeConfigCategory()
|
|
|
|
{
|
|
|
|
Instance = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Merge(object o)
|
|
|
|
{
|
|
|
|
WorldTreeConfigCategory s = o as WorldTreeConfigCategory;
|
|
|
|
this.list.AddRange(s.list);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void EndInit()
|
|
|
|
{
|
|
|
|
foreach (WorldTreeConfig config in list)
|
|
|
|
{
|
|
|
|
config.EndInit();
|
|
|
|
this.dict.Add(config.Id, config);
|
|
|
|
}
|
|
|
|
this.AfterEndInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public WorldTreeConfig Get(int id)
|
|
|
|
{
|
|
|
|
this.dict.TryGetValue(id, out WorldTreeConfig item);
|
|
|
|
|
|
|
|
if (item == null)
|
|
|
|
{
|
|
|
|
throw new Exception($"配置找不到,配置表名: {nameof (WorldTreeConfig)},配置id: {id}");
|
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Contain(int id)
|
|
|
|
{
|
|
|
|
return this.dict.ContainsKey(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Dictionary<int, WorldTreeConfig> GetAll()
|
|
|
|
{
|
|
|
|
return this.dict;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<WorldTreeConfig> GetList()
|
|
|
|
{
|
|
|
|
return this.list;
|
|
|
|
}
|
|
|
|
|
|
|
|
public WorldTreeConfig GetOne()
|
|
|
|
{
|
|
|
|
if (this.dict == null || this.dict.Count <= 0)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return this.dict.Values.GetEnumerator().Current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[ProtoContract]
|
|
|
|
public partial class WorldTreeConfig: ProtoObject, IConfig
|
|
|
|
{
|
|
|
|
/// <summary>编号</summary>
|
|
|
|
[ProtoMember(1)]
|
|
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>繁茂值</summary>
|
|
|
|
[ProtoMember(2)]
|
|
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>露水量</summary>
|
|
|
|
[ProtoMember(3)]
|
|
|
|
public int DewAccount { get; set; }
|
|
|
|
/// <summary>奖励组</summary>
|
|
|
|
[ProtoMember(4)]
|
|
|
|
public int[] RewardGroup { get; set; }
|
|
|
|
/// <summary>关联事件</summary>
|
|
|
|
[ProtoMember(5)]
|
|
|
|
public int[] EventGroup { get; set; }
|
|
|
|
/// <summary>树图片</summary>
|
|
|
|
[ProtoMember(6)]
|
|
|
|
public string TreePicture { get; set; }
|
|
|
|
/// <summary>预置文件</summary>
|
|
|
|
[ProtoMember(7)]
|
|
|
|
public string Prefab { get; set; }
|
|
|
|
/// <summary>详情描述</summary>
|
|
|
|
[ProtoMember(8)]
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|