System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3"], function (_export, _context) { "use strict"; var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, director, Enum, Node, ch, loadType, ch_sdk_comp, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _dec33, _dec34, _dec35, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _crd, ccclass, property, pack, ch_start_pack; function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); } function _reportPossibleCrUseOfch(extras) { _reporterNs.report("ch", "../ch", _context.meta, extras); } function _reportPossibleCrUseOfloadType(extras) { _reporterNs.report("loadType", "../audio/audio", _context.meta, extras); } function _reportPossibleCrUseOfch_sdk_comp(extras) { _reporterNs.report("ch_sdk_comp", "./ch_sdk_comp", _context.meta, extras); } return { setters: [function (_unresolved_) { _reporterNs = _unresolved_; }, function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; _decorator = _cc._decorator; Component = _cc.Component; director = _cc.director; Enum = _cc.Enum; Node = _cc.Node; }, function (_unresolved_2) { ch = _unresolved_2.ch; }, function (_unresolved_3) { loadType = _unresolved_3.loadType; }, function (_unresolved_4) { ch_sdk_comp = _unresolved_4.ch_sdk_comp; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "4aa63NubuJJqLakcBFHXiHV", "ch_start_pack", undefined); __checkObsolete__(['_decorator', 'Component', 'director', 'Enum', 'Node']); ({ ccclass, property } = _decorator); /**包id*/ _export("pack", pack = /*#__PURE__*/function (pack) { pack[pack["id0"] = 0] = "id0"; pack[pack["id1"] = 1] = "id1"; pack[pack["id2"] = 2] = "id2"; pack[pack["id3"] = 3] = "id3"; pack[pack["id4"] = 4] = "id4"; pack[pack["id5"] = 5] = "id5"; pack[pack["id6"] = 6] = "id6"; pack[pack["id7"] = 7] = "id7"; pack[pack["id8"] = 8] = "id8"; pack[pack["id9"] = 9] = "id9"; return pack; }({})); _export("ch_start_pack", ch_start_pack = (_dec = ccclass('ch_start_pack'), _dec2 = property({ visible: false }), _dec3 = property({ visible: false }), _dec4 = property({ visible: false }), _dec5 = property({ visible: false }), _dec6 = property({ visible: false }), _dec7 = property({ visible: false }), _dec8 = property({ visible: false }), _dec9 = property({ visible: false }), _dec10 = property({ visible: false }), _dec11 = property({ visible: false }), _dec12 = property({ visible: false }), _dec13 = property({ visible: false }), _dec14 = property({ visible: false }), _dec15 = property({ visible: false }), _dec16 = property({ type: Enum(pack), displayName: '包id', group: { name: '选包', id: 'pack', displayOrder: 0 } }), _dec17 = property({ displayName: '游戏名', group: { name: '选包', id: 'pack', displayOrder: 0 } }), _dec18 = property({ displayName: '游戏id', group: { name: '选包', id: 'pack', displayOrder: 0 } }), _dec19 = property({ displayName: '是否单机', group: { name: 'ch.sdk模块', id: 'sdk', displayOrder: 0 } }), _dec20 = property({ type: Enum(chsdk.serverType), displayName: '服务器地址', visible: function visible() { return !this.is_local; }, group: { name: 'ch.sdk模块', id: 'sdk', displayOrder: 0 }, tooltip: "local 局域网 \n dev 测试服 \n online 正式服" }), _dec21 = property({ displayName: '本地服测试ip', visible: function visible() { return this.server == chsdk.serverType.test; }, group: { name: 'ch.sdk模块', id: 'sdk', displayOrder: 0 } }), _dec22 = property({ type: Enum(chsdk.reportType), displayName: '上报类型', group: { name: '基本参数', id: 'sdk', displayOrder: 0 }, tooltip: "off 不上报 \n ch 使用ch服务器(需要在ch后台配置事件) \n platform 使用微信/抖音平台(需要在平台后台设置事件)\nch__platflorm所有平台自定义事件都上报" }), _dec23 = property({ type: Enum(chsdk.loglevel), displayName: '日志等级', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec24 = property({ displayName: '抖音奖励广告id', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec25 = property({ displayName: '抖音插屏广告id', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec26 = property({ displayName: '抖音订阅id(,隔开)', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec27 = property({ displayName: '微信奖励广告id', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec28 = property({ displayName: '微信插屏广告id', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec29 = property({ displayName: '微信订阅id(,隔开)', group: { name: '基本参数', id: 'sdk', displayOrder: 0 } }), _dec30 = property({ visible: false }), _dec31 = property({ type: Enum(_crd && loadType === void 0 ? (_reportPossibleCrUseOfloadType({ error: Error() }), loadType) : loadType), visible: false }), _dec32 = property({ displayName: '是否使用ch.audio模块', group: { name: 'ch.audio模块', id: 'audio', displayOrder: 1 } }), _dec33 = property({ type: Enum(_crd && loadType === void 0 ? (_reportPossibleCrUseOfloadType({ error: Error() }), loadType) : loadType), displayName: '音频资源加载模式', group: { name: 'ch.audio模块', id: 'audio', displayOrder: 1 }, visible: function visible() { return this._use_ch_audio; } }), _dec34 = property({ displayName: '音频资源默认bundle名', group: { name: 'ch.audio模块', id: 'audio', displayOrder: 1 }, visible: function visible() { return this._use_ch_audio && this._ch_audio_type == (_crd && loadType === void 0 ? (_reportPossibleCrUseOfloadType({ error: Error() }), loadType) : loadType).bundle; } }), _dec35 = property({ displayName: '音频资源远程地址', group: { name: 'ch.audio模块', id: 'audio', displayOrder: 1 }, visible: function visible() { return this._use_ch_audio && this._ch_audio_type == (_crd && loadType === void 0 ? (_reportPossibleCrUseOfloadType({ error: Error() }), loadType) : loadType).remote; } }), _dec(_class = (_class2 = class ch_start_pack extends Component { constructor() { super(...arguments); _initializerDefineProperty(this, "_gname", _descriptor, this); _initializerDefineProperty(this, "_gid", _descriptor2, this); _initializerDefineProperty(this, "_is_local", _descriptor3, this); _initializerDefineProperty(this, "_server", _descriptor4, this); _initializerDefineProperty(this, "_report", _descriptor5, this); _initializerDefineProperty(this, "_log", _descriptor6, this); _initializerDefineProperty(this, "_ttad", _descriptor7, this); _initializerDefineProperty(this, "_ttiad", _descriptor8, this); _initializerDefineProperty(this, "_tttmpid", _descriptor9, this); _initializerDefineProperty(this, "_wxad", _descriptor10, this); _initializerDefineProperty(this, "_wxiad", _descriptor11, this); _initializerDefineProperty(this, "_wxtmpid", _descriptor12, this); _initializerDefineProperty(this, "_serverIP", _descriptor13, this); _initializerDefineProperty(this, "_pid", _descriptor14, this); // _initializerDefineProperty(this, "_use_ch_audio", _descriptor15, this); _initializerDefineProperty(this, "_ch_audio_type", _descriptor16, this); _initializerDefineProperty(this, "sound_bundle", _descriptor17, this); _initializerDefineProperty(this, "sound_url", _descriptor18, this); } get pid() { return this._pid; } set pid(val) { this._pid = val; for (var i = 0; i <= this._pid; i++) { var _this$_gname, _i, _this$_gname$_i, _this$_is_local, _i2, _this$_is_local$_i, _this$_is_local2, _this$_gid, _i3, _this$_gid$_i, _this$_gid2, _this$_server, _i4, _this$_server$_i, _this$_server2, _this$_report, _i5, _this$_report$_i, _this$_report2, _this$_log, _i6, _this$_log$_i, _this$_log2, _this$_ttad, _i7, _this$_ttad$_i, _this$_ttiad, _i8, _this$_ttiad$_i, _this$_tttmpid, _i9, _this$_tttmpid$_i, _this$_wxad, _i10, _this$_wxad$_i, _this$_wxiad, _i11, _this$_wxiad$_i, _this$_wxtmpid, _i12, _this$_wxtmpid$_i, _this$_serverIP, _i13, _this$_serverIP$_i; (_this$_gname$_i = (_this$_gname = this._gname)[_i = i]) != null ? _this$_gname$_i : _this$_gname[_i] = ''; (_this$_is_local$_i = (_this$_is_local = this._is_local)[_i2 = i]) != null ? _this$_is_local$_i : _this$_is_local[_i2] = (_this$_is_local2 = this._is_local[i - 1]) != null ? _this$_is_local2 : true; (_this$_gid$_i = (_this$_gid = this._gid)[_i3 = i]) != null ? _this$_gid$_i : _this$_gid[_i3] = (_this$_gid2 = this._gid[i - 1]) != null ? _this$_gid2 : '0'; (_this$_server$_i = (_this$_server = this._server)[_i4 = i]) != null ? _this$_server$_i : _this$_server[_i4] = (_this$_server2 = this._server[i - 1]) != null ? _this$_server2 : chsdk.serverType.online; (_this$_report$_i = (_this$_report = this._report)[_i5 = i]) != null ? _this$_report$_i : _this$_report[_i5] = (_this$_report2 = this._report[i - 1]) != null ? _this$_report2 : chsdk.reportType.off; (_this$_log$_i = (_this$_log = this._log)[_i6 = i]) != null ? _this$_log$_i : _this$_log[_i6] = (_this$_log2 = this._log[i - 1]) != null ? _this$_log2 : chsdk.loglevel.DEBUG; (_this$_ttad$_i = (_this$_ttad = this._ttad)[_i7 = i]) != null ? _this$_ttad$_i : _this$_ttad[_i7] = ''; (_this$_ttiad$_i = (_this$_ttiad = this._ttiad)[_i8 = i]) != null ? _this$_ttiad$_i : _this$_ttiad[_i8] = ''; (_this$_tttmpid$_i = (_this$_tttmpid = this._tttmpid)[_i9 = i]) != null ? _this$_tttmpid$_i : _this$_tttmpid[_i9] = ''; (_this$_wxad$_i = (_this$_wxad = this._wxad)[_i10 = i]) != null ? _this$_wxad$_i : _this$_wxad[_i10] = ''; (_this$_wxiad$_i = (_this$_wxiad = this._wxiad)[_i11 = i]) != null ? _this$_wxiad$_i : _this$_wxiad[_i11] = ''; (_this$_wxtmpid$_i = (_this$_wxtmpid = this._wxtmpid)[_i12 = i]) != null ? _this$_wxtmpid$_i : _this$_wxtmpid[_i12] = ''; (_this$_serverIP$_i = (_this$_serverIP = this._serverIP)[_i13 = i]) != null ? _this$_serverIP$_i : _this$_serverIP[_i13] = 'http://192.168.1.120:8787/v1'; } } get gname() { var _this$_gname$this$_pi; return (_this$_gname$this$_pi = this._gname[this._pid]) != null ? _this$_gname$this$_pi : ''; } set gname(val) { this._gname[this._pid] = val; } get gid() { return this._gid[this._pid]; } set gid(val) { this._gid[this._pid] = val; } // get is_local() { return this._is_local[this._pid]; } set is_local(val) { this._is_local[this._pid] = val; } // get server() { return this._server[this._pid]; } set server(val) { this._server[this._pid] = val; } get serverIP() { return this._serverIP[this._pid]; } set serverIP(val) { this._serverIP[this._pid] = val; } get report() { return this._report[this._pid]; } set report(val) { this._report[this._pid] = val; } get log() { return this._log[this._pid]; } set log(val) { this._log[this._pid] = val; } // get ttad() { return this._ttad[this._pid]; } set ttad(val) { this._ttad[this._pid] = val; } get ttiad() { return this._ttiad[this._pid]; } set ttiad(val) { this._ttiad[this._pid] = val; } get tttmpid() { return this._tttmpid[this._pid]; } set tttmpid(val) { this._tttmpid[this._pid] = val; } get wxad() { return this._wxad[this._pid]; } set wxad(val) { this._wxad[this._pid] = val; } get wxiad() { return this._wxiad[this._pid]; } set wxiad(val) { this._wxiad[this._pid] = val; } get wxtmpid() { return this._wxtmpid[this._pid]; } set wxtmpid(val) { this._wxtmpid[this._pid] = val; } get use_ch_audio() { return this._use_ch_audio; } set use_ch_audio(val) { this._use_ch_audio = val; } get sount_load_type() { return this._ch_audio_type; } set sount_load_type(val) { this._ch_audio_type = val; } onLoad() { console.log('包Id:' + this.pid, '游戏名:' + this.gname, '游戏Id:' + this.gid, '单机:' + this.is_local, '服务器:' + chsdk.serverType[this.server]); } /**初始化*/ init() { var _this = this; return _asyncToGenerator(function* () { chsdk.setConf(chsdk.pf.tt, { adUnitId: _this.ttad, multiton: false, inster_unitId: _this.ttiad, tmplIds: _this.tttmpid ? _this.tttmpid.split(',') : null }); chsdk.setConf(chsdk.pf.wx, { adUnitId: _this.wxad, multiton: false, inster_unitId: _this.wxiad, tmplIds: _this.wxtmpid ? _this.wxtmpid.split(',') : null }); var ret = yield chsdk.init_inside(_this.gid, _this.log, _this.server == chsdk.serverType.test ? _this.serverIP : _this.server, _this.is_local, _this.report); if (ret.code == chsdk.code.success) { if (_this.use_ch_audio) { (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({ error: Error() }), ch) : ch).audio.init(_this.sount_load_type, _this.sound_bundle, _this.sound_url); } if (chsdk.get_pf() === chsdk.pf.web) { var sdk = new Node(); sdk.name = '__ch_sdk__'; sdk.addComponent(_crd && ch_sdk_comp === void 0 ? (_reportPossibleCrUseOfch_sdk_comp({ error: Error() }), ch_sdk_comp) : ch_sdk_comp); director.getScene().addChild(sdk); director.addPersistRootNode(sdk); } return true; } else { chsdk.log.error(ret.err); return false; } })(); } /**初化始并在遇到问题时以单机模式进入 * @param try_count 重试次数 * @param try_interval 重试间隔时间(MS) */ try_init(try_count, try_interval) { var _this2 = this; return _asyncToGenerator(function* () { if (try_count === void 0) { try_count = 5; } if (try_interval === void 0) { try_interval = 2000; } var ret = yield _this2.init(); if (ret) return; try_count--; if (try_count < 0) { _this2.is_local = true; yield _this2.init(); return; } else { yield new Promise(resolve => setTimeout(resolve, try_interval)); return _this2.try_init(try_count, try_interval); } })(); } }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "_gname", [_dec2], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "_gid", [_dec3], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "_is_local", [_dec4], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "_server", [_dec5], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return [chsdk.serverType.dev]; } }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "_report", [_dec6], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return [chsdk.reportType.off]; } }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "_log", [_dec7], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "_ttad", [_dec8], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "_ttiad", [_dec9], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "_tttmpid", [_dec10], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "_wxad", [_dec11], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor11 = _applyDecoratedDescriptor(_class2.prototype, "_wxiad", [_dec12], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor12 = _applyDecoratedDescriptor(_class2.prototype, "_wxtmpid", [_dec13], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor13 = _applyDecoratedDescriptor(_class2.prototype, "_serverIP", [_dec14], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return []; } }), _descriptor14 = _applyDecoratedDescriptor(_class2.prototype, "_pid", [_dec15], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return pack.id0; } }), _applyDecoratedDescriptor(_class2.prototype, "pid", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "pid"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "gname", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "gname"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "gid", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "gid"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "is_local", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "is_local"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "server", [_dec20], Object.getOwnPropertyDescriptor(_class2.prototype, "server"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "serverIP", [_dec21], Object.getOwnPropertyDescriptor(_class2.prototype, "serverIP"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "report", [_dec22], Object.getOwnPropertyDescriptor(_class2.prototype, "report"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "log", [_dec23], Object.getOwnPropertyDescriptor(_class2.prototype, "log"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "ttad", [_dec24], Object.getOwnPropertyDescriptor(_class2.prototype, "ttad"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "ttiad", [_dec25], Object.getOwnPropertyDescriptor(_class2.prototype, "ttiad"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "tttmpid", [_dec26], Object.getOwnPropertyDescriptor(_class2.prototype, "tttmpid"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "wxad", [_dec27], Object.getOwnPropertyDescriptor(_class2.prototype, "wxad"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "wxiad", [_dec28], Object.getOwnPropertyDescriptor(_class2.prototype, "wxiad"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "wxtmpid", [_dec29], Object.getOwnPropertyDescriptor(_class2.prototype, "wxtmpid"), _class2.prototype), _descriptor15 = _applyDecoratedDescriptor(_class2.prototype, "_use_ch_audio", [_dec30], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return false; } }), _descriptor16 = _applyDecoratedDescriptor(_class2.prototype, "_ch_audio_type", [_dec31], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return (_crd && loadType === void 0 ? (_reportPossibleCrUseOfloadType({ error: Error() }), loadType) : loadType).bundle; } }), _applyDecoratedDescriptor(_class2.prototype, "use_ch_audio", [_dec32], Object.getOwnPropertyDescriptor(_class2.prototype, "use_ch_audio"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "sount_load_type", [_dec33], Object.getOwnPropertyDescriptor(_class2.prototype, "sount_load_type"), _class2.prototype), _descriptor17 = _applyDecoratedDescriptor(_class2.prototype, "sound_bundle", [_dec34], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return 'res'; } }), _descriptor18 = _applyDecoratedDescriptor(_class2.prototype, "sound_url", [_dec35], { configurable: true, enumerable: true, writable: true, initializer: function initializer() { return ''; } })), _class2)) || _class)); _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=31f21e9610b2e754c9705fb8b4947b7629eba3ec.js.map