"use strict"; cc._RF.push(module, 'f8ae2KxhMtO4687bALad0li', 'SkinItem'); // Script/view/chooseSkin/SkinItem.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var gameScene_1 = require("../../gameScene"); var App_1 = require("../../Manager/App"); var DragonAnim_1 = require("../../Manager/DragonAnim"); var SuperListItem_1 = require("../SuperScrollview/SuperListItem"); var TipPanel_1 = require("../tipPanel/TipPanel"); var TipPanelMediator_1 = require("../tipPanel/TipPanelMediator"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var SkinItem = /** @class */ (function (_super) { __extends(SkinItem, _super); function SkinItem() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.nameLabel = null; // 皮肤名称label(暂时隐藏) _this.texture = null; // 皮肤图片 _this.dressOnBtn = null; // 选择皮肤按钮 _this.noDressOnBtn = null; // 不可选择皮肤按钮 _this.newTips = null; _this.datas = null; return _this; } SkinItem.prototype.setData = function (data) { // this.nameLabel.string = data.name + ""; this.datas = data; var self = this; App_1.App.Facade.loadTexture('hallScene/texture/' + data.path).then(function (res) { self.texture.spriteFrame = res; }); // let hasSkin = (App.DataManager.GetSkins.indexOf(data.name) != -1) ? true : false; var hasSkin = true; this.dressOnBtn.active = hasSkin; this.noDressOnBtn.active = !hasSkin; this.texture.node.color = (hasSkin) ? cc.Color.WHITE : new cc.Color(0, 0, 0, 150); this.newTips.active = (App_1.App.DataManager.NewSkinName == data.name) ? true : false; }; /** * 点击穿戴按钮 */ SkinItem.prototype.ClickDressOn = function () { if (this.datas.name == App_1.App.DataManager.DressingSkin) return; App_1.App.DataManager.DressingSkin = this.datas.name; App_1.App.LocalStorageUtil.setString(App_1.App.LocalStorageUtil.lst_dressOnSkin, App_1.App.DataManager.DressingSkin); App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "皮肤更换成功~", false); if (gameScene_1.default.instance && gameScene_1.default.instance.node) gameScene_1.default.instance.SetDeadColor(); DragonAnim_1.default.getInstance().ChangeDragonSkin(); }; __decorate([ property(cc.Label) ], SkinItem.prototype, "nameLabel", void 0); __decorate([ property(cc.Sprite) ], SkinItem.prototype, "texture", void 0); __decorate([ property(cc.Node) ], SkinItem.prototype, "dressOnBtn", void 0); __decorate([ property(cc.Node) ], SkinItem.prototype, "noDressOnBtn", void 0); __decorate([ property(cc.Node) ], SkinItem.prototype, "newTips", void 0); SkinItem = __decorate([ ccclass ], SkinItem); return SkinItem; }(SuperListItem_1.default)); exports.default = SkinItem; cc._RF.pop();