feat: 支持 toast
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user