feat(inventory) 添加网格背包系统

This commit is contained in:
chicrobot committed 2026-01-04 21:32:31 +08:00
1 parent b9a5180293
commit ae26209a24
8 files changed
+1857 -43

No files matched your search

+8 -5
View File
@@ -14,6 +14,8 @@ import MovementTestScene5 from './scenes/MovementTestScene5.js';
import MovementTestScene6 from './scenes/MovementTestScene6.js';
// 导入物品系统测试场景
import ItemTestScene from './scenes/ItemTestScene.js';
// 导入背包系统测试场景
import InventoryTestScene from './scenes/InventoryTestScene.js';
// 创建游戏的最终配置对象
const config = {
@@ -30,7 +32,8 @@ const config = {
MovementTestScene4,
MovementTestScene5,
MovementTestScene6,
ItemTestScene
ItemTestScene,
InventoryTestScene
]
};
@@ -39,10 +42,10 @@ const config = {
window.game = new Phaser.Game(config);
// 添加一个函数,用于从控制台切换到测试场景
window.startMovementTest = function(sceneIndex = 1) {
const sceneKey = `MovementTestScene${sceneIndex}`;
if (window.game.scene.getIndex(sceneKey) !== -1) {
window.game.scene.start(sceneKey);
window.startTest = function(sceneIndex = 1) {
const scenes = window.game.scene.scenes;
if (sceneIndex >= 0 && sceneIndex < scenes.length) {
window.game.scene.start(scenes[sceneIndex]);
console.log(`已切换到测试场景${sceneIndex}`);
} else {
console.error(`测试场景${sceneIndex}不存在`);