using System.Collections.Generic; using ColdMint.scripts.utils; using Godot; namespace ColdMint.scripts.loot; /// /// LootListManager /// 战利品表管理器 /// public static class LootListManager { private static Dictionary LootListDictionary { get; } = []; /// /// Register loot table /// 注册战利品表 /// /// public static bool RegisterLootList(LootList lootList) { var id = lootList.Id; if (id is "") return false; return LootListDictionary.TryAdd(id, lootList); } /// /// Remove loot list /// 移除战利品表 /// /// /// public static bool UnregisterLootList(string id) { return LootListDictionary.Remove(id); } /// /// Generate an loot data. /// 获取掉落物品 /// /// /// public static IEnumerable GenerateLootData(string id) { if (!LootListDictionary.TryGetValue(id, out var list)) return []; return list.GenerateLootData(); } }