mirror of
http://junepve.top:3000/chicrobot/CINC.git
synced 2026-10-30 07:41:29 +08:00
fix(scenes) 种田系统测试,添加按钮等
This commit is contained in:
1 parent
ce4e04740a
commit
761a9338ba
19 files changed
+1248
-86
No files matched your search
@@ -4,9 +4,9 @@ import { InputSystem } from '../../systems/InputSystem.js';
|
||||
import { SelectionSystem } from '../../systems/SelectionSystem.js';
|
||||
import { CommandSystem } from '../../systems/CommandSystem.js';
|
||||
|
||||
export default class MovementTestScene5 extends Phaser.Scene {
|
||||
export default class AutoMovementTestScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super({ key: 'MovementTestScene5' });
|
||||
super({ key: 'AutoMovementTestScene' });
|
||||
}
|
||||
|
||||
create() {
|
||||
@@ -108,6 +108,43 @@ export default class MovementTestScene5 extends Phaser.Scene {
|
||||
this.input.keyboard.on('keydown-SPACE', () => {
|
||||
this.scene.start('BootScene');
|
||||
});
|
||||
|
||||
// 添加返回菜单按钮
|
||||
this.createReturnButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建返回菜单按钮
|
||||
*/
|
||||
createReturnButton() {
|
||||
// 创建按钮背景
|
||||
const button = this.add.rectangle(10, 130, 150, 40, 0x333333);
|
||||
button.setOrigin(0, 0);
|
||||
button.setScrollFactor(0, 0);
|
||||
button.setDepth(10);
|
||||
button.setInteractive({ useHandCursor: true });
|
||||
|
||||
// 按钮文本
|
||||
const buttonText = this.add.text(25, 140, '返回菜单', {
|
||||
fontSize: '16px',
|
||||
fill: '#ffffff',
|
||||
fontFamily: 'Arial'
|
||||
});
|
||||
buttonText.setScrollFactor(0, 0);
|
||||
buttonText.setDepth(11);
|
||||
|
||||
// 按钮事件
|
||||
button.on('pointerdown', () => {
|
||||
this.scene.start('BootScene');
|
||||
});
|
||||
|
||||
button.on('pointerover', () => {
|
||||
button.setFillStyle(0x555555);
|
||||
});
|
||||
|
||||
button.on('pointerout', () => {
|
||||
button.setFillStyle(0x333333);
|
||||
});
|
||||
}
|
||||
|
||||
update() {
|
||||
|
||||
Reference in new issue
Block a user