import { _decorator, Label, Node, Sprite, SpriteFrame } from 'cc';
import { ResKeeper } from '../../../framework/res/ResKeeper';
const { ccclass, property } = _decorator;

@ccclass('CommonItem')
export class CommonItem extends ResKeeper {
	@property({ type: Sprite, tooltip: "背景" })
	farmeBg: Sprite = null;

	@property({ type: Label, tooltip: "数量" })
	numTx: Label = null;

	@property({ type: Sprite, tooltip: "图标" })
	icoImg: Sprite = null;

	@property({ type: Node, tooltip: "选中效果" })
	selectBg: Node = null;

	@property({ type: [SpriteFrame], tooltip: "背景图" })
	bgFrame: SpriteFrame[] = [];

	private data = null;

	protected onLoad() {

	}

	protected onDestroy() {
		//如果该组件有事件自行取消注释
		//Framework.event.removeEvent(this);
		super.onDestroy();
	}

	//如果使用了池中的节点,在该函数内归还,该函数会在onDestroy前调用
	onClose() {

	}

	//UI事件处理
	private onTouchButton(event: Event) {
		//Framework.audio.playEffect(AudioID.Click);
		let target: any = event.target;
	}

	refreshItem(data) {
		this.data = data;
	}

	onClick() {

	}
}