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

@@ -0,0 +1,63 @@
import { _decorator, Node, Button } from 'cc';
import { BaseView } from 'db://assets/scripts/core/BaseView';
import { ViewManager } from 'db://assets/scripts/core/ViewManager';
const { ccclass, property } = _decorator;
/**
* 写关卡/分享页面组件
* 用于展示用户已通关的关卡列表,选择关卡进行分享
*/
@ccclass('PageWriteLevels')
export class PageWriteLevels extends BaseView {
@property({ type: Node, tooltip: '返回按钮' })
backBtn: Node | null = null;
/**
* 页面首次加载时调用
*/
onViewLoad(): void {
console.log('[PageWriteLevels] onViewLoad');
this._initButtons();
}
/**
* 初始化按钮事件
*/
private _initButtons(): void {
if (this.backBtn) {
this.backBtn.on(Button.EventType.CLICK, this._onBackClick, this);
}
}
/**
* 返回按钮点击回调
*/
private _onBackClick(): void {
console.log('[PageWriteLevels] 返回按钮点击');
ViewManager.instance.back();
}
/**
* 页面每次显示时调用
*/
onViewShow(): void {
console.log('[PageWriteLevels] onViewShow');
}
/**
* 页面隐藏时调用
*/
onViewHide(): void {
console.log('[PageWriteLevels] onViewHide');
}
/**
* 页面销毁时调用
*/
onViewDestroy(): void {
console.log('[PageWriteLevels] onViewDestroy');
if (this.backBtn) {
this.backBtn.off(Button.EventType.CLICK, this._onBackClick, this);
}
}
}