123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import gameScene from "../../gameScene";
- import hallScene from "../../hallScene";
- import { App } from "../../Manager/App";
- import DragonAnim from "../../Manager/DragonAnim";
- import SuperListItem from "../SuperScrollview/SuperListItem";
- import TipPanel from "../tipPanel/TipPanel";
- import TipPanelMediator from "../tipPanel/TipPanelMediator";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class SkinItem extends SuperListItem {
- @property(cc.Label)
- nameLabel: cc.Label = null; // 皮肤名称label(暂时隐藏)
- @property(cc.Sprite)
- texture: cc.Sprite = null;// 皮肤图片
- @property(cc.Node)
- dressOnBtn: cc.Node = null;// 选择皮肤按钮
- @property(cc.Node)
- noDressOnBtn: cc.Node = null;// 不可选择皮肤按钮
- @property(cc.Node)
- newTips: cc.Node = null;
- private datas: any = null;
- public setData(data: any) {
- // this.nameLabel.string = data.name + "";
- this.datas = data;
- var self = this;
- App.Facade.loadTexture('hallScene/texture/' + data.path).then((res: any) => {
- self.texture.spriteFrame = res;
- });
- // let hasSkin = (App.DataManager.GetSkins.indexOf(data.name) != -1) ? true : false;
- let 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.DataManager.NewSkinName == data.name) ? true : false;
- }
- /**
- * 点击穿戴按钮
- */
- public ClickDressOn() {
- if (this.datas.name == App.DataManager.DressingSkin) return;
- App.DataManager.DressingSkin = this.datas.name;
- App.LocalStorageUtil.setString(App.LocalStorageUtil.lst_dressOnSkin, App.DataManager.DressingSkin);
- App.Facade.popView(TipPanelMediator, TipPanel, "皮肤更换成功~", false);
- if (gameScene.instance && gameScene.instance.node) gameScene.instance.SetDeadColor();
- DragonAnim.getInstance().ChangeDragonSkin();
- }
- }
|