74 lines
2.8 KiB
TypeScript
74 lines
2.8 KiB
TypeScript
import { _decorator, Node } from "cc";
|
|||
|
|
import ResManager from "../Main/Manager/ResManager";
|
||
|
|
import GameRootUI from "../Main/Common/GameRootUI";
|
||
|
|
import { CommonConfig } from "../Main/Config/CommonConfig";
|
||
|
|
import { promptItem } from "./Item/promptItem";
|
||
|
|
import { ConfirmDialog } from "./Item/ConfirmDialog";
|
||
|
|
import { CommAdDialog } from "./Item/CommAdDialog";
|
||
|
|
import Utils from "../Main/Common/Utils";
|
||
|
|
import { InnerMsgCode } from "../Main/Config/InnerMsgCode";
|
||
|
|
|
||
|
|
const { ccclass, property } = _decorator;
|
||
|
|
|
||
|
|
//项目管理器
|
||
|
|
@ccclass('SubManager')
|
||
|
|
export default class SubManager {
|
||
|
|
|
||
|
|
private static _I: SubManager = null;
|
||
|
|
public static get I(): SubManager {
|
||
|
|
if (!SubManager._I) {
|
||
|
|
SubManager._I = new SubManager();
|
||
|
|
SubManager._I.init();
|
||
|
|
}
|
||
|
|
return SubManager._I;
|
||
|
|
}
|
||
|
|
|
||
|
|
private init(){
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//飘字提示----------------------------------------------------------------------------
|
||
|
|
public static ShowPrompt(text: string) {
|
||
|
|
if (!GameRootUI.I) {
|
||
|
|
console.warn("GameRootUI还未初始化", text);
|
||
|
|
Utils.sendInnerMsg(InnerMsgCode.UI_ShowPrompt, {text: text});
|
||
|
|
return
|
||
|
|
}
|
||
|
|
ResManager.I.loadSubpackagePrefab("item/promptItem", (n_node: Node)=>{
|
||
|
|
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
|
||
|
|
let pItem = n_node.getComponent(promptItem)
|
||
|
|
pItem.setLabel(text)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//显示确定框----------------------------------------------------------------------------
|
||
|
|
/**通用确认框 { content: string, strYes?: string, strNo?: string, yesCallback?: Function, noCallback?: Function, closeCallback?: Function } */
|
||
|
|
public static ShowConfirm(param:any) {
|
||
|
|
if (!GameRootUI.I) {
|
||
|
|
console.warn("GameRootUI还未初始化", param);
|
||
|
|
return
|
||
|
|
}
|
||
|
|
ResManager.I.loadSubpackagePrefab("item/ConfirmDialog", (n_node: Node)=>{
|
||
|
|
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
|
||
|
|
let pItem = n_node.getComponent(ConfirmDialog)
|
||
|
|
pItem.setParam(param)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//显示通用广告框----------------------------------------------------------------------------
|
||
|
|
/**通用广告框 { content: string, strAd?: string, strLeft?: string, adCallback?: Function, leftCallback?: Function, closeCallback?: Function } */
|
||
|
|
public static ShowCommonAdDialog(param:any) {
|
||
|
|
if (!GameRootUI.I) {
|
||
|
|
console.warn("GameRootUI还未初始化", param);
|
||
|
|
return
|
||
|
|
}
|
||
|
|
ResManager.I.loadSubpackagePrefab("item/CommAdDialog", (n_node: Node)=>{
|
||
|
|
GameRootUI.I.AddUIToLayer(n_node, CommonConfig.UILayerGroup.Layer_tips)
|
||
|
|
let pItem = n_node.getComponent(CommAdDialog)
|
||
|
|
pItem.setParam(param)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|