import { _decorator, Component, Node, Sprite, Label, SpriteFrame } from 'cc'; import { ResourceLoader } from '../../core/resourceManager/ResourceLoader'; const { ccclass, property } = _decorator; @ccclass('ResultItem') export class ResultItem extends Component { @property({ type: ResourceLoader, tooltip: "资源加载组件" }) res: ResourceLoader; @property({ type: Sprite, tooltip: "图标" }) icon: Sprite; @property({ type: Sprite, tooltip: "碎片图标" }) chipIcon: Sprite; @property({ type: Label, tooltip: "数量" }) countLabel: Label; @property({ type: Sprite, tooltip: "底框" }) bg: Sprite; public async setData(path: string, count: string, isChip = false, color: number = 2, name: string = "") { this.countLabel.string = name + "x" + count; this.chipIcon.node.active = isChip; this.icon.spriteFrame = await this.res.load(path, SpriteFrame); this.bg.spriteFrame = await this.res.load("images/general/texture/zy_head" + color + "/spriteFrame", SpriteFrame); } }