f8ae22b1-84cb-4ee3-af3b-6c02da774962.js 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. "use strict";
  2. cc._RF.push(module, 'f8ae2KxhMtO4687bALad0li', 'SkinItem');
  3. // Script/view/chooseSkin/SkinItem.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 gameScene_1 = require("../../gameScene");
  26. var App_1 = require("../../Manager/App");
  27. var DragonAnim_1 = require("../../Manager/DragonAnim");
  28. var SuperListItem_1 = require("../SuperScrollview/SuperListItem");
  29. var TipPanel_1 = require("../tipPanel/TipPanel");
  30. var TipPanelMediator_1 = require("../tipPanel/TipPanelMediator");
  31. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  32. var SkinItem = /** @class */ (function (_super) {
  33. __extends(SkinItem, _super);
  34. function SkinItem() {
  35. var _this = _super !== null && _super.apply(this, arguments) || this;
  36. _this.nameLabel = null; // 皮肤名称label(暂时隐藏)
  37. _this.texture = null; // 皮肤图片
  38. _this.dressOnBtn = null; // 选择皮肤按钮
  39. _this.noDressOnBtn = null; // 不可选择皮肤按钮
  40. _this.newTips = null;
  41. _this.datas = null;
  42. return _this;
  43. }
  44. SkinItem.prototype.setData = function (data) {
  45. // this.nameLabel.string = data.name + "";
  46. this.datas = data;
  47. var self = this;
  48. App_1.App.Facade.loadTexture('hallScene/texture/' + data.path).then(function (res) {
  49. self.texture.spriteFrame = res;
  50. });
  51. // let hasSkin = (App.DataManager.GetSkins.indexOf(data.name) != -1) ? true : false;
  52. var hasSkin = true;
  53. this.dressOnBtn.active = hasSkin;
  54. this.noDressOnBtn.active = !hasSkin;
  55. this.texture.node.color = (hasSkin) ? cc.Color.WHITE : new cc.Color(0, 0, 0, 150);
  56. this.newTips.active = (App_1.App.DataManager.NewSkinName == data.name) ? true : false;
  57. };
  58. /**
  59. * 点击穿戴按钮
  60. */
  61. SkinItem.prototype.ClickDressOn = function () {
  62. if (this.datas.name == App_1.App.DataManager.DressingSkin)
  63. return;
  64. App_1.App.DataManager.DressingSkin = this.datas.name;
  65. App_1.App.LocalStorageUtil.setString(App_1.App.LocalStorageUtil.lst_dressOnSkin, App_1.App.DataManager.DressingSkin);
  66. App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "皮肤更换成功~", false);
  67. if (gameScene_1.default.instance && gameScene_1.default.instance.node)
  68. gameScene_1.default.instance.SetDeadColor();
  69. DragonAnim_1.default.getInstance().ChangeDragonSkin();
  70. };
  71. __decorate([
  72. property(cc.Label)
  73. ], SkinItem.prototype, "nameLabel", void 0);
  74. __decorate([
  75. property(cc.Sprite)
  76. ], SkinItem.prototype, "texture", void 0);
  77. __decorate([
  78. property(cc.Node)
  79. ], SkinItem.prototype, "dressOnBtn", void 0);
  80. __decorate([
  81. property(cc.Node)
  82. ], SkinItem.prototype, "noDressOnBtn", void 0);
  83. __decorate([
  84. property(cc.Node)
  85. ], SkinItem.prototype, "newTips", void 0);
  86. SkinItem = __decorate([
  87. ccclass
  88. ], SkinItem);
  89. return SkinItem;
  90. }(SuperListItem_1.default));
  91. exports.default = SkinItem;
  92. cc._RF.pop();