92ac16a4-aea9-4320-9be8-44e92a2405ab.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. "use strict";
  2. cc._RF.push(module, '92ac1akrqlDIJvoROkqJAWr', 'MoreGamesPanel1');
  3. // common-plugin/Scripts/MoreGamesPanel1.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 GameItem_1 = require("./GameItem");
  26. var YZ_Constant_1 = require("./YZ_Constant");
  27. var Utils_1 = require("./Utils");
  28. var List_1 = require("./List");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. var _panelSize = [cc.size(225, 1000), cc.size(506, 1000)];
  31. var _titleSize = [cc.size(111, 54), cc.size(275, 54)];
  32. var _titleBgSize = [cc.size(376, 104), cc.size(545, 104)];
  33. var _starSize = [cc.size(251, 89), cc.size(425, 89)];
  34. var MoreGamesPanel = /** @class */ (function (_super) {
  35. __extends(MoreGamesPanel, _super);
  36. function MoreGamesPanel() {
  37. var _this = _super !== null && _super.apply(this, arguments) || this;
  38. _this._panel = null;
  39. _this._gameList = null;
  40. _this._originScale = 1;
  41. _this._gameItems = [];
  42. _this._jumpList = null;
  43. _this._dataDirty = false;
  44. _this._closeBtnRight = null;
  45. _this._closeBtnLine = null;
  46. _this._title = null;
  47. _this._titleBg = null;
  48. _this._star = null;
  49. _this.gameItemNode = null;
  50. _this.listView = null;
  51. _this.autoScorll = false;
  52. return _this;
  53. }
  54. MoreGamesPanel.prototype.onLoad = function () {
  55. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  56. this.node.group = Utils_1.utils.otherConfig.group;
  57. }
  58. this._panel = this.node.getChildByName("Panel");
  59. this.listView = this._panel.getChildByName("GameList").getComponent(List_1.default);
  60. // this._gameList = this._panel.getChildByName("GameList").getComponent(cc.ScrollView).content;
  61. // this.gameItemNode = this._gameList.children[0];
  62. // this._gameList.removeAllChildren();
  63. this._closeBtnRight = this._panel.getChildByName("Btn_Close");
  64. this._closeBtnRight.active = true;
  65. this._closeBtnLine = this._panel.getChildByName("Btn_CloseSide");
  66. this._closeBtnLine.active = false;
  67. this._titleBg = cc.find("Title/TitleBg", this._panel);
  68. this._title = cc.find("Title/Txt", this._panel);
  69. this._star = cc.find("Title/Star", this._panel);
  70. this.node.active = false;
  71. var ratio = 1;
  72. if (cc.winSize.height < cc.winSize.width) {
  73. // 横屏游戏
  74. ratio = cc.winSize.width / 1920 * 0.5;
  75. }
  76. else {
  77. ratio = cc.winSize.width / 1080;
  78. }
  79. this._panel.scale = ratio;
  80. this._originScale = this._panel.scale;
  81. };
  82. MoreGamesPanel.prototype.update = function (dt) {
  83. if (this.autoScorll && !this.listView.scrollView.isScrolling()) {
  84. this.listView.content.y += dt * 100;
  85. this.listView._onScrolling();
  86. }
  87. };
  88. MoreGamesPanel.prototype.onListRender = function (item, idx) {
  89. var qcrossWidgetItem = item.getComponent(GameItem_1.default);
  90. qcrossWidgetItem.init(this._jumpList[idx], YZ_Constant_1.SubLocation.isMoreGame);
  91. };
  92. MoreGamesPanel.prototype._initWidget = function () {
  93. var _this = this;
  94. if (this._jumpList.length > 5) {
  95. if (Utils_1.utils.ServerConfig.more_game_pannel_auto_scroll && Utils_1.utils.ServerConfig.more_game_pannel_auto_scroll == "false") {
  96. Utils_1.utils.showLog("服务器不开启自动滚动!");
  97. }
  98. else {
  99. this.scheduleOnce(function () {
  100. _this.autoScorll = true;
  101. }, 1);
  102. }
  103. }
  104. Utils_1.utils.postRecommentShowData(YZ_Constant_1.SubLocation.isMoreGame);
  105. };
  106. MoreGamesPanel.prototype.init = function (jumpList) {
  107. this._jumpList = jumpList;
  108. this._dataDirty = true;
  109. if (this._jumpList && this._jumpList.length > 0) {
  110. this._initWidget();
  111. this.listView.numItems = this._jumpList.length;
  112. }
  113. else {
  114. cc.warn("交叉推广数据为null, 6元素交叉推广组件不显示!");
  115. this.node.destroy();
  116. }
  117. };
  118. MoreGamesPanel.prototype.show = function () {
  119. this.node.active = true;
  120. // this._panel.x = -this._panel.getContentSize().width;
  121. this._panel.y = 0;
  122. this._panel.runAction(cc.moveBy(0.3, cc.v2(this._panel.getContentSize().width, 0)).easing(cc.easeQuadraticActionOut()));
  123. };
  124. MoreGamesPanel.prototype.hide = function () {
  125. var self = this;
  126. this._panel.runAction(cc.sequence(cc.moveBy(0.3, cc.v2(-this._panel.getContentSize().width, 0)).easing(cc.easeQuadraticActionOut()), cc.callFunc(function () {
  127. self.node.active = false;
  128. })));
  129. };
  130. MoreGamesPanel.prototype.onCloseBtnHandler = function (event, data) {
  131. this.hide();
  132. };
  133. MoreGamesPanel = __decorate([
  134. ccclass
  135. ], MoreGamesPanel);
  136. return MoreGamesPanel;
  137. }(cc.Component));
  138. exports.default = MoreGamesPanel;
  139. cc._RF.pop();