932f944e-9e4f-4037-b982-e6a3328327fb.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "use strict";
  2. cc._RF.push(module, '932f9ROnk9AN7mC5qMygyf7', 'NativeTryGamesWidget');
  3. // common-plugin/Scripts/NativeTryGamesWidget.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var Utils_1 = require("./Utils");
  26. var PlatUtils_1 = require("./PlatUtils");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var NativeTryGamesWidget = /** @class */ (function (_super) {
  29. __extends(NativeTryGamesWidget, _super);
  30. function NativeTryGamesWidget() {
  31. var _this = _super !== null && _super.apply(this, arguments) || this;
  32. _this._tryGameNode = null;
  33. _this._btnClose = null;
  34. return _this;
  35. }
  36. NativeTryGamesWidget.prototype.onLoad = function () {
  37. this._tryGameNode = this.getComponentInChildren("NativeTryGameNode");
  38. this._tryGameNode.node.active = false;
  39. this._btnClose = this._tryGameNode.node.getChildByName("BtnClose");
  40. };
  41. NativeTryGamesWidget.prototype.init = function () {
  42. if (!this._tryGameNode) {
  43. this._tryGameNode = this.getComponentInChildren("NativeTryGameNode");
  44. this._btnClose = this._tryGameNode.node.getChildByName("BtnClose");
  45. }
  46. if (Utils_1.utils.isShowNativeTryGamesWidget()) {
  47. var dataValid = true;
  48. if (Utils_1.utils.tryGameDate) {
  49. if (Utils_1.utils.tryGameDate.length <= 0) {
  50. cc.warn("res的长度不合法!");
  51. dataValid = false;
  52. }
  53. }
  54. else {
  55. cc.warn("res不存在!");
  56. dataValid = false;
  57. }
  58. Utils_1.utils.showLog("原生抖动dataValid:" + dataValid);
  59. if (dataValid) {
  60. Utils_1.utils.showLog("交叉推广数据:", JSON.stringify(Utils_1.utils.tryGameDate));
  61. this._tryGameNode.init({ "jump_refresh_time": Utils_1.utils.ServerConfig.icon_jump_native, "jump_list": Utils_1.utils.tryGameDate });
  62. this._tryGameNode.node.active = true;
  63. if (PlatUtils_1.default.IsHuaWei) {
  64. Utils_1.utils.showLog("华为平台,显示关闭按钮>>>>>");
  65. this._btnClose.active = true;
  66. }
  67. }
  68. else {
  69. this._tryGameNode.node.active = false;
  70. }
  71. }
  72. else {
  73. this._tryGameNode.node.active = false;
  74. }
  75. };
  76. NativeTryGamesWidget.prototype.close = function () {
  77. this._tryGameNode.node.opacity = 0;
  78. };
  79. NativeTryGamesWidget = __decorate([
  80. ccclass
  81. ], NativeTryGamesWidget);
  82. return NativeTryGamesWidget;
  83. }(cc.Component));
  84. exports.default = NativeTryGamesWidget;
  85. cc._RF.pop();