You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
3.2 KiB
86 lines
3.2 KiB
//#region 文件引入
|
|
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, SpriteFrame } from "cc";
|
|
import UIParse from "../../Mgr_UI/UIParse";
|
|
import { IData, IItemsData } from "../../const/GameInterface";
|
|
import { IItems } from "../../Mgr_CSV/CsvEnum";
|
|
import { GameTotalType, ITEM_TYPE } from "../../const/GameEnum";
|
|
//#endregion 文件引入
|
|
const {ccclass, property,menu} = _decorator;
|
|
@ccclass("BagListItem_Proxy")
|
|
export default class BagListItem_Proxy extends UIParse{
|
|
//#region 节点自动生成
|
|
@property(Sprite)
|
|
spr_bg: Sprite = null;
|
|
@property(Sprite)
|
|
spr_itembg: Sprite = null;
|
|
@property(Sprite)
|
|
spr_icon: Sprite = null;
|
|
@property(sp.Skeleton)
|
|
spi_redlight: sp.Skeleton = null;
|
|
@property(Label)
|
|
lab_type: Label = null;
|
|
@property(Node)
|
|
n_weared: Node = null;
|
|
@property(Label)
|
|
lab_Name: Label = null;
|
|
@property(Node)
|
|
n_red: Node = null;
|
|
@property(Node)
|
|
n_merge: Node = null;
|
|
//#endregion 节点自动生成
|
|
@property(SpriteFrame)
|
|
protected mShow: SpriteFrame;
|
|
@property(SpriteFrame)
|
|
protected mHide: SpriteFrame;
|
|
private _isShow:boolean = false;
|
|
|
|
@property({type:[SpriteFrame]})
|
|
protected mBgs: SpriteFrame[] = [];
|
|
|
|
onButtonClick(button:Button){
|
|
|
|
/**点击事件触发*/
|
|
switch (button) {
|
|
default:
|
|
ConsoleEx.Log(button);
|
|
break;
|
|
}
|
|
}
|
|
setShow(isShow: boolean) {
|
|
if (this._isShow == isShow) { return; }
|
|
this._isShow = isShow;
|
|
this.spr_bg.spriteFrame = this._isShow ? this.mShow : this.mHide;
|
|
// CNodeUtils.setActive(this.n_Select, isShow);
|
|
}
|
|
|
|
setInfo(cfg: IItems, item: IItemsData){
|
|
const itemname = cfg.type == (ITEM_TYPE.WUGONG || ITEM_TYPE.PAINTING) ? ("《" + cfg.name + "》") : cfg.name;
|
|
CNodeUtils.switchTextByQuality(this.lab_Name, itemname, cfg.quality);
|
|
CNodeUtils.switchText(this.lab_type, cfg.typeName);
|
|
CNodeUtils.setActive(this.n_red, item.isnew);
|
|
CNodeUtils.setActive(this.n_weared, item.weared);
|
|
// 显示合并图标
|
|
const canmerge = this.mDataMgr.Bag.checkBookCanMerge(cfg);
|
|
CNodeUtils.setActive(this.n_merge, canmerge);
|
|
|
|
// 道具图片
|
|
this.spr_itembg.spriteFrame = this.mBgs[cfg.quality - 1];
|
|
const iData:IData = {
|
|
type: GameTotalType.ITEM,
|
|
id: item.id,
|
|
num:1,
|
|
}
|
|
CNodeUtils.SwitchTextureByData(this.spr_icon, iData);
|
|
// 品质特效
|
|
// if(cfg.quality === 6){
|
|
// CNodeUtils.setActive(this.spi_redlight, true);
|
|
// this.spi_redlight.setAnimation(0, "idle", true);
|
|
// }else{
|
|
// CNodeUtils.setActive(this.spi_redlight, false);
|
|
// }
|
|
}
|
|
|
|
setNew(isNew: boolean) {
|
|
CNodeUtils.setActive(this.n_red, isNew);
|
|
}
|
|
}
|