import Config from "../../../Config"; import { GuideType, InGame, OpenType } from "../../../data/const/TypeConst"; import { ViewLayer } from "../../../data/const/ViewLayer"; import { ViewZorder } from "../../../data/const/ViewZOrder"; import FguiMgr from "../../../frameWork/fgui/FguiMgr"; import AssetMgr from "../../../utils/AssetMgr"; import { HomeView } from "../../fgui/Home/Home/HomeView"; const { ccclass, menu, property } = cc._decorator; @ccclass @menu("UI/scene/UIGame") export default class UIGame extends cc.Component { @property(cc.Prefab) uiHand: cc.Prefab = null @property(cc.Prefab) uiMask: cc.Prefab = null @property(cc.Prefab) netMask: cc.Prefab = null @property(cc.Prefab) guideView: cc.Prefab = null @property(cc.Prefab) handMaskView: cc.Prefab = null @property(cc.Prefab) dialogView: cc.Prefab = null @property(cc.Prefab) mapPrefab: cc.Prefab = null @property(cc.Node) mapLayer: cc.Node = null // @property(cc.Prefab) uiMapGuideSkip: cc.Prefab = null @property(cc.Prefab) safeAreaNode: cc.Prefab = null public static Instance: UIGame; protected async onLoad(): Promise { //初始化fgui FguiMgr.Instance.Init(); Config.inGame = InGame.home UIGame.Instance = this; } protected onEnable(): void { } protected onDisable(): void { } protected start(): void { //清空已经打开的fgui界面 FguiMgr.Instance.clearCacheMap() // 网络遮罩层 AssetMgr.instantiate(cc.director.getScene(), this.safeAreaNode); // AssetMgr.instantiate(cc.director.getScene(), this.uiHand) AssetMgr.instantiate(cc.director.getScene(), this.guideView) AssetMgr.instantiate(cc.director.getScene(), this.handMaskView) // AssetMgr.instantiate(cc.director.getScene(), this.dialogView) AssetMgr.instantiate(cc.director.getScene(), this.uiMask) AssetMgr.instantiate(cc.director.getScene(), this.netMask) this.EnterGame(); } async EnterGame(closeFunc?: Function) { // 进入游戏 FguiMgr.Instance.openUI(HomeView, ViewLayer.Home) } //fgui相关 protected onDestroy(): void { FguiMgr.Instance.Dispose() } protected update(dt: number): void { FguiMgr.Instance.OnUpdate(dt) } protected lateUpdate(dt: number): void { FguiMgr.Instance.OnLateUpdate(dt) } }