898da37f-d2e4-4f46-a472-6d84b82df84a.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. "use strict";
  2. cc._RF.push(module, '898daN/0uRPRqRybYS4LfhK', 'YZ_BaiduRecommendWidget');
  3. // common-plugin/Scripts/YZ_BaiduRecommendWidget.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 PlatUtils_1 = require("./PlatUtils");
  26. var Utils_1 = require("./Utils");
  27. var CompatibleTool_1 = require("./CompatibleTool");
  28. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  29. var YZ_BaiduRecommendWidget = /** @class */ (function (_super) {
  30. __extends(YZ_BaiduRecommendWidget, _super);
  31. function YZ_BaiduRecommendWidget() {
  32. var _this = _super !== null && _super.apply(this, arguments) || this;
  33. _this._widget = null;
  34. return _this;
  35. }
  36. YZ_BaiduRecommendWidget.prototype.onLoad = function () {
  37. this._widget = this.getComponent(cc.Widget);
  38. };
  39. YZ_BaiduRecommendWidget.prototype.onEnable = function () {
  40. this.getComponent(cc.Sprite).enabled = false;
  41. if (!PlatUtils_1.default.IsBaidu || !(PlatUtils_1.default.IsBaidu && Utils_1.utils.Tool_Baidu && Utils_1.utils.Tool_Baidu.canShowRecommendButton())) {
  42. Utils_1.utils.showLog("不支持交叉推广组件!");
  43. this.node.destroy();
  44. }
  45. else {
  46. if (PlatUtils_1.default.IsBaidu && Utils_1.utils.Tool_Baidu && Utils_1.utils.Tool_Baidu.canShowRecommendButton()) {
  47. if (this._widget) {
  48. Utils_1.utils.Tool_Baidu.showRecommendationButton(CompatibleTool_1.default.position(this._widget.left, this._widget.top));
  49. }
  50. else {
  51. Utils_1.utils.showLog("baidu recommend button widget component is null");
  52. }
  53. }
  54. }
  55. };
  56. YZ_BaiduRecommendWidget.prototype.onDisable = function () {
  57. if (PlatUtils_1.default.IsBaidu && Utils_1.utils.Tool_Baidu && Utils_1.utils.Tool_Baidu.canShowRecommendButton()) {
  58. }
  59. };
  60. YZ_BaiduRecommendWidget = __decorate([
  61. ccclass
  62. ], YZ_BaiduRecommendWidget);
  63. return YZ_BaiduRecommendWidget;
  64. }(cc.Component));
  65. exports.default = YZ_BaiduRecommendWidget;
  66. cc._RF.pop();