gamelet-pixui-frame
Version:
pixui开发者框架
67 lines • 3.42 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GameletAPI = void 0;
var igameletapi_1 = require("./framework/interfaces/igameletapi");
var uegameletapi_1 = require("./framework/impl/uesdkimpl/uegameletapi");
var pxidegameletapi_1 = require("./framework/impl/pxideimpl/pxidegameletapi");
var gameletapi_1 = require("./framework/gameletapi");
var utilities_1 = require("./framework/utilities/utilities");
var getcookiedjc_1 = require("./getcookiedjc/getcookiedjc");
// re-export 类型和工具,保持与默认入口一致的类型体验
__exportStar(require("./framework/gameletapi"), exports);
__exportStar(require("./thirdparty/thirdparyt"), exports);
__exportStar(require("./getcookiedjc/getcookiedjc"), exports);
__exportStar(require("./pluginsForActivityCenter/pluginsForActivityCenter"), exports);
function createUEGameletAPI() {
if (window.navigator.userAgent.search('PixUI') < 0) {
throw new Error('[gamelet-pixui-frame/ue] 当前运行环境不是 PixUI,无法使用 ue 子入口。' +
"\u5B9E\u6D4B userAgent: ".concat(window.navigator.userAgent, "\u3002") +
"请改用 'gamelet-pixui-frame' 默认入口,或检查打包配置是否引错子入口。");
}
// pxIDE 使用 pxExtConfig
if (globalThis.pxExtConfig) {
var pxExtConfig = JSON.parse(globalThis.pxExtConfig);
globalThis._sdk_info = pxExtConfig['_sdk_info'];
}
// @ts-ignore 西米哥要求置空创建 crash 的接口
external.crash = undefined;
var sdkInfo = (0, utilities_1.getQueryParam)("_sdk_info") || globalThis._sdk_info;
var impl;
var sdkType;
if (sdkInfo == "openplatform_pxide") {
// PxIDE 开发态
impl = pxidegameletapi_1.PxIDEGameletAPI.getInstance();
sdkType = igameletapi_1.RuntimeSDK.PXIDE_SDK;
console.log("[GameletAPI ue] 运行环境: PxIDE");
}
else if (sdkInfo == "openplatform_ue") {
// 真实 UE 运行态
impl = uegameletapi_1.UEGameletAPI.getInstance();
sdkType = igameletapi_1.RuntimeSDK.UE_SDK;
console.log("[GameletAPI ue] 运行环境: PandoraUE_SDK");
}
else {
throw new Error('[gamelet-pixui-frame/ue] 子入口与运行环境不匹配。' +
"\u671F\u671B: UE \u6216 PxIDE; \u5B9E\u6D4B _sdk_info=".concat(sdkInfo, "; ") +
"请改用 'gamelet-pixui-frame' 默认入口,或检查打包配置是否引错子入口。");
}
return new gameletapi_1.GameletAPIImpl(impl, sdkType);
}
exports.GameletAPI = createUEGameletAPI();
// 把刚创建的 GameletAPI 实例注入到 GetCookieDJC,避免循环依赖
(0, getcookiedjc_1.setGameletAPI)(exports.GameletAPI);
//# sourceMappingURL=ue.js.map