UpLevelExp.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections.Generic;
  3. using MongoDB.Bson.Serialization.Attributes;
  4. using ProtoBuf;
  5. namespace ET
  6. {
  7. [ProtoContract]
  8. [Config]
  9. public partial class UpLevelExpCategory : ConfigSingleton<UpLevelExpCategory>, IMerge
  10. {
  11. [ProtoIgnore]
  12. [BsonIgnore]
  13. private Dictionary<int, UpLevelExp> dict = new Dictionary<int, UpLevelExp>();
  14. [BsonElement]
  15. [ProtoMember(1)]
  16. private List<UpLevelExp> list = new List<UpLevelExp>();
  17. public void Merge(object o)
  18. {
  19. UpLevelExpCategory s = o as UpLevelExpCategory;
  20. this.list.AddRange(s.list);
  21. }
  22. [ProtoAfterDeserialization]
  23. public void ProtoEndInit()
  24. {
  25. foreach (UpLevelExp config in list)
  26. {
  27. config.AfterEndInit();
  28. this.dict.Add(config.Id, config);
  29. }
  30. this.list.Clear();
  31. this.AfterEndInit();
  32. }
  33. public UpLevelExp Get(int id)
  34. {
  35. this.dict.TryGetValue(id, out UpLevelExp item);
  36. if (item == null)
  37. {
  38. throw new Exception($"配置找不到,配置表名: {nameof (UpLevelExp)},配置id: {id}");
  39. }
  40. return item;
  41. }
  42. public bool Contain(int id)
  43. {
  44. return this.dict.ContainsKey(id);
  45. }
  46. public Dictionary<int, UpLevelExp> GetAll()
  47. {
  48. return this.dict;
  49. }
  50. public UpLevelExp GetOne()
  51. {
  52. if (this.dict == null || this.dict.Count <= 0)
  53. {
  54. return null;
  55. }
  56. return this.dict.Values.GetEnumerator().Current;
  57. }
  58. }
  59. [ProtoContract]
  60. public partial class UpLevelExp: ProtoObject, IConfig
  61. {
  62. /// <summary>Id</summary>
  63. [ProtoMember(1)]
  64. public int Id { get; set; }
  65. /// <summary>境界编号</summary>
  66. [ProtoMember(2)]
  67. public int ClassID { get; set; }
  68. /// <summary>境界名称</summary>
  69. [ProtoMember(3)]
  70. public string ClassName { get; set; }
  71. /// <summary>是否开启</summary>
  72. [ProtoMember(4)]
  73. public int isValid { get; set; }
  74. /// <summary>境界阶数</summary>
  75. [ProtoMember(5)]
  76. public int ClassUPLevel { get; set; }
  77. /// <summary>阶数名称</summary>
  78. [ProtoMember(6)]
  79. public string UPName { get; set; }
  80. /// <summary>成色</summary>
  81. [ProtoMember(7)]
  82. public int Qcolor { get; set; }
  83. /// <summary>提升境界所需人物等级</summary>
  84. [ProtoMember(8)]
  85. public int ReqLevel { get; set; }
  86. /// <summary>进阶需要完成事件</summary>
  87. [ProtoMember(9)]
  88. public string ReqEvents { get; set; }
  89. /// <summary>进阶所需修为</summary>
  90. [ProtoMember(10)]
  91. public int ReqClassExp { get; set; }
  92. /// <summary>属性1</summary>
  93. [ProtoMember(11)]
  94. public string Prop1 { get; set; }
  95. /// <summary>参数1</summary>
  96. [ProtoMember(12)]
  97. public int Par1 { get; set; }
  98. /// <summary>最小值1</summary>
  99. [ProtoMember(13)]
  100. public int Min1 { get; set; }
  101. /// <summary>最大值1</summary>
  102. [ProtoMember(14)]
  103. public int Max1 { get; set; }
  104. /// <summary>属性2</summary>
  105. [ProtoMember(15)]
  106. public string Prop2 { get; set; }
  107. /// <summary>参数2</summary>
  108. [ProtoMember(16)]
  109. public int Par2 { get; set; }
  110. /// <summary>最小值2</summary>
  111. [ProtoMember(17)]
  112. public int Min2 { get; set; }
  113. /// <summary>最大值2</summary>
  114. [ProtoMember(18)]
  115. public int Max2 { get; set; }
  116. /// <summary>属性3</summary>
  117. [ProtoMember(19)]
  118. public string Prop3 { get; set; }
  119. /// <summary>参数3</summary>
  120. [ProtoMember(20)]
  121. public int Par3 { get; set; }
  122. /// <summary>最小值3</summary>
  123. [ProtoMember(21)]
  124. public int Min3 { get; set; }
  125. /// <summary>最大值3</summary>
  126. [ProtoMember(22)]
  127. public int Max3 { get; set; }
  128. /// <summary>属性4</summary>
  129. [ProtoMember(23)]
  130. public string Prop4 { get; set; }
  131. /// <summary>参数4</summary>
  132. [ProtoMember(24)]
  133. public int Par4 { get; set; }
  134. /// <summary>最小值4</summary>
  135. [ProtoMember(25)]
  136. public int Min4 { get; set; }
  137. /// <summary>最大值4</summary>
  138. [ProtoMember(26)]
  139. public int Max4 { get; set; }
  140. /// <summary>属性5</summary>
  141. [ProtoMember(27)]
  142. public string Prop5 { get; set; }
  143. /// <summary>参数5</summary>
  144. [ProtoMember(28)]
  145. public int Par5 { get; set; }
  146. /// <summary>最小值5</summary>
  147. [ProtoMember(29)]
  148. public int Min5 { get; set; }
  149. /// <summary>最大值5</summary>
  150. [ProtoMember(30)]
  151. public int Max5 { get; set; }
  152. }
  153. }