/** * 模式类型 */ export enum ModeType { Look = "Look",//查看模式 Edit = "Edit",//编辑模式 } /** * 模式管理器 */ export class ModeManager { /** * 当前模式的类型(在查看模式下,可编辑某些内容的权限) */ private static s_currentMode: ModeType = ModeType.Edit; /** * 调试模式 */ public static isDebug = true; /** * 是编辑人员(内部编辑人员,可新增单位、上传模型) */ public static isEditor = true; //#region 演示单单位 //未指定演示单位,正常打开 static readonly c_demoKey_null = null; // 上海国际会议中心 测试 static readonly c_demoKey_shanghai = "shanghai"; //测试 static readonly c_demoKey_test = "test"; /** * 演示单位的key */ public static institutionDemoKey = ModeManager.c_demoKey_null; //#endregion /** * 获取当前模式的类型 */ static get currentMode(): ModeType { return ModeManager.s_currentMode; } /** * 改变模式类型 */ static set currentMode(modeType: ModeType) { ModeManager.s_currentMode = modeType; ModeManager.log("currentMode" + modeType); } //封装打印 static log(data: any, ...optionalParams: any[]) { if (ModeManager.isDebug) { console.log(data, optionalParams); } } /** * 封装的打印堆栈 */ static trace(message?: any, ...optionalParams: any[]) { if (ModeManager.isDebug) { console.trace(message, optionalParams); } } }