feat: 支持 toast

This commit is contained in:
richarjiang
2026-03-16 21:04:38 +08:00
parent b05ef71368
commit 45bb6b35ae
13 changed files with 933 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { _decorator, Component, Prefab } from 'cc';
import { ViewManager } from './scripts/core/ViewManager';
import { ToastManager } from './scripts/utils/ToastManager';
const { ccclass, property } = _decorator;
/**
@@ -14,6 +15,9 @@ export class main extends Component {
@property({ type: Prefab, tooltip: '关卡页面预制体' })
pageLevelPrefab: Prefab | null = null;
@property({ type: Prefab, tooltip: 'Toast 预制体' })
toastPrefab: Prefab | null = null;
/**
* onLoad 比 start 更早执行
* 确保 ViewManager 在 PageLoading.start() 之前初始化
@@ -45,5 +49,10 @@ export class main extends Component {
zIndex: 1
});
}
// 初始化 Toast 管理器
if (this.toastPrefab) {
ToastManager.instance.init(this.toastPrefab, this.node);
}
}
}