mirror of
http://junepve.top:3000/chicrobot/CINC.git
synced 2026-10-30 07:41:29 +08:00
feat(inventory) 添加网格背包系统
This commit is contained in:
1 parent
b9a5180293
commit
ae26209a24
8 files changed
+1857
-43
No files matched your search
+25
-26
@@ -1,5 +1,8 @@
|
||||
// 物品管理器:负责加载、管理和创建物品
|
||||
|
||||
// 静态导入Item类
|
||||
import Item from './Item.js';
|
||||
|
||||
export class ItemManager {
|
||||
constructor(scene) {
|
||||
this.scene = scene;
|
||||
@@ -198,20 +201,18 @@ export class ItemManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 动态导入Item类
|
||||
import('./Item.js').then(({ default: Item }) => {
|
||||
const item = new Item(this.scene, x, y, itemData);
|
||||
|
||||
// 将物品添加到活动物品集合中
|
||||
this.activeItems.add(item);
|
||||
|
||||
// 监听物品销毁事件,从集合中移除
|
||||
item.on('destroy', () => {
|
||||
this.activeItems.delete(item);
|
||||
});
|
||||
|
||||
return item;
|
||||
// 使用静态导入的Item类创建物品
|
||||
const item = new Item(this.scene, x, y, itemData);
|
||||
|
||||
// 将物品添加到活动物品集合中
|
||||
this.activeItems.add(item);
|
||||
|
||||
// 监听物品销毁事件,从集合中移除
|
||||
item.on('destroy', () => {
|
||||
this.activeItems.delete(item);
|
||||
});
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,20 +255,18 @@ export class ItemManager {
|
||||
// 随机选择一个该类型的物品
|
||||
const randomItemData = typeItems[Math.floor(Math.random() * typeItems.length)];
|
||||
|
||||
// 动态导入Item类
|
||||
import('./Item.js').then(({ default: Item }) => {
|
||||
const item = new Item(this.scene, x, y, randomItemData);
|
||||
|
||||
// 将物品添加到活动物品集合中
|
||||
this.activeItems.add(item);
|
||||
|
||||
// 监听物品销毁事件,从集合中移除
|
||||
item.on('destroy', () => {
|
||||
this.activeItems.delete(item);
|
||||
});
|
||||
|
||||
return item;
|
||||
// 使用静态导入的Item类创建物品
|
||||
const item = new Item(this.scene, x, y, randomItemData);
|
||||
|
||||
// 将物品添加到活动物品集合中
|
||||
this.activeItems.add(item);
|
||||
|
||||
// 监听物品销毁事件,从集合中移除
|
||||
item.on('destroy', () => {
|
||||
this.activeItems.delete(item);
|
||||
});
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user