import { _decorator, Component, Node, Sprite } from 'cc';
import { bag_item_data } from '../../../data/data';
import { gameManager } from '../gameManager';
const { ccclass, property } = _decorator;

@ccclass('widget_info')
export class widget_info extends Component {
    @property(Node) btn_back:Node = null;
    @property(Node) icon:Node = null;
    public show(data:bag_item_data){
        this.node.active = true;
        this.icon.getComponent(Sprite).spriteFrame = gameManager.getCacheSpriteFrameByName(data.url)
        this.btn_back.off(Node.EventType.TOUCH_END)
        this.btn_back.on(Node.EventType.TOUCH_END,()=>{
            this.hide()
        })
    }

    public hide(){
        this.node.active = false;
    }
}


