fe7d838a-f909-493b-8442-88392bd9ebf0.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. "use strict";
  2. cc._RF.push(module, 'fe7d8OK+QlJO4RCiDkr2evw', 'BeforGameOverRecGamesPanel');
  3. // common-plugin/Scripts/BeforGameOverRecGamesPanel.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 BeforGameOverRecGamesPanel = /** @class */ (function (_super) {
  30. __extends(BeforGameOverRecGamesPanel, _super);
  31. function BeforGameOverRecGamesPanel() {
  32. var _this = _super !== null && _super.apply(this, arguments) || this;
  33. _this._panel = null;
  34. _this._gameList = null;
  35. _this._originScale = 1;
  36. _this._gameItems = [];
  37. _this._jumpList = null;
  38. _this._dataDirty = false;
  39. _this._is_Horizontal = false;
  40. _this._closeBtnRight = null;
  41. _this._closeBtnLine = null;
  42. _this._star = null;
  43. _this.gameItemNode = null;
  44. _this._location = YZ_Constant_1.SubLocation.isMoreGame;
  45. return _this;
  46. }
  47. BeforGameOverRecGamesPanel.prototype.onLoad = function () {
  48. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  49. this.node.group = Utils_1.utils.otherConfig.group;
  50. }
  51. if (!PlatUtils_1.default.IsNativeAndroid) {
  52. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Home);
  53. }
  54. this._panel = this.node.getChildByName("Panel");
  55. this.node.active = false;
  56. var ratio = 1;
  57. if (cc.winSize.height < cc.winSize.width) {
  58. // 横屏游戏
  59. ratio = cc.winSize.width / 1920;
  60. this._is_Horizontal = true;
  61. }
  62. else {
  63. ratio = cc.winSize.width / 1080;
  64. }
  65. if (this._is_Horizontal) {
  66. this._panel.getChildByName("VGameScrollView").active = false;
  67. this._panel.getChildByName("VHead").active = false;
  68. this._gameList = this._panel.getChildByName("HGameScrollView").getComponent(cc.ScrollView).content;
  69. this.gameItemNode = this._gameList.children[0];
  70. this._gameList.removeAllChildren();
  71. }
  72. else {
  73. this._panel.getChildByName("HGameScrollView").active = false;
  74. this._panel.getChildByName("HHead").active = false;
  75. this._gameList = this._panel.getChildByName("VGameScrollView").getComponent(cc.ScrollView).content;
  76. this.gameItemNode = this._gameList.children[0];
  77. this._gameList.removeAllChildren();
  78. }
  79. this._panel.scale = ratio;
  80. this._originScale = this._panel.scale;
  81. };
  82. BeforGameOverRecGamesPanel.prototype._initWidget = function () {
  83. var _this = this;
  84. this.scheduleOnce(function () {
  85. _this._gameList.removeAllChildren();
  86. var clo = _this._is_Horizontal ? 7 : 4;
  87. var totalRow = Math.floor(_this._jumpList.length / clo);
  88. var totalClo = clo * totalRow;
  89. for (var i = 0; i < totalClo; i++) {
  90. var data = _this._jumpList[i];
  91. if (data && data.logo) {
  92. var tempNode = cc.instantiate(_this.gameItemNode);
  93. var gameItem = tempNode.getComponent("GameItem");
  94. gameItem.init(data, _this._location);
  95. _this._gameList.addChild(tempNode);
  96. }
  97. }
  98. });
  99. };
  100. BeforGameOverRecGamesPanel.prototype.update = function () {
  101. if (this._dataDirty) {
  102. this._dataDirty = false;
  103. this._updatePanel();
  104. }
  105. };
  106. BeforGameOverRecGamesPanel.prototype._updatePanel = function () {
  107. Utils_1.utils.postRecommentShowData(this._location);
  108. this._initWidget();
  109. return;
  110. };
  111. BeforGameOverRecGamesPanel.prototype.init = function (jumpList) {
  112. this._jumpList = jumpList;
  113. this._dataDirty = true;
  114. };
  115. BeforGameOverRecGamesPanel.prototype.show = function () {
  116. this.node.active = true;
  117. };
  118. BeforGameOverRecGamesPanel.prototype.hide = function () {
  119. var self = this;
  120. self.node.active = false;
  121. if (Utils_1.utils.rewardRecGamePanelCloseFunc) {
  122. Utils_1.utils.rewardRecGamePanelCloseFunc();
  123. Utils_1.utils.rewardRecGamePanelCloseFunc = null;
  124. ;
  125. }
  126. else {
  127. Utils_1.utils.rewardCloseFunc && Utils_1.utils.rewardCloseFunc();
  128. Utils_1.utils.rewardCloseFunc = null;
  129. }
  130. };
  131. BeforGameOverRecGamesPanel.prototype.onCloseBtnHandler = function (event, data) {
  132. this.hide();
  133. };
  134. BeforGameOverRecGamesPanel = __decorate([
  135. ccclass
  136. ], BeforGameOverRecGamesPanel);
  137. return BeforGameOverRecGamesPanel;
  138. }(cc.Component));
  139. exports.default = BeforGameOverRecGamesPanel;
  140. cc._RF.pop();