// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import JiaZai from "./JiaZai";
import MapConroler from "./Map";
import SceneManager from "./SceneManager";
import { MiniGameSdk } from "./Sdk/MiniGameSdk";


const { ccclass, property } = cc._decorator;


@ccclass
export default class gameOverUi extends cc.Component {
    static _instance: any;
    time: number = 0;

    @property(cc.Node)
    music: cc.Node = null;

    @property(cc.Node)
    effect: cc.Node = null;

    @property(cc.Node)
    vibrate: cc.Node = null;

    @property(cc.Node)
    exit: cc.Node = null;

    @property(cc.Node)
    win: cc.Node = null;

    musicState: boolean = true;
    effectState: boolean = true;
    vibrateState: boolean = true;
    onLoad() {
        this.node.on(cc.Node.EventType.TOUCH_START, this.touchStart, this);
        this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMove, this);
        this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchEnd, this);
        this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this);
    }

    start() {
    }

    touchStart(event: cc.Event.EventTouch) {
        this.node.parent.opacity = 0;
    }

    touchMove(event: cc.Event.EventTouch) {
        this.node.parent.opacity = 0;
    }

    touchEnd(event: cc.Event.EventTouch) {
        this.node.parent.opacity = 255;
    }


    //关闭ui
    closeUi() {
        cc.fx.AudioManager._instance.playEffect("anniu_little", null);
        cc.fx.AudioManager._instance.playEffect("anniu_little", null);
        this.node.active = false;
    }

    // update (dt) {}
}
