LayerOver.js 1.04 KB
Newer Older
asdf's avatar
.  
asdf committed
1 2 3 4 5 6
const { showFireworks } = require("./utils");

cc.Class({
    extends: cc.Component,

    properties: {
asdf's avatar
asdf committed
7
        audOver:cc.AudioClip,
asdf's avatar
.  
asdf committed
8 9 10 11
    },

    // LIFE-CYCLE CALLBACKS:

asdf's avatar
asdf committed
12
    onLoad() {
asdf's avatar
.  
asdf committed
13 14 15
        this.node.getChildByName('bg_verygood').zIndex = 99;
    },

asdf's avatar
asdf committed
16
    start() {
asdf's avatar
.  
asdf committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
        showFireworks(
            this.node,
            this.node.getChildByName('RibbonNodeBase').children,
            cc.v2(0, -400), cc.v2(0, 1000), 200, 200
        );
        showFireworks(
            this.node,
            this.node.getChildByName('RibbonNodeBase').children,
            cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
        );
        showFireworks(
            this.node,
            this.node.getChildByName('RibbonNodeBase').children,
            cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
        );
asdf's avatar
asdf committed
32
        this.playAudioOver();
asdf's avatar
.  
asdf committed
33 34
    },

asdf's avatar
asdf committed
35 36 37 38 39 40 41
    playAudioOver() {
		GameData.isAudio = true;
		let id = cc.audioEngine.play(this.audOver, false, 1);
		cc.audioEngine.setFinishCallback(id, () => {
			GameData.isAudio = false;
		})
    },
asdf's avatar
.  
asdf committed
42 43
    // update (dt) {},
});