import Scene from "./Scene";
import submit from "../../new_tw/ctrls/submit";
import Panel from "./Panel";
import { DataManager } from "../../tw/manager/DataManager";
import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import showAlertPanel from "../ctrls/showAlertPanel";
import { NetManager } from "../../tw/index";
import { Buried } from "../../tw/index";
import SceneCtrl from "./../../new_wx/ctrls/sceneCtrl";
export default class PlaySceneBase extends Scene {

    public exemptionTxt:eui.Label;
    public recordBtn:eui.Button;
    public ruleBtn:eui.Button;
    public image:eui.Image;
    public image0:eui.Image;
    public image3:eui.Image;
    public image2:eui.Image;
    public image1:eui.Image;
    public image4:eui.Image;
    public image5:eui.Image;
    public image6:eui.Image;
    public image8:eui.Image;
    public image7:eui.Image;
    public playTips:eui.Image;

    score = 0;

    clearTime=[]
    playAnimation() {

      if(!localStorage.firstTipsUIStatus){
          localStorage.firstTipsUIStatus="1"
      }else{
        this.playTips.visible=false;
      }
    
    }

    initEvents(){
        super.initEvents();
        this.playTips.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTap_playTips,this)
    }

    private onTap_playTips(){
        // NetManager.ins.clickLog(this.exposure["tips"]);
        this.playTips.visible=false;
    }

    exposure=[]



    sendSubmit() {

       // NetManager.ins.gameSubmit(()=>{},DataManager.ins.doStartData.ticketId)
        submit((success) => {
           // alert(success)
           if(success){
               if(DataManager.ins.gameGetSubmitResultData.flag==true){
                // this.doBuried2()
                let panel = showAlertPanel("啊哦~网络异常\n请到[我的奖品]查看是否中奖吧");
                panel.addEventListener('onDestroy', () => {
                    // NetManager.ins.clickLog(this.exposure["getSubmitResult"]);
                    NetManager.ins.getInfo(() => {
                        SceneCtrl.instance.change(ModuleTypes.START_SCENE);
                    })
                }, this)
               }else{
                    let panel: Panel;
                    panel = PanelCtrl.instance.show(ModuleTypes.BOX_PANEL)
               }
           }
          

        }, this.score)
    }
    get skinKey() { return 'Play' }
}