using System.Collections.Generic; using Fantasy; using NBC; namespace NBF { public struct ItemBindData { public ItemType Type; public bool Optional; public ItemBindData(ItemType type, bool optional = false) { Type = type; Optional = optional; } } public class ItemBindConfig { public ItemSubType SubType; public readonly List Binds = new List(); public ItemBindConfig(ItemSubType subType) { SubType = subType; } public void Add(ItemType type, bool optional = false) { Binds.Add(new ItemBindData(type, optional)); } } public static class ItemBindHelper { private static readonly Dictionary _bindConfigs = new Dictionary(); #region 初始化 static ItemBindHelper() { var rodTele = new ItemBindConfig(ItemSubType.RodTele); rodTele.Add(ItemType.Line); rodTele.Add(ItemType.Bobber); rodTele.Add(ItemType.Weight); rodTele.Add(ItemType.Hook); var rodBolo = new ItemBindConfig(ItemSubType.RodBolo); rodBolo.Add(ItemType.Line); rodBolo.Add(ItemType.Weight); rodBolo.Add(ItemType.Lure); var rodSpine = new ItemBindConfig(ItemSubType.RodSpine); rodSpine.Add(ItemType.Line); rodSpine.Add(ItemType.Weight); rodSpine.Add(ItemType.Lure); _bindConfigs.Add(rodTele.SubType, rodTele); } #endregion public static ItemBindConfig GetBindConfig(this ItemInfo itemInfo) { return _bindConfigs.GetValueOrDefault((ItemSubType)itemInfo.Config.Type); } // public List GetItemGearBindTypes() // { // var itemType = ItemType; // var subType = (ItemSubType)Config.Type; // List types = new List(); // if (itemType == ItemType.Rod) // { // if (subType == ItemSubType.RodTele) // { // types.Add(ItemType.Line); // types.Add(ItemType.Bobber); // types.Add(ItemType.Weight); // types.Add(ItemType.Hook); // } // else if (subType == ItemSubType.RodBolo) // { // types.Add(ItemType.Line); // types.Add(ItemType.Weight); // types.Add(ItemType.Lure); // } // else if (subType == ItemSubType.RodSpine) // { // types.Add(ItemType.Line); // types.Add(ItemType.Weight); // types.Add(ItemType.Lure); // } // } // else if (itemType == ItemType.Lure) // { // types.Add(ItemType.Hook); // types.Add(ItemType.Hook); // } // // return types; // } } }