4b09240a6d477ece19a093f65ae79d3ecffa0eac.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Button, Component, EventHandler, Input, Node, SpriteFrame, _decorator, input, isValid, oops, EventDispatcher, EventMessage, resLoader, ViewUtil, _dec, _class, _crd, ccclass, ResType, GameComponent;
  4. 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); } }
  5. 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); }); }; }
  6. function _reportPossibleCrUseOfoops(extras) {
  7. _reporterNs.report("oops", "../../core/Oops", _context.meta, extras);
  8. }
  9. function _reportPossibleCrUseOfEventDispatcher(extras) {
  10. _reporterNs.report("EventDispatcher", "../../core/common/event/EventDispatcher", _context.meta, extras);
  11. }
  12. function _reportPossibleCrUseOfEventMessage(extras) {
  13. _reporterNs.report("EventMessage", "../../core/common/event/EventMessage", _context.meta, extras);
  14. }
  15. function _reportPossibleCrUseOfListenerFunc(extras) {
  16. _reporterNs.report("ListenerFunc", "../../core/common/event/EventMessage", _context.meta, extras);
  17. }
  18. function _reportPossibleCrUseOfAssetType(extras) {
  19. _reporterNs.report("AssetType", "../../core/common/loader/ResLoader", _context.meta, extras);
  20. }
  21. function _reportPossibleCrUseOfCompleteCallback(extras) {
  22. _reporterNs.report("CompleteCallback", "../../core/common/loader/ResLoader", _context.meta, extras);
  23. }
  24. function _reportPossibleCrUseOfPaths(extras) {
  25. _reporterNs.report("Paths", "../../core/common/loader/ResLoader", _context.meta, extras);
  26. }
  27. function _reportPossibleCrUseOfProgressCallback(extras) {
  28. _reporterNs.report("ProgressCallback", "../../core/common/loader/ResLoader", _context.meta, extras);
  29. }
  30. function _reportPossibleCrUseOfresLoader(extras) {
  31. _reporterNs.report("resLoader", "../../core/common/loader/ResLoader", _context.meta, extras);
  32. }
  33. function _reportPossibleCrUseOfViewUtil(extras) {
  34. _reporterNs.report("ViewUtil", "../../core/utils/ViewUtil", _context.meta, extras);
  35. }
  36. return {
  37. setters: [function (_unresolved_) {
  38. _reporterNs = _unresolved_;
  39. }, function (_cc) {
  40. _cclegacy = _cc.cclegacy;
  41. __checkObsolete__ = _cc.__checkObsolete__;
  42. __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
  43. Button = _cc.Button;
  44. Component = _cc.Component;
  45. EventHandler = _cc.EventHandler;
  46. Input = _cc.Input;
  47. Node = _cc.Node;
  48. SpriteFrame = _cc.SpriteFrame;
  49. _decorator = _cc._decorator;
  50. input = _cc.input;
  51. isValid = _cc.isValid;
  52. }, function (_unresolved_2) {
  53. oops = _unresolved_2.oops;
  54. }, function (_unresolved_3) {
  55. EventDispatcher = _unresolved_3.EventDispatcher;
  56. }, function (_unresolved_4) {
  57. EventMessage = _unresolved_4.EventMessage;
  58. }, function (_unresolved_5) {
  59. resLoader = _unresolved_5.resLoader;
  60. }, function (_unresolved_6) {
  61. ViewUtil = _unresolved_6.ViewUtil;
  62. }],
  63. execute: function () {
  64. _crd = true;
  65. _cclegacy._RF.push({}, "62362nWbWZP653j6XL/zJDq", "GameComponent", undefined);
  66. /*
  67. * @Author: dgflash
  68. * @Date: 2022-04-14 17:08:01
  69. * @LastEditors: dgflash
  70. * @LastEditTime: 2022-12-13 11:36:00
  71. */
  72. __checkObsolete__(['Asset', 'Button', 'Component', 'EventHandler', 'EventKeyboard', 'EventTouch', 'Input', 'Node', 'Sprite', 'SpriteFrame', '__private', '_decorator', 'input', 'isValid']);
  73. ({
  74. ccclass
  75. } = _decorator);
  76. /** 加载资源类型 */
  77. ResType = /*#__PURE__*/function (ResType) {
  78. ResType[ResType["Load"] = 0] = "Load";
  79. ResType[ResType["LoadDir"] = 1] = "LoadDir";
  80. ResType[ResType["Audio"] = 2] = "Audio";
  81. return ResType;
  82. }(ResType || {});
  83. /** 资源加载记录 */
  84. /**
  85. * 游戏显示对象组件模板
  86. * 1、当前对象加载的资源,会在对象释放时,自动释放引用的资源
  87. * 2、当前对象支持启动游戏引擎提供的各种常用逻辑事件
  88. */
  89. _export("GameComponent", GameComponent = (_dec = ccclass("GameComponent"), _dec(_class = class GameComponent extends Component {
  90. constructor() {
  91. super(...arguments);
  92. //#region 全局事件管理
  93. this._event = null;
  94. //#endregion
  95. //#region 预制节点管理
  96. /** 摊平的节点集合(所有节点不能重名) */
  97. this.nodes = null;
  98. //#endregion
  99. //#region 资源加载管理
  100. /** 资源路径 */
  101. this.resPaths = null;
  102. }
  103. /** 全局事件管理器 */
  104. get event() {
  105. if (this._event == null) this._event = new (_crd && EventDispatcher === void 0 ? (_reportPossibleCrUseOfEventDispatcher({
  106. error: Error()
  107. }), EventDispatcher) : EventDispatcher)();
  108. return this._event;
  109. }
  110. /**
  111. * 注册全局事件
  112. * @param event 事件名
  113. * @param listener 处理事件的侦听器函数
  114. * @param object 侦听函数绑定的this对象
  115. */
  116. on(event, listener, object) {
  117. this.event.on(event, listener, object);
  118. }
  119. /**
  120. * 移除全局事件
  121. * @param event 事件名
  122. */
  123. off(event) {
  124. this.event.off(event);
  125. }
  126. /**
  127. * 触发全局事件
  128. * @param event 事件名
  129. * @param args 事件参数
  130. */
  131. dispatchEvent(event) {
  132. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  133. args[_key - 1] = arguments[_key];
  134. }
  135. this.event.dispatchEvent(event, ...args);
  136. }
  137. /** 通过节点名获取预制上的节点,整个预制不能有重名节点 */
  138. getNode(name) {
  139. if (this.nodes) {
  140. return this.nodes.get(name);
  141. }
  142. return undefined;
  143. }
  144. /** 平摊所有节点存到Map<string, Node>中通过get(name: string)方法获取 */
  145. nodeTreeInfoLite() {
  146. this.nodes = new Map();
  147. (_crd && ViewUtil === void 0 ? (_reportPossibleCrUseOfViewUtil({
  148. error: Error()
  149. }), ViewUtil) : ViewUtil).nodeTreeInfoLite(this.node, this.nodes);
  150. }
  151. /**
  152. * 从资源缓存中找到预制资源名并创建一个显示对象
  153. * @param path 资源路径
  154. */
  155. createPrefabNode(path, bundleName) {
  156. if (bundleName === void 0) {
  157. bundleName = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  158. error: Error()
  159. }), oops) : oops).res.defaultBundleName;
  160. }
  161. return (_crd && ViewUtil === void 0 ? (_reportPossibleCrUseOfViewUtil({
  162. error: Error()
  163. }), ViewUtil) : ViewUtil).createPrefabNode(path, bundleName);
  164. }
  165. /**
  166. * 加载预制并创建预制节点
  167. * @param path 资源路径
  168. * @param bundleName 资源包名
  169. */
  170. createPrefabNodeAsync(path, bundleName) {
  171. if (bundleName === void 0) {
  172. bundleName = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  173. error: Error()
  174. }), oops) : oops).res.defaultBundleName;
  175. }
  176. return (_crd && ViewUtil === void 0 ? (_reportPossibleCrUseOfViewUtil({
  177. error: Error()
  178. }), ViewUtil) : ViewUtil).createPrefabNodeAsync(path, bundleName);
  179. }
  180. // 资源使用记录
  181. /**
  182. * 获取资源
  183. * @param path 资源路径
  184. * @param type 资源类型
  185. * @param bundleName 远程资源包名
  186. */
  187. getRes(path, type, bundleName) {
  188. return (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  189. error: Error()
  190. }), oops) : oops).res.get(path, type, bundleName);
  191. }
  192. /**
  193. * 添加资源使用记录
  194. * @param type 资源类型
  195. * @param bundleName 资源包名
  196. * @param paths 资源路径
  197. */
  198. addPathToRecord(type, bundleName, paths, resId) {
  199. if (this.resPaths == null) this.resPaths = new Map();
  200. var rps = this.resPaths.get(type);
  201. if (rps == null) {
  202. rps = new Map();
  203. this.resPaths.set(type, rps);
  204. }
  205. if (paths instanceof Array) {
  206. var realBundle = bundleName;
  207. for (var index = 0; index < paths.length; index++) {
  208. var realPath = paths[index];
  209. var key = this.getResKey(realBundle, realPath, resId);
  210. if (!rps.has(key)) {
  211. rps.set(key, {
  212. path: realPath,
  213. bundle: realBundle,
  214. resId: resId
  215. });
  216. }
  217. }
  218. } else if (typeof paths === "string") {
  219. var _realBundle = bundleName;
  220. var _realPath = paths;
  221. var _key2 = this.getResKey(_realBundle, _realPath, resId);
  222. if (!rps.has(_key2)) {
  223. rps.set(_key2, {
  224. path: _realPath,
  225. bundle: _realBundle,
  226. resId: resId
  227. });
  228. }
  229. } else {
  230. var _realBundle2 = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  231. error: Error()
  232. }), oops) : oops).res.defaultBundleName;
  233. var _realPath2 = bundleName;
  234. var _key3 = this.getResKey(_realBundle2, _realPath2, resId);
  235. if (!rps.has(_key3)) {
  236. rps.set(_key3, {
  237. path: _realPath2,
  238. bundle: _realBundle2,
  239. resId: resId
  240. });
  241. }
  242. }
  243. }
  244. getResKey(realBundle, realPath, resId) {
  245. var key = realBundle + ":" + realPath;
  246. if (resId != null) key += ":" + resId;
  247. return key;
  248. }
  249. /**
  250. * 加载一个资源
  251. * @param bundleName 远程包名
  252. * @param paths 资源路径
  253. * @param type 资源类型
  254. * @param onProgress 加载进度回调
  255. * @param onComplete 加载完成回调
  256. */
  257. load(bundleName, paths, type, onProgress, onComplete) {
  258. this.addPathToRecord(ResType.Load, bundleName, paths);
  259. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  260. error: Error()
  261. }), oops) : oops).res.load(bundleName, paths, type, onProgress, onComplete);
  262. }
  263. /**
  264. * 异步加载一个资源
  265. * @param bundleName 远程包名
  266. * @param paths 资源路径
  267. * @param type 资源类型
  268. */
  269. loadAsync(bundleName, paths, type) {
  270. this.addPathToRecord(ResType.Load, bundleName, paths);
  271. return (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  272. error: Error()
  273. }), oops) : oops).res.loadAsync(bundleName, paths, type);
  274. }
  275. /**
  276. * 加载文件夹中的资源
  277. * @param bundleName 远程包名
  278. * @param dir 文件夹名
  279. * @param type 资源类型
  280. * @param onProgress 加载进度回调
  281. * @param onComplete 加载完成回调
  282. */
  283. loadDir(bundleName, dir, type, onProgress, onComplete) {
  284. var realDir;
  285. var realBundle;
  286. if (typeof dir === "string") {
  287. realDir = dir;
  288. realBundle = bundleName;
  289. } else {
  290. realDir = bundleName;
  291. realBundle = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  292. error: Error()
  293. }), oops) : oops).res.defaultBundleName;
  294. }
  295. this.addPathToRecord(ResType.LoadDir, realBundle, realDir);
  296. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  297. error: Error()
  298. }), oops) : oops).res.loadDir(bundleName, dir, type, onProgress, onComplete);
  299. }
  300. /** 释放资源 */
  301. release() {
  302. if (this.resPaths) {
  303. var rps = this.resPaths.get(ResType.Load);
  304. if (rps) {
  305. rps.forEach(value => {
  306. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  307. error: Error()
  308. }), oops) : oops).res.release(value.path, value.bundle);
  309. });
  310. rps.clear();
  311. }
  312. }
  313. }
  314. /** 释放文件夹的资源 */
  315. releaseDir() {
  316. if (this.resPaths) {
  317. var rps = this.resPaths.get(ResType.LoadDir);
  318. if (rps) {
  319. rps.forEach(value => {
  320. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  321. error: Error()
  322. }), oops) : oops).res.releaseDir(value.path, value.bundle);
  323. });
  324. }
  325. }
  326. }
  327. /** 释放音效资源 */
  328. releaseAudioEffect() {
  329. if (this.resPaths) {
  330. var rps = this.resPaths.get(ResType.Audio);
  331. if (rps) {
  332. rps.forEach(value => {
  333. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  334. error: Error()
  335. }), oops) : oops).audio.putEffect(value.resId, value.path, value.bundle);
  336. });
  337. }
  338. }
  339. }
  340. /**
  341. * 设置图片资源
  342. * @param target 目标精灵对象
  343. * @param path 图片资源地址
  344. * @param bundle 资源包名
  345. */
  346. setSprite(target, path, bundle) {
  347. var _this = this;
  348. return _asyncToGenerator(function* () {
  349. if (bundle === void 0) {
  350. bundle = (_crd && resLoader === void 0 ? (_reportPossibleCrUseOfresLoader({
  351. error: Error()
  352. }), resLoader) : resLoader).defaultBundleName;
  353. }
  354. var spriteFrame = yield _this.loadAsync(bundle, path, SpriteFrame);
  355. if (!spriteFrame || !isValid(target)) {
  356. var rps = _this.resPaths.get(ResType.Load);
  357. if (rps) {
  358. var key = _this.getResKey(bundle, path);
  359. rps.delete(key);
  360. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  361. error: Error()
  362. }), oops) : oops).res.release(path, bundle);
  363. }
  364. return;
  365. }
  366. target.spriteFrame = spriteFrame;
  367. })();
  368. } //#endregion
  369. //#region 音频播放管理
  370. /**
  371. * 播放背景音乐(不受自动释放资源管理)
  372. * @param url 资源地址
  373. * @param callback 资源加载完成回调
  374. * @param bundleName 资源包名
  375. */
  376. playMusic(url, callback, bundleName) {
  377. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  378. error: Error()
  379. }), oops) : oops).audio.playMusic(url, callback, bundleName);
  380. }
  381. /**
  382. * 循环播放背景音乐(不受自动释放资源管理)
  383. * @param url 资源地址
  384. * @param bundleName 资源包名
  385. */
  386. playMusicLoop(url, bundleName) {
  387. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  388. error: Error()
  389. }), oops) : oops).audio.stopMusic();
  390. (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  391. error: Error()
  392. }), oops) : oops).audio.playMusicLoop(url, bundleName);
  393. }
  394. /**
  395. * 播放音效
  396. * @param url 资源地址
  397. * @param callback 资源加载完成回调
  398. * @param bundleName 资源包名
  399. */
  400. playEffect(url, bundleName) {
  401. var _this2 = this;
  402. return _asyncToGenerator(function* () {
  403. if (bundleName == null) bundleName = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  404. error: Error()
  405. }), oops) : oops).res.defaultBundleName;
  406. yield (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
  407. error: Error()
  408. }), oops) : oops).audio.playEffect(url, bundleName, () => {
  409. var rps = _this2.resPaths.get(ResType.Audio);
  410. if (rps) {
  411. var key = _this2.getResKey(bundleName, url);
  412. rps.delete(key);
  413. }
  414. });
  415. _this2.addPathToRecord(ResType.Audio, bundleName, url);
  416. })();
  417. } //#endregion
  418. //#region 游戏逻辑事件
  419. /**
  420. * 批量设置当前界面按钮事件
  421. * @param bindRootEvent 是否对预制根节点绑定触摸事件
  422. * @example
  423. * 注:按钮节点Label1、Label2必须绑定UIButton等类型的按钮组件才会生效,方法名必须与节点名一致
  424. * this.setButton();
  425. *
  426. * Label1(event: EventTouch) { console.log(event.target.name); }
  427. * Label2(event: EventTouch) { console.log(event.target.name); }
  428. */
  429. setButton(bindRootEvent) {
  430. if (bindRootEvent === void 0) {
  431. bindRootEvent = true;
  432. }
  433. // 自定义按钮批量绑定触摸事件
  434. if (bindRootEvent) {
  435. this.node.on(Node.EventType.TOUCH_END, event => {
  436. var self = this;
  437. var func = self[event.target.name];
  438. if (func) {
  439. func.call(this, event);
  440. } // 不触发界面根节点触摸事件、不触发长按钮组件的触摸事件
  441. // else if (event.target != this.node && event.target.getComponent(ButtonTouchLong) == null) {
  442. // console.warn(`名为【${event.target.name}】的按钮事件方法不存在`);
  443. // }
  444. }, this);
  445. } // Cocos Creator Button组件批量绑定触摸事件(使用UIButton支持放连点功能)
  446. var regex = /<([^>]+)>/;
  447. var buttons = this.node.getComponentsInChildren(Button);
  448. buttons.forEach(b => {
  449. var node = b.node;
  450. var self = this;
  451. var func = self[node.name];
  452. if (func) {
  453. var event = new EventHandler();
  454. event.target = this.node;
  455. event.handler = b.node.name;
  456. event.component = this.name.match(regex)[1];
  457. b.clickEvents.push(event);
  458. } // else {
  459. // console.warn(`名为【${node.name}】的按钮事件方法不存在`);
  460. // }
  461. });
  462. }
  463. /**
  464. * 批量设置全局事件
  465. * @example
  466. * this.setEvent("onGlobal");
  467. * this.dispatchEvent("onGlobal", "全局事件");
  468. *
  469. * onGlobal(event: string, args: any) { console.log(args) };
  470. */
  471. setEvent() {
  472. var self = this;
  473. for (var _len2 = arguments.length, args = new Array(_len2), _key4 = 0; _key4 < _len2; _key4++) {
  474. args[_key4] = arguments[_key4];
  475. }
  476. for (var name of args) {
  477. var func = self[name];
  478. if (func) this.on(name, func, this);else console.error("\u540D\u4E3A\u3010" + name + "\u3011\u7684\u5168\u5C40\u4E8B\u65B9\u6CD5\u4E0D\u5B58\u5728");
  479. }
  480. }
  481. /**
  482. * 键盘事件开关
  483. * @param on 打开键盘事件为true
  484. */
  485. setKeyboard(on) {
  486. if (on) {
  487. input.on(Input.EventType.KEY_DOWN, this.onKeyDown, this);
  488. input.on(Input.EventType.KEY_UP, this.onKeyUp, this);
  489. input.on(Input.EventType.KEY_PRESSING, this.onKeyPressing, this);
  490. } else {
  491. input.off(Input.EventType.KEY_DOWN, this.onKeyDown, this);
  492. input.off(Input.EventType.KEY_UP, this.onKeyUp, this);
  493. input.off(Input.EventType.KEY_PRESSING, this.onKeyPressing, this);
  494. }
  495. }
  496. /** 键按下 */
  497. onKeyDown(event) {}
  498. /** 键放开 */
  499. onKeyUp(event) {}
  500. /** 键长按 */
  501. onKeyPressing(event) {}
  502. /** 监听游戏从后台进入事件 */
  503. setGameShow() {
  504. this.on((_crd && EventMessage === void 0 ? (_reportPossibleCrUseOfEventMessage({
  505. error: Error()
  506. }), EventMessage) : EventMessage).GAME_SHOW, this.onGameShow, this);
  507. }
  508. /** 监听游戏切到后台事件 */
  509. setGameHide() {
  510. this.on((_crd && EventMessage === void 0 ? (_reportPossibleCrUseOfEventMessage({
  511. error: Error()
  512. }), EventMessage) : EventMessage).GAME_HIDE, this.onGameHide, this);
  513. }
  514. /** 监听游戏画笔尺寸变化事件 */
  515. setGameResize() {
  516. this.on((_crd && EventMessage === void 0 ? (_reportPossibleCrUseOfEventMessage({
  517. error: Error()
  518. }), EventMessage) : EventMessage).GAME_RESIZE, this.onGameResize, this);
  519. }
  520. /** 监听游戏全屏事件 */
  521. setGameFullScreen() {
  522. this.on((_crd && EventMessage === void 0 ? (_reportPossibleCrUseOfEventMessage({
  523. error: Error()
  524. }), EventMessage) : EventMessage).GAME_FULL_SCREEN, this.onGameFullScreen, this);
  525. }
  526. /** 监听游戏旋转屏幕事件 */
  527. setGameOrientation() {
  528. this.on((_crd && EventMessage === void 0 ? (_reportPossibleCrUseOfEventMessage({
  529. error: Error()
  530. }), EventMessage) : EventMessage).GAME_ORIENTATION, this.onGameOrientation, this);
  531. }
  532. /** 游戏从后台进入事件回调 */
  533. onGameShow() {}
  534. /** 游戏切到后台事件回调 */
  535. onGameHide() {}
  536. /** 游戏画笔尺寸变化事件回调 */
  537. onGameResize() {}
  538. /** 游戏全屏事件回调 */
  539. onGameFullScreen() {}
  540. /** 游戏旋转屏幕事件回调 */
  541. onGameOrientation() {} //#endregion
  542. onDestroy() {
  543. // 释放消息对象
  544. if (this._event) {
  545. this._event.destroy();
  546. this._event = null;
  547. } // 节点引用数据清除
  548. if (this.nodes) {
  549. this.nodes.clear();
  550. this.nodes = null;
  551. } // 自动释放资源
  552. if (this.resPaths) {
  553. this.releaseAudioEffect();
  554. this.release();
  555. this.releaseDir();
  556. this.resPaths.clear();
  557. this.resPaths = null;
  558. }
  559. }
  560. }) || _class));
  561. _cclegacy._RF.pop();
  562. _crd = false;
  563. }
  564. };
  565. });
  566. //# sourceMappingURL=4b09240a6d477ece19a093f65ae79d3ecffa0eac.js.map