import { ModuleTypes } from './../types/sceneTypes';
import { NetManager } from "../../libs/tw/manager/NetManager";
import Panel from "../views/Panel";
import SceneCtrl from '../ctrls/sceneCtrl';

import { Buried } from "../../libs/tw/util/Buried";

export default class PunchCardFailPanel extends Panel {

    protected get skinKey() { return 'PunchCardFail' }

    private scene: any;

    //埋点
    private exposure;

    start(data?) {
        this.scene = data ? data.scene : null;
        this.initBuired();
    }

    initBuired() {
        var dpm = Buried.connectDpm(40, 6, 4);
        var num;
        switch (window["currentPigData"].identifier) {
            case "wastonA":
                num = 1;
                break;
            case "wastonB":
                num = 2;
                break;
            case "wastonC":
                num = 3;
                break;
        }
        var dcm = Buried.connectDcm(230, window['skinID'], num);
        this.exposure = Buried.createExposure(dpm, dcm);

        //曝光
        NetManager.ins.showLog(this.exposure);
    }

    public rePunchCardBtn: eui.Button;
    initEvents() {
        this.rePunchCardBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_rePunchCardBtn, this);
    }

    private onTap_rePunchCardBtn() {
        //点击埋点
        NetManager.ins.clickLog(this.exposure);

        this.hidePanel();
        // 调用场景里的打卡功能
        this.scene.doSign();
    }

}