import { _decorator, Component, Label, Node, Sprite } from 'cc';
import { tools } from '../../tools';
import { mail_rewards_item_data } from '../../data';
const { ccclass, property } = _decorator;

@ccclass('reward_tips_item')
export class reward_tips_item extends Component {
    @property(Node) img_icon:Node = null
    @property(Node) lab_name:Node = null
    @property(Node) lab_count:Node = null

    initView(data:mail_rewards_item_data) {
        tools.loadRemoteImg(data.icon, (r)=>{
            this.img_icon.getComponent(Sprite).spriteFrame = r.sf
        })
        this.lab_name.getComponent(Label).string = data.name
        this.lab_count.getComponent(Label).string = `x${data.quantity}` 
    }
}

