771947b9-a9ee-4965-baa8-e1f65b4e4fa2.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. "use strict";
  2. cc._RF.push(module, '77194e5qe5JZbqo4fZbTk+i', 'ShareRecordPanel');
  3. // common-plugin/Scripts/ShareRecordPanel.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 CompatibleTool_1 = require("./CompatibleTool");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. /**
  31. * 分享录屏面板
  32. */
  33. var ShareRecordPanel = /** @class */ (function (_super) {
  34. __extends(ShareRecordPanel, _super);
  35. function ShareRecordPanel() {
  36. var _this = _super !== null && _super.apply(this, arguments) || this;
  37. _this.bg = null;
  38. _this.btnOk = null;
  39. _this.btnCancel = null;
  40. _this.glodNode = null;
  41. _this.glodLabel = null;
  42. _this.sharePanel = null;
  43. _this.RecPanel = null;
  44. _this._panel = null;
  45. _this._gameList = null;
  46. _this._originScale = 1;
  47. _this._gameItems = [];
  48. _this._jumpList = null;
  49. _this._dataDirty = false;
  50. _this._star = null;
  51. _this.gameItemNode = null;
  52. /**
  53. * 奖励回调
  54. */
  55. _this.rewardCallFunc = null;
  56. /**
  57. * 奖励值
  58. */
  59. _this.rewardValue = 0;
  60. return _this;
  61. // update (dt) {}
  62. }
  63. ShareRecordPanel.prototype.onLoad = function () {
  64. Utils_1.utils.SendEvent("结算前广告-分享弹窗-展示成功!");
  65. this.rewardValue = Utils_1.utils.rewardValue;
  66. this.rewardCallFunc = Utils_1.utils.rewardCallFunc;
  67. this.initUi();
  68. if (cc.winSize.height < cc.winSize.width) {
  69. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Game);
  70. }
  71. else {
  72. Utils_1.utils.adManager.ShowBanner(YZ_Constant_1.BannerLocation.Game);
  73. }
  74. if (PlatUtils_1.default.IsOPPO) {
  75. if (Utils_1.utils.ServerConfig.st_recomment_is_hide_banner && Utils_1.utils.ServerConfig.st_recomment_is_hide_banner == "true") {
  76. Utils_1.utils.showLog("服务器配置显示互推后隐藏banner >>>");
  77. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Game);
  78. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Over);
  79. }
  80. }
  81. };
  82. /**
  83. * 初始化UI
  84. */
  85. ShareRecordPanel.prototype.initUi = function () {
  86. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  87. this.node.group = Utils_1.utils.otherConfig.group;
  88. }
  89. this.bg = this.node.getChildByName("Bg");
  90. this.sharePanel = this.bg.getChildByName("SharePanel");
  91. this.RecPanel = this.bg.getChildByName("RecPanel");
  92. if (!PlatUtils_1.default.IsOPPO) {
  93. this.sharePanel.active = true;
  94. this.RecPanel.active = false;
  95. this.btnCancel = this.sharePanel.getChildByName("btnCancel");
  96. this.btnOk = this.sharePanel.getChildByName("btnOk");
  97. this.glodNode = this.sharePanel.getChildByName("rewardNode");
  98. this.glodLabel = this.glodNode.getChildByName("goldLbl").getComponent(cc.Label);
  99. Utils_1.utils.showSkipBtn(this.btnCancel);
  100. this.glodLabel.string = "/" + this.rewardValue;
  101. if (this.rewardValue == 0) {
  102. this.glodNode.active = false;
  103. }
  104. }
  105. else {
  106. this.sharePanel.active = false;
  107. this.RecPanel.active = true;
  108. this.btnCancel = this.RecPanel.getChildByName("btnCancel");
  109. this._gameList = this.RecPanel.getChildByName("PageView").getComponent(cc.PageView).content.getChildByName("Panel");
  110. this.gameItemNode = this._gameList.children[0];
  111. this._initRecPanel();
  112. Utils_1.utils.showSkipBtn(this.btnCancel);
  113. }
  114. };
  115. ShareRecordPanel.prototype._initRecPanel = function () {
  116. this._gameList.removeAllChildren();
  117. this._jumpList = Utils_1.utils.getRecommondGameList();
  118. for (var i = 0; i < this._jumpList.length; i++) {
  119. var data = this._jumpList[i];
  120. if (data && data.logo) {
  121. var tempNode = cc.instantiate(this.gameItemNode);
  122. var qcrossWidgetItem = tempNode.getComponent("QCrossWidgetItem");
  123. qcrossWidgetItem._location = YZ_Constant_1.SubLocation.isMoreGame;
  124. qcrossWidgetItem.init(data);
  125. this._gameList.addChild(tempNode);
  126. }
  127. }
  128. };
  129. ShareRecordPanel.prototype.onDestroy = function () {
  130. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Game);
  131. if (Utils_1.utils.shareRecordPanelCloseFunc) {
  132. Utils_1.utils.shareRecordPanelCloseFunc();
  133. Utils_1.utils.shareRecordPanelCloseFunc = null;
  134. ;
  135. }
  136. else {
  137. Utils_1.utils.rewardCloseFunc && Utils_1.utils.rewardCloseFunc();
  138. Utils_1.utils.rewardCloseFunc = null;
  139. }
  140. };
  141. ShareRecordPanel.prototype.onClose = function () {
  142. var _this = this;
  143. this.bg.runAction(cc.sequence(cc.scaleTo(0.3, 0).easing(cc.easeBackIn()), cc.callFunc(function () {
  144. _this.node.destroy();
  145. })));
  146. };
  147. ShareRecordPanel.prototype.onEnable = function () {
  148. var _this = this;
  149. this.bg.scale = 0;
  150. var ratio = 1;
  151. if (cc.winSize.height < cc.winSize.width) {
  152. // 横屏游戏
  153. ratio = cc.winSize.width / 1920 * 0.6;
  154. }
  155. else {
  156. ratio = cc.winSize.width / 1080;
  157. }
  158. this.bg.runAction(cc.sequence(cc.scaleTo(0.3, ratio).easing(cc.easeBackOut()), cc.callFunc(function () {
  159. if (_this.glodNode && _this.glodNode.active == true) {
  160. _this.glodNode.runAction(cc.sequence(cc.moveBy(0.3, CompatibleTool_1.default.position(0, +50)), cc.moveBy(0.3, CompatibleTool_1.default.position(0, -50))).repeatForever());
  161. }
  162. })));
  163. };
  164. // /**
  165. // * 初始化事件回调
  166. // * @param closeCallFunc
  167. // * @param rewardCallFunc
  168. // */
  169. // init(closeCallFunc: Function, rewardCallFunc: Function, reward: number) {
  170. // this.closeCallFunc = closeCallFunc;
  171. // this.rewardCallFunc = rewardCallFunc;
  172. // this.rewardValue = reward;
  173. // }
  174. ShareRecordPanel.prototype.onCancelClickListener = function () {
  175. if (PlatUtils_1.default.IsDouyin && Utils_1.utils.ServerConfig && Utils_1.utils.ServerConfig.cancel_btn_is_share && Utils_1.utils.ServerConfig.cancel_btn_is_share == "true") {
  176. Utils_1.utils.showLog("服务器配置取消按钮也会触发分享!");
  177. Utils_1.utils.share(this.rewardFunc.bind(this));
  178. }
  179. else {
  180. this.onClose();
  181. }
  182. };
  183. ShareRecordPanel.prototype.onOkBtnClickListener = function () {
  184. Utils_1.utils.share(this.rewardFunc.bind(this));
  185. };
  186. // /**
  187. // * 初始化监听事件
  188. // */
  189. // protected initListener(): void {
  190. // console.log("this.btnCancel", this.btnCancel);
  191. // this.btnCancel.on(cc.Node.EventType.TOUCH_END, (event: cc.Event) => {
  192. // this.btnCancel.runAction(cc.sequence(cc.scaleTo(0.1, 0.85), cc.scaleTo(0.1, 1), cc.callFunc(() => {
  193. // // if (utils.Tool_Douyin) {
  194. // if (PlatUtils.IsDouyin && utils.ServerConfig && utils.ServerConfig.cancel_btn_is_share && utils.ServerConfig.cancel_btn_is_share == "true") {
  195. // utils.showLog("服务器配置取消按钮也会触发分享!");
  196. // utils.share(this.rewardFunc.bind(this));
  197. // } else {
  198. // this.onClose();
  199. // }
  200. // // }
  201. // })));
  202. // });
  203. // this.btnOk && this.btnOk.on(cc.Node.EventType.TOUCH_END, (event: cc.Event) => {
  204. // this.btnOk.runAction(cc.sequence(cc.scaleTo(0.1, 0.85), cc.scaleTo(0.1, 1), cc.callFunc(() => {
  205. // utils.share(this.rewardFunc.bind(this));
  206. // })));
  207. // })
  208. // }
  209. /**
  210. * 分享回调
  211. * @param ret
  212. * @param msg
  213. */
  214. ShareRecordPanel.prototype.rewardFunc = function (ret, msg) {
  215. if (ret) {
  216. Utils_1.utils.SendEvent("结算前广告-分享弹窗-分享成功!");
  217. var result = new YZ_Constant_1.YZ_Reward();
  218. result.rewardValue = this.rewardValue;
  219. Utils_1.utils.showMsg("分享成功!奖励:+" + this.rewardValue);
  220. if (this.rewardCallFunc) {
  221. this.rewardCallFunc(result);
  222. }
  223. this.onClose();
  224. }
  225. else {
  226. Utils_1.utils.SendEvent("结算前广告-分享弹窗-分享失败!");
  227. Utils_1.utils.showMsg(msg ? msg : "分享失败!");
  228. this.onClose();
  229. }
  230. };
  231. /**
  232. * 初始化数据
  233. */
  234. ShareRecordPanel.prototype.initData = function () {
  235. };
  236. ShareRecordPanel = __decorate([
  237. ccclass
  238. ], ShareRecordPanel);
  239. return ShareRecordPanel;
  240. }(cc.Component));
  241. exports.default = ShareRecordPanel;
  242. cc._RF.pop();