8cae44b4-0b39-480d-964e-6f8f1731d59d.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. "use strict";
  2. cc._RF.push(module, '8cae4S0CzlIDZZOb48XMdWd', 'YzLoginPanel');
  3. // common-plugin/Scripts/YzLoginPanel.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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var YzLoginPanel = /** @class */ (function (_super) {
  29. __extends(YzLoginPanel, _super);
  30. function YzLoginPanel() {
  31. var _this = _super !== null && _super.apply(this, arguments) || this;
  32. _this.ratio = 1;
  33. _this.okBtn = null;
  34. _this.successFunc = null;
  35. _this.failFunc = null;
  36. return _this;
  37. // update (dt) {}
  38. }
  39. YzLoginPanel.prototype.onLoad = function () {
  40. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  41. this.node.group = Utils_1.utils.otherConfig.group;
  42. }
  43. var panel = cc.find("Panel", this.node);
  44. this.okBtn = cc.find("OKBtn", panel);
  45. if (cc.winSize.height < cc.winSize.width) {
  46. // 横屏游戏
  47. this.ratio = cc.winSize.width / 1920 * 0.75;
  48. }
  49. else {
  50. this.ratio = cc.winSize.width / 1080;
  51. }
  52. cc.find("Panel", this.node).scale = this.ratio;
  53. };
  54. YzLoginPanel.prototype.onDestroy = function () {
  55. cc.game.targetOff(this);
  56. };
  57. YzLoginPanel.prototype.onOKClickListener = function () {
  58. var _this = this;
  59. this.okBtn.getComponent(cc.Button).interactable = false;
  60. var successFunc = function () {
  61. Utils_1.utils.showLog("登录成功!");
  62. _this.successFunc && _this.successFunc();
  63. _this.node.destroy();
  64. };
  65. var failFunc = function (result) {
  66. _this.failFunc && _this.failFunc();
  67. _this.okBtn.getComponent(cc.Button).interactable = true;
  68. // utils.showMsg("登录失败,请重试");
  69. };
  70. cc.game.targetOff(this);
  71. cc.game.on(YZ_Constant_1.default.ST_LOGIN_SUCCESS, successFunc, this);
  72. cc.game.on(YZ_Constant_1.default.ST_LOGIN_FAIL, failFunc, this);
  73. Utils_1.utils.login(null, null);
  74. };
  75. YzLoginPanel.prototype.onCloseClickListener = function () {
  76. Utils_1.utils.GameExit();
  77. };
  78. YzLoginPanel = __decorate([
  79. ccclass
  80. ], YzLoginPanel);
  81. return YzLoginPanel;
  82. }(cc.Component));
  83. exports.default = YzLoginPanel;
  84. cc._RF.pop();