feat: 添加页面管理系统和首页/关卡页面

- 实现 ViewManager 单例页面管理器,支持页面注册、打开、关闭、缓存
- 实现 BaseView 页面基类,提供统一的页面生命周期
- 添加 PageHome 首页,包含开始游戏按钮跳转功能
- 添加 PageLevel 关卡页面,继承 BaseView
- 更新 PageLoading 支持进度条显示和页面预加载
- 添加相关图片资源和预制体

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
richarjiang
2026-03-11 10:02:29 +08:00
parent 02a67909d6
commit 8986d8d8f2
29 changed files with 5456 additions and 61 deletions

View File

@@ -1,14 +1,40 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
import { _decorator, Component } from 'cc';
import { ViewManager } from './scripts/core/ViewManager';
const { ccclass } = _decorator;
/**
* 主入口脚本
* 负责初始化 ViewManager 并注册页面
*/
@ccclass('main')
export class main extends Component {
start() {
/**
* onLoad 比 start 更早执行
* 确保 ViewManager 在 PageLoading.start() 之前初始化
*/
onLoad() {
this._initViewManager();
}
update(deltaTime: number) {
/**
* 初始化页面管理器
*/
private _initViewManager(): void {
// 初始化 ViewManager绑定 Canvas 作为页面容器
ViewManager.instance.init(this.node);
// 注册页面配置
ViewManager.instance.register('PageHome', {
prefabPath: 'prefabs/PageHome',
cache: true,
zIndex: 0
});
// 注册关卡页面
ViewManager.instance.register('PageLevel', {
prefabPath: 'prefabs/PageLevel',
cache: true,
zIndex: 1
});
}
}