Пример #1
0
        private static EncounterTable LoadOrGet(string name, int id)
        {
            EncounterTable e;

            if (!_loadedEncounterTables.ContainsKey(id))
            {
                e = new EncounterTable(name, id);
                _loadedEncounterTables.Add(id, new WeakReference <EncounterTable>(e));
                return(e);
            }
            WeakReference <EncounterTable> w = _loadedEncounterTables[id];

            if (w.TryGetTarget(out e))
            {
                return(e);
            }
            e = new EncounterTable(name, id);
            w.SetTarget(e);
            return(e);
        }
Пример #2
0
 public EncounterGroup(JToken j)
 {
     Type  = j[nameof(Type)].EnumValue <EncounterType>();
     Table = EncounterTable.LoadOrGet(j[nameof(Table)].Value <string>());
 }
Пример #3
0
 public EncounterGroup(EncounterType t, EncounterTable tbl)
 {
     Type  = t;
     Table = tbl;
 }