You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace PVSkill
|
||
|
{
|
||
|
public class (ConfigName)Category : IConfigCategory
|
||
|
{
|
||
|
public static (ConfigName)Category Instance;
|
||
|
public List<(ConfigName)> list = new List<(ConfigName)>();
|
||
|
private Dictionary<int, (ConfigName)> dict = new Dictionary<int, (ConfigName)>();
|
||
|
|
||
|
public (ConfigName)Category()
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
|
||
|
public void Init()
|
||
|
{
|
||
|
foreach ((ConfigName) config in list)
|
||
|
{
|
||
|
this.dict.Add(config.Id, config);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public (ConfigName) Get(int id)
|
||
|
{
|
||
|
this.dict.TryGetValue(id, out (ConfigName) item);
|
||
|
|
||
|
if (item == null)
|
||
|
{
|
||
|
throw new Exception($"配置找不到,配置表名: {nameof ((ConfigName))},配置id: {id}");
|
||
|
}
|
||
|
|
||
|
return item;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public class (ConfigName)
|
||
|
{
|
||
|
public int Id
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return _id;
|
||
|
}
|
||
|
}
|
||
|
(Fields)
|
||
|
}
|
||
|
}
|