/** * 全局导入 * 全局配置 * 工具 */ import * as Context from "./core/Context"; import * as define from "./data/Define"; import * as tools from "./utils/Utils"; import { HttpMgr } from "./core/mgrs/HttpMgr"; import Common from "./utils/Common"; import UIMgr from "./fgui/core/UIMgr"; import { SoundMgr } from "./core/mgrs/SoundMgr"; import { ResMgr } from "./core/mgrs/ResMgr"; import { eventMgr } from "./core/mgrs/EventMgr"; import { ConfigMgr } from "./core/mgrs/ConfigMgr"; import PoolD3Mgr from "./core/mgrs/PoolD3Mgr"; import UIMsg from "./ui/UIMsg"; let context = Context.context; let uiMgr = UIMgr.inst; let soundMgr = SoundMgr.getInstance(); let resMgr = ResMgr.getInstance(); let httpMgr = HttpMgr.getInstance(); let common = Common.getInstance(); let cfgMgr = ConfigMgr.getInstance(); let poolD3Mgr = PoolD3Mgr.ins; let d3TexUrl = "res/d3Res/"; let d3ModeUrl = "res/unityRes/"; /** * 适配舞台 */ function setStageSize(view: any) { if (view.width) { view.width = Laya.stage.width; view.height = Laya.stage.height; } } /** * 适配舞台背景 */ function filledBg(view: any) { let wh = Laya.stage.height / Laya.stage.width; if (wh > 16 / 9) { view.height = Laya.stage.height; view.width = Laya.stage.height / 1334 * 750; } else { view.width = Laya.stage.width; view.height = Laya.stage.width / 750 * 1334; } } /** * 适配刘海 */ function setNotch(view: any) { if (view.height) { view.y += context.notchHeight; } } function showTip(str: string) { uiMgr.Show(UIMsg, str); } function log(...args) { console.log(args); } export { define, } export let xGame = { context, eventMgr, resMgr, uiMgr, soundMgr, define, tools, httpMgr, d3TexUrl, d3ModeUrl, common, cfgMgr, poolD3Mgr, setStageSize, filledBg, setNotch, showTip, log, } window["xGame"] = xGame;