|
|
|
|
|
|
|
|
|
import { SoundManager as Sound } from "../../mx/module/audio/SoundManager";
|
|
|
|
|
import { Singleton } from "../../mx/tools/Singleton";
|
|
|
|
|
import { SDKManager as SDK } from "../sdk/SDKManager";
|
|
|
|
|
import { GameData as Data } from "./GameData";
|
|
|
|
|
import { GameController as Game, GameController } from "db://assets/script/game/GameController";
|
|
|
|
|
import { UIManager as UI } from "../../mx/module/ui/UIManager";
|
|
|
|
|
import { ChatManager as Chat } from "../../mx/module/chat/ChatManager";
|
|
|
|
|
import { Lang } from "../../mx/module/lang/Lang";
|
|
|
|
|
import { Activity } from "../activity/Activity";
|
|
|
|
|
import { TimeModule } from "../../mx/module/time/TimeModule";
|
|
|
|
|
import { ResourcesManager } from "../../mx/module/res/ResourcesManager";
|
|
|
|
|
import { AssetService } from "../../mx/module/res/AssetService";
|
|
|
|
|
import { RedDot } from "../../mx/module/redDot/RedDot";
|
|
|
|
|
import { AttributeInterface } from "../interface/AttributeInterface";
|
|
|
|
|
import { BattleService } from "../battle/BattleService";
|
|
|
|
|
import type { IBattleService } from "../battle/IBattleService";
|
|
|
|
|
import { EquipDataManager } from "../manager/EquipDataManager";
|
|
|
|
|
import { GemDataManager } from "../manager/GemDataManager";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 游戏全局模块入口
|
|
|
|
|
*/
|
|
|
|
|
export class GameGlobal extends Singleton {
|
|
|
|
|
/**UI模块 */
|
|
|
|
|
get ui() { return UI.Ins; }
|
|
|
|
|
/**音频模块 */
|
|
|
|
|
get audio() { return Sound.Ins; }
|
|
|
|
|
/**资源模块 */
|
|
|
|
|
get res() { return ResourcesManager.getInstance(); }
|
|
|
|
|
/**统一资源门面(按需晋升 + 调度) */
|
|
|
|
|
get assets() { return AssetService.getInstance(); }
|
|
|
|
|
/**游戏数据 */
|
|
|
|
|
get data() { return Data.getInstance(); }
|
|
|
|
|
/**sdk模块 */
|
|
|
|
|
get sdk() { return SDK.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/**聊天模块 */
|
|
|
|
|
get chat() { return Chat.instance; }
|
|
|
|
|
|
|
|
|
|
get game() { return GameController.instance; }
|
|
|
|
|
set game(value: GameController) { GameController.instance = value; }
|
|
|
|
|
|
|
|
|
|
/**多语言模块 */
|
|
|
|
|
get lang() { return Lang.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/**活动模块 */
|
|
|
|
|
get activity() { return Activity.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/**时间模块 */
|
|
|
|
|
get time() { return TimeModule.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/**红点模块 */
|
|
|
|
|
get dot() { return RedDot.getInstance(); }
|
|
|
|
|
/**属性接口模块 */
|
|
|
|
|
get attrInterface() { return AttributeInterface.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/**战斗模块 */
|
|
|
|
|
private readonly _battle: IBattleService = new BattleService();
|
|
|
|
|
get battle() { return this._battle; }
|
|
|
|
|
|
|
|
|
|
/** 名将库装备(HaveEquip / HeroEquip) */
|
|
|
|
|
get equip() { return EquipDataManager.getInstance(); }
|
|
|
|
|
|
|
|
|
|
/** 宝石镶嵌与合成 */
|
|
|
|
|
get gem() { return GemDataManager.getInstance(); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建全局gg对象并初始化为GameGlobal的实例
|
|
|
|
|
*/
|
|
|
|
|
(globalThis as any).gg = GameGlobal.getInstance();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 全局定义
|
|
|
|
|
*/
|
|
|
|
|
declare global {
|
|
|
|
|
/**游戏全局单例模块 */
|
|
|
|
|
const gg: GameGlobal;
|
|
|
|
|
}
|