提交示例代码

This commit is contained in:
Bob.Song
2026-03-05 11:39:06 +08:00
commit 25958f58c3
2534 changed files with 209593 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
namespace Fantasy;
public static class BagComponentSystem
{
public static uint AddItem(this BagComponent self, Item item)
{
self.Items.Add(item.Id, item);
Log.Debug($"add item:{item.Id}");
return 0;
}
public static bool TryGetItem(this BagComponent self, long itemId, out Item item)
{
return self.Items.TryGetValue(itemId, out item);
}
}

View File

@@ -0,0 +1,58 @@
// using Fantasy.Entitas.Interface;
//
// namespace Fantasy;
//
// public sealed class ItemUseComponentDestroySystem : DestroySystem<ItemUseComponent>
// {
// 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;
// }
// }