369d444c-dabb-4f8f-86e6-700deb329de3.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. "use strict";
  2. cc._RF.push(module, '369d4RM2rtPj4bmcA3rMp3j', 'MoreGamesPanel');
  3. // common-plugin/Scripts/MoreGamesPanel.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 YZ_Constant_1 = require("./YZ_Constant");
  27. var PlatUtils_1 = require("./PlatUtils");
  28. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  29. var _panelSize = [cc.size(225, 1000), cc.size(506, 1000)];
  30. var _titleSize = [cc.size(111, 54), cc.size(275, 54)];
  31. var _titleBgSize = [cc.size(376, 104), cc.size(545, 104)];
  32. var _starSize = [cc.size(251, 89), cc.size(425, 89)];
  33. var MoreGamesPanel = /** @class */ (function (_super) {
  34. __extends(MoreGamesPanel, _super);
  35. function MoreGamesPanel() {
  36. var _this = _super !== null && _super.apply(this, arguments) || this;
  37. _this._panel = null;
  38. _this._gameList = null;
  39. _this._originScale = 1;
  40. _this._gameItems = [];
  41. _this._jumpList = null;
  42. _this._dataDirty = false;
  43. _this._closeBtnRight = null;
  44. _this._closeBtnLine = null;
  45. _this._star = null;
  46. _this._items = [];
  47. _this.gameItemNode = null;
  48. _this._location = YZ_Constant_1.SubLocation.isMoreGame;
  49. return _this;
  50. }
  51. MoreGamesPanel.prototype.onLoad = function () {
  52. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  53. this.node.group = Utils_1.utils.otherConfig.group;
  54. }
  55. if (!PlatUtils_1.default.IsNativeAndroid) {
  56. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Home);
  57. }
  58. this._panel = this.node.getChildByName("Panel");
  59. this._gameList = this._panel.getChildByName("GameScrollView").getComponent(cc.ScrollView).content;
  60. this.gameItemNode = this._gameList.children[0];
  61. this._gameList.removeAllChildren();
  62. this.node.active = false;
  63. var ratio = 1;
  64. if (cc.winSize.height < cc.winSize.width) {
  65. // 横屏游戏
  66. ratio = cc.winSize.width / 1920 * 0.5;
  67. }
  68. else {
  69. ratio = cc.winSize.width / 1080;
  70. }
  71. this._panel.scale = ratio;
  72. this._originScale = this._panel.scale;
  73. };
  74. MoreGamesPanel.prototype._initWidget = function () {
  75. this._gameList.removeAllChildren();
  76. var totalRow = Math.floor(this._jumpList.length / 3);
  77. var totalClo = 3 * totalRow;
  78. for (var i = 0; i < totalClo; i++) {
  79. var data = this._jumpList[i];
  80. if (data && data.logo) {
  81. var tempNode = cc.instantiate(this.gameItemNode);
  82. var qcrossWidgetItem = tempNode.getComponent("QCrossWidgetItem");
  83. qcrossWidgetItem._location = this._location;
  84. qcrossWidgetItem.init(data);
  85. this._gameList.addChild(tempNode);
  86. }
  87. }
  88. };
  89. MoreGamesPanel.prototype.update = function () {
  90. if (this._dataDirty) {
  91. this._dataDirty = false;
  92. this._updatePanel();
  93. }
  94. };
  95. MoreGamesPanel.prototype._updatePanel = function () {
  96. Utils_1.utils.postRecommentShowData(this._location);
  97. this._initWidget();
  98. return;
  99. };
  100. MoreGamesPanel.prototype.init = function (jumpList) {
  101. this._jumpList = jumpList;
  102. this._dataDirty = true;
  103. };
  104. MoreGamesPanel.prototype.show = function () {
  105. this.node.active = true;
  106. };
  107. MoreGamesPanel.prototype.hide = function () {
  108. var self = this;
  109. // this._panel.runAction(cc.sequence(cc.moveTo(0.3, CompatibleTool.position(-this._panel.getContentSize().width, 0)).easing(cc.easeQuadraticActionOut()), cc.callFunc(() => {
  110. self.node.active = false;
  111. // })));
  112. // if (!PlatUtils.IsNativeAndroid) {
  113. // utils.adManager.ShowBanner(BannerLocation.Home);
  114. // }
  115. };
  116. MoreGamesPanel.prototype.onCloseBtnHandler = function (event, data) {
  117. this.hide();
  118. };
  119. MoreGamesPanel = __decorate([
  120. ccclass
  121. ], MoreGamesPanel);
  122. return MoreGamesPanel;
  123. }(cc.Component));
  124. exports.default = MoreGamesPanel;
  125. cc._RF.pop();