// using Fantasy.Entitas.Interface; // // namespace Fantasy; // // public sealed class ItemUseComponentDestroySystem : DestroySystem // { // protected override void Destroy(ItemUseComponent self) // { // self.Dispose(); // self.Handlers.Clear(); // } // } // // public static class ItemUseComponentSystem // { // public static void Init(this ItemUseComponent self) // { // self.Handlers.Add((int)ItemType.Drug, new ItemUse_Drug()); // self.Handlers.Add((int)ItemType.Equip , new ItemUse_Equip()); // } // // public static uint CanUse(this ItemUseComponent self, Account account, ItemConfig config, ref int count) // { // if (!self.Handlers.TryGetValue((int)config.Type, out var handler)) // { // return 0; // } // // return handler.CanUse(account, config, ref count); // } // // public static void Use(this ItemUseComponent self, Account account, ItemConfig config, ref int count) // { // if (!self.Handlers.TryGetValue((int)config.Type, out var handler)) // { // return; // } // // handler.Use(account, config, ref count); // } // // public static uint UseHandler(this ItemUseComponent self, Account account, ItemConfig config, ref int count) // { // if (!self.Handlers.TryGetValue((int)config.Type, out var handler)) // { // return 0; // } // // var canUse = handler.CanUse(account, config, ref count); // if (canUse != 0) // { // return canUse; // } // // handler.CanUse(account, config, ref count); // return 0; // } // }