// 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

const { ccclass, property } = cc._decorator;

@ccclass
export default class GuideAuthUI extends cc.Component {

    @property(cc.Node)
    node_rectBg: cc.Node = null;
    @property(cc.Node)
    node_bottom: cc.Node = null;
    @property(cc.Node)
    node_authBtn: cc.Node = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {
        this.node_rectBg.setContentSize(cc.winSize.width, cc.winSize.height);
        this.initEvent();
    }

    onEnable() {
        this.node_bottom.y = -cc.winSize.height * 0.5 - this.node_bottom.height * 0.5 - 10;
        let endY = -cc.winSize.height * 0.5 + this.node_bottom.height * 0.5
        // cc.tween(this.node_bottom).to(0.2, { y: endY, ease: cc.easeBackOut }).start();
    }

    // update (dt) {}

    initEvent() {
        this.node_rectBg.on(cc.Node.EventType.TOUCH_END, this.onClickAuthBtn, this);
        this.node_authBtn.on(cc.Node.EventType.TOUCH_END, this.onClickAuthBtn, this);
    }

    onClickBg() {
        // this.node.active = true;
        mk.ui.closePanel("GuideAuthUI")
    }

    onClickAuthBtn() {
        // this.node.active = false;
        mk.ui.closePanel("GuideAuthUI")
        // JsbMgr.WxAuth();
    }
}
