perf: 支持跳转到分享页面

This commit is contained in:
richarjiang
2026-04-06 11:04:09 +08:00
parent b732e4d8f8
commit 261c4d6878
8 changed files with 4005 additions and 7 deletions

View File

@@ -13,6 +13,9 @@ export class PageHome extends BaseView {
@property({ type: Node, tooltip: '开始游戏按钮' })
startGameBtn: Node | null = null;
@property({ type: Node, tooltip: 'PK按钮' })
pkBtn: Node | null = null;
/**
* 页面首次加载时调用
*/
@@ -40,6 +43,9 @@ export class PageHome extends BaseView {
if (this.startGameBtn) {
this.startGameBtn.on(Button.EventType.CLICK, this._onStartGameClick, this);
}
if (this.pkBtn) {
this.pkBtn.on(Button.EventType.CLICK, this._onPkClick, this);
}
}
/**
@@ -50,6 +56,14 @@ export class PageHome extends BaseView {
ViewManager.instance.open('PageLevel');
}
/**
* PK按钮点击回调
*/
private _onPkClick(): void {
console.log('[PageHome] PK按钮点击');
ViewManager.instance.open('PageWriteLevels');
}
/**
* 页面每次显示时调用
*/
@@ -73,5 +87,8 @@ export class PageHome extends BaseView {
if (this.startGameBtn) {
this.startGameBtn.off(Button.EventType.CLICK, this._onStartGameClick, this);
}
if (this.pkBtn) {
this.pkBtn.off(Button.EventType.CLICK, this._onPkClick, this);
}
}
}