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

export default class Start1Scene extends Scene {
    async start(d?) {
        this.showlog();

        super.start();
        this['scroll'].height = this.stage.stageHeight;

        this['btn0'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap0, this);
        this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap1, this);
        this['btn2'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap2, this);
        this['btn3'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap3, this);

        [this['btn0'],this['btn1'],this['btn2'],this['btn3']].forEach(btn=>{
            egret.Tween.get(btn,{loop:true})
            .to({scaleX:1.1,scaleY:1.1},200)
            .to({scaleX:1,scaleY:1},200)
            .to({scaleX:1.1,scaleY:1.1},200)
            .to({scaleX:1,scaleY:1},200)
            .wait(1000);
        });
    }

    onTap0(){
        console.log(0);
        location.href = window['link0'];
    }

    onTap1(){
        console.log(1);
        location.href = window['link1'];
    }

    onTap2(){
        console.log(2);
        location.href = window['link2'];
    }

    onTap3(){
        console.log(3);
        location.href = window['link3'];
    }

    initEvents() {
        // this.ruleBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ruleBtn, this);
    }

    onTap_giftbtn() {

    }


    get skinKey() { return 'Start1' }

    showlog() {
        // NetManager.ins.showLog(getlogItem(3));
    }
}

export const getlogItem = (i) => {
    const Dpm = Buried.connectDpm(110, i, 1); // 点击埋点
    const Dcm = Buried.connectDcm(202, 0, 0); // 曝光埋点
    return Buried.createExposure(Dpm, Dcm);
}