fix(scenes) 种田系统测试,添加按钮等

This commit is contained in:
wvellichor committed 2026-01-10 05:31:51 +08:00
1 parent ce4e04740a
commit 761a9338ba
19 files changed
+1248 -86

No files matched your search

+21
View File
@@ -213,6 +213,21 @@ export default class ResourceTestScene extends Phaser.Scene {
this.nextButtonText.setScrollFactor(0, 0);
this.nextButtonText.setDepth(11);
// 返回菜单按钮
this.returnButton = this.add.rectangle(270, 100, 120, 40, 0x333333);
this.returnButton.setOrigin(0, 0);
this.returnButton.setScrollFactor(0, 0);
this.returnButton.setDepth(10);
this.returnButton.setInteractive({ useHandCursor: true });
this.returnButtonText = this.add.text(280, 110, '返回菜单', {
fontSize: '16px',
fill: '#ffffff',
fontFamily: 'Arial'
});
this.returnButtonText.setScrollFactor(0, 0);
this.returnButtonText.setDepth(11);
// 按钮事件
this.prevButton.on('pointerdown', () => {
this.currentCategory = (this.currentCategory - 1 + this.resourceCategories.length) % this.resourceCategories.length;
@@ -224,11 +239,17 @@ export default class ResourceTestScene extends Phaser.Scene {
this.updateCategoryDisplay();
});
this.returnButton.on('pointerdown', () => {
this.scene.start('BootScene');
});
// 悬停效果
this.prevButton.on('pointerover', () => this.prevButton.setFillStyle(0x555555));
this.prevButton.on('pointerout', () => this.prevButton.setFillStyle(0x333333));
this.nextButton.on('pointerover', () => this.nextButton.setFillStyle(0x555555));
this.nextButton.on('pointerout', () => this.nextButton.setFillStyle(0x333333));
this.returnButton.on('pointerover', () => this.returnButton.setFillStyle(0x555555));
this.returnButton.on('pointerout', () => this.returnButton.setFillStyle(0x333333));
}
/**