// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.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

cc.Class({
    extends: cc.Component,

    properties: {
    },

    start() {
        this.initListeners();
    },

    initListeners() {
        const BtnAddStar = cc.find('Canvas/BtnAddStar');
        BtnAddStar.on('click', this.addStar.bind(this));
        const BtnShowStar = cc.find('Canvas/BtnShowStar');
        BtnShowStar.on('click', this.showStar.bind(this));
    },

    addStar() {
        cc.find('Canvas/StarScore').getComponent('StarScore').addStar();
    },

    showStar() {
        cc.find('Canvas/StarScore').getComponent('StarScore').showStar();
    },
});
