import auto_airdropItem from "../../../ui/uidata/Interface/auto_airdropItem"; import UIBase from "../../../framework/ui/UIBase"; import UIHelp from "../../../framework/ui/UIHelp"; import bundleManager from "../../../manager/bundleManager"; const {ccclass, menu, property} = cc._decorator; @ccclass @menu("UI/Interface/UIAirdropItem") export default class UIAirdropItem extends UIBase { ui: auto_airdropItem = null; protected static prefabUrl = "Interface/airdropItem"; protected static className = "UIAirdropItem"; @property(cc.Label) itemNameLabel: cc.Label = null; @property(cc.Sprite) itemSprite: cc.Sprite = null; @property(cc.Label) numsLabel: cc.Label = null; @property(cc.Sprite) bgSprite: cc.Sprite = null; @property(cc.SpriteFrame) bgSpriteFrames: cc.SpriteFrame []= []; onUILoad() { this.ui = this.node.addComponent(auto_airdropItem); } onShow() { } /** * * @param info 依赖item表的数据 * @param type * @param showNums */ refresh(info: any, type?: number, showNums = true) { this.itemNameLabel.string = info.itemname; if (info.resPath1) { bundleManager.setBundleFrame('UI', info.resPath1, this.itemSprite.node); } if (type != null){ this.bgSprite.spriteFrame = this.bgSpriteFrames[type]; } if (!showNums){ this.itemNameLabel.string = info.detail; this.numsLabel.node.active = false; }else { this.numsLabel.string = `X${info.nums}`; } } refreshRole(info: any) { this.itemNameLabel.string = info.itemname; this.numsLabel.string = `X${info.nums}`; if (info.roleRes) { bundleManager.setBundleFrame('UI', `man/${info.roleRes}`, this.itemSprite.node); } } onHide() { } onStart() { } onClose() { UIHelp.CloseUI(UIAirdropItem); } }