加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
SGame.ts 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
Seven 提交于 2024-07-31 18:20 . 对话框支持对象传参
import { Node } from "cc";
import Config, { config_get } from "./config/Config";
import Cryptor from "./encrypt/Cryptor";
import { Extension } from "./extension/Extension";
import Http from "./http/Http";
import LocalData from "./localData/LocalData";
import Logger, { LOG_LEVEL } from "./logger/Logger";
import { director } from "cc";
import { AudioManager } from "./audio/AudioManager";
Extension.Init();
export class SGame {
private static _inited: boolean = false;
public static get HasInited(): boolean {
return this._inited;
}
public static Init(config: object) {
if (this._inited) {
return;
}
this._inited = true;
let node = new Node("SGameManager");
node.addComponent(AudioManager);
director.addPersistRootNode(node);
Config.Init(config);
Logger.Init(config_get("logger.enable", true), config_get("logger.level", LOG_LEVEL.LOG));
Cryptor.Init(config_get("cryptor.key", ""), config_get("cryptor.iv", ""));
LocalData.Init(config_get("localData.enable", true), config_get("localData.key"), config_get("localData.iv"));
let httpConfig = (key: string, defaultVal: any = undefined) => {
return config_get("http." + key, defaultVal);
}
Http.Init(
httpConfig("timeout", 10000),
httpConfig("headers"),
httpConfig("responseType", "json"),
httpConfig("postContentType", "application/json")
);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化