class UI_ChipItem extends UIBaseComponent {
	private chipItemImage: eui.Image;
	private labelDisplay: eui.Label;
	public type: number;//[0,1,2,3,4]//1:庄,0:闲,2:和,4:庄对,3:闲对
	public chipValue: number;
	public size: number;//1:小筹码 2:大筹码
	public constructor(chipValue: number, size: number) {
		super();
		this.chipValue = chipValue;
		this.size = size;
	}

	/**
	 * 绑定事件
	 */
	protected bindEvents(): void {
		super.bindEvents();
	}

	/**
	 * 创建完成时调用
	 */
	protected onCreate(): void {
		super.onCreate();
		this.render();
		this.onLangChange();
	}

	/**
	 * 渲染UI时调用
	 */
	protected render(): void {
		this.anchorOffsetX = this.width / 2;
		this.anchorOffsetY = this.height / 2;
		let config = chipConfig.filter(config => {
			return config.value == this.chipValue;
		}).pop();

		this.chipItemImage.source = config.bg;
		this.chipItemImage.scaleX = this.size == CHIPSIZE.LARGE ? 1 : 0.7;
		this.chipItemImage.scaleY = this.chipItemImage.scaleX;
		this.labelDisplay.size = 18 * this.chipItemImage.scaleX;
		this.labelDisplay.text = config.value.toString();
		this.labelDisplay.textColor = config.color;
	}

	/**
	 * 改变语言时调用
	 */
	protected onLangChange(ev?: egret.Event): void {
	}

	/**
	 * 界面关闭时调用
	 */
	public onClose(): void {
	}
}