import { _decorator, Sprite, Label, assetManager, ImageAsset, SpriteFrame, Texture2D } from 'cc'; import InfiniteCell from '../../core/InfiniteList/InfiniteCell'; import { ResourcesUtils } from '../../core/resourceManager/ResourcesUtils'; import { BitmapFont } from '../../core/ui/BitmapFont'; const { ccclass, property } = _decorator; @ccclass('ChildListItem') export class ChildListItem extends InfiniteCell { @property({ type: Sprite, tooltip: "头像" }) head: Sprite; @property({ type: Label, tooltip: "昵称" }) nickNameLabel: Label; @property({ type: BitmapFont, tooltip: "贡献" }) gxLabel: BitmapFont; start() { } async UpdateContent(itemData: any) { if (itemData.avatar) { let img = await ResourcesUtils.loadRemote(itemData.avatar, { ext: ".png" }, this); const spriteFrame = new SpriteFrame(); const texture = new Texture2D(); texture.image = img; spriteFrame.texture = texture; this.head.spriteFrame = spriteFrame; } this.nickNameLabel.string = itemData.nickname; this.gxLabel.string = itemData.totalRevenueAmount == 0 ? "0" : itemData.totalRevenueAmount + ""; } }