462c2209-5f5f-4ef9-996a-229dc27207b9.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. "use strict";
  2. cc._RF.push(module, '462c2IJX19O+ZlqIp3Ccge5', 'MissionItem');
  3. // Script/view/missionPanel/MissionItem.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 (Object.prototype.hasOwnProperty.call(b, 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 App_1 = require("../../Manager/App");
  26. var hallModel_1 = require("../../model/hallModel");
  27. var SuperListItem_1 = require("../SuperScrollview/SuperListItem");
  28. var TipPanel_1 = require("../tipPanel/TipPanel");
  29. var TipPanelMediator_1 = require("../tipPanel/TipPanelMediator");
  30. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  31. var MissionItem = /** @class */ (function (_super) {
  32. __extends(MissionItem, _super);
  33. function MissionItem() {
  34. var _this = _super !== null && _super.apply(this, arguments) || this;
  35. _this.textLabel = null;
  36. _this.processLabel = null;
  37. _this.coinnumLabel = null;
  38. _this.diamondLabel = null;
  39. _this.progress = null;
  40. _this.misOver = false;
  41. _this.m_index = 0;
  42. return _this;
  43. }
  44. MissionItem.prototype.setData = function (tag) {
  45. var _this = this;
  46. this.m_index = tag;
  47. this.refresh();
  48. this.node.on(cc.Node.EventType.TOUCH_END, function () {
  49. if (!_this.misOver) {
  50. return;
  51. }
  52. var missionReceiveNum = App_1.App.DataManager.MissionReceive[_this.m_index];
  53. if (missionReceiveNum >= App_1.App.DataManager.MissionDataList[_this.m_index].missonNum.length) {
  54. App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "已经获得最高奖励", false);
  55. return;
  56. }
  57. App_1.App.DataManager.UserCoin += App_1.App.DataManager.MissionDataList[_this.m_index].rewardCoin[missionReceiveNum];
  58. App_1.App.DataManager.UserDiamond += App_1.App.DataManager.MissionDataList[_this.m_index].rewardDiamon[missionReceiveNum];
  59. App_1.App.Facade.getModel(hallModel_1.default).updateCoinNumber();
  60. App_1.App.Facade.getModel(hallModel_1.default).updateDiamond();
  61. App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "领取成功", false);
  62. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin);
  63. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_UserDiamond, App_1.App.DataManager.UserDiamond);
  64. App_1.App.DataManager.MissionReceive[_this.m_index]++;
  65. App_1.App.LocalStorageUtil.setJsonObj(App_1.App.LocalStorageUtil.list_missionReceive, App_1.App.DataManager.MissionReceive);
  66. _this.refresh();
  67. }, this);
  68. // let passNum = Object.keys(App.DataManager.PassProgress).length - 1;
  69. // App.Facade.loadTexture('hallScene/texture/skin/' + data.getSkin).then((res: any) => {
  70. // self.texture.spriteFrame = res;
  71. // });
  72. };
  73. MissionItem.prototype.refresh = function () {
  74. var missionReceiveNum = App_1.App.DataManager.MissionReceive[this.m_index];
  75. if (missionReceiveNum >= App_1.App.DataManager.MissionDataList[this.m_index].missonNum.length) {
  76. App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "已经获得最高奖励", false);
  77. return;
  78. }
  79. // 具体任务
  80. this.textLabel.string = App_1.App.DataManager.MissionName[this.m_index].replace("%d", App_1.App.DataManager.MissionDataList[this.m_index].missonNum[missionReceiveNum].toString());
  81. // 完成进度数字
  82. this.processLabel.string = App_1.App.DataManager.MissionComplete[this.m_index] + "/" + App_1.App.DataManager.MissionDataList[this.m_index].missonNum[missionReceiveNum];
  83. // 奖励金币
  84. this.coinnumLabel.string = App_1.App.DataManager.MissionDataList[this.m_index].rewardCoin[missionReceiveNum].toString();
  85. // 奖励钻石
  86. this.diamondLabel.string = App_1.App.DataManager.MissionDataList[this.m_index].rewardDiamon[missionReceiveNum].toString();
  87. // 是否完成了这个任务
  88. this.misOver = App_1.App.DataManager.MissionComplete[this.m_index] >= App_1.App.DataManager.MissionDataList[this.m_index].missonNum[missionReceiveNum];
  89. // 完成进度
  90. this.progress.progress = App_1.App.DataManager.MissionComplete[this.m_index] / App_1.App.DataManager.MissionDataList[this.m_index].missonNum[missionReceiveNum];
  91. };
  92. __decorate([
  93. property(cc.Label)
  94. ], MissionItem.prototype, "textLabel", void 0);
  95. __decorate([
  96. property(cc.Label)
  97. ], MissionItem.prototype, "processLabel", void 0);
  98. __decorate([
  99. property(cc.Label)
  100. ], MissionItem.prototype, "coinnumLabel", void 0);
  101. __decorate([
  102. property(cc.Label)
  103. ], MissionItem.prototype, "diamondLabel", void 0);
  104. __decorate([
  105. property(cc.ProgressBar)
  106. ], MissionItem.prototype, "progress", void 0);
  107. MissionItem = __decorate([
  108. ccclass
  109. ], MissionItem);
  110. return MissionItem;
  111. }(SuperListItem_1.default));
  112. exports.default = MissionItem;
  113. cc._RF.pop();