import Panel from "../../MVC/views/Panel";
import { GDispatcher } from "../../../libs/tc/util/GDispatcher";

export default class CreditsTipPanel extends Panel {
	public ok_btn: eui.Button;
	public closeBtn: eui.Button;

	public get skinKey() { return 'CreditsTipPanel' }
	public get groupName() { return 'creditsTip_panel' }
	constructor(data?) {
		super(data);

	}
	initEvents() {
		this.ok_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touch_tap_ok_btn, this);
		this.closeBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
	}

	touch_tap_ok_btn(){
		GDispatcher.dispatchEvent('queryPrize');
		this.onTouchTap();
	}

	removeEvents() {
		this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.touch_tap_ok_btn, this);
		this.closeBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap, this);
	}

	protected onSkinComplete(): void {
		super.onSkinComplete();

		this.preLoadRes();		
	}

	protected async preLoadRes() {


		return new Promise(function (resolve, reject) {
			resolve();
		});
	}
}