Commit d8fc8a8c authored by Tt's avatar Tt

获取硬币

parent 4d671167
{
"ver": "1.1.2",
"uuid": "30c39c1a-c617-465b-882f-d61ad94c8edd",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "a9b135f6-de46-4257-8be2-55dc863ce747",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
// pg.event.emit('layer_coin_show_coin')
// pg.event.on('layer_coin_show_coin_end',()=>{})
import pg from "../../scene/pg_hy17_hds";
const { ccclass, property } = cc._decorator;
@ccclass
export default class LayerCoin extends cc.Component {
private layout_center;
onLoad() {
pg.event.on('layer_coin_show_coin', (num) => { this.showCoin(num) });
this.layout_center = pg.view.find(this, 'layout_center')
}
showCoin(num) {
pg.view.visible(this.layout_center, true)
let coinAni = null;
pg.view.visible(pg.view.find(this.layout_center, "aniNode1"), false)
pg.view.visible(pg.view.find(this.layout_center, "aniNode2"), false)
pg.view.visible(pg.view.find(this.layout_center, "aniNode3"), false)
switch (num) {
case 1:
coinAni = pg.view.find(this.layout_center, "aniNode1");
coinAni.active = true;
pg.view.addEventDBAnimation(coinAni, this.hideCoin, this);
pg.view.playDBAnimation(coinAni, "one");
pg.hw.playLocalAudio('coin');
break;
case 2:
coinAni = pg.view.find(this.layout_center, "aniNode2");
coinAni.active = true;
pg.view.addEventDBAnimation(coinAni, this.hideCoin, this);
pg.view.playDBAnimation(coinAni, "two");
pg.hw.playLocalAudio('coin');
this.scheduleOnce(() => {
pg.hw.playLocalAudio('coin');
}, 0.3)
break;
case 3:
coinAni = pg.view.find(this.layout_center, "aniNode3");
coinAni.active = true;
pg.view.addEventDBAnimation(coinAni, this.hideCoin, this);
pg.view.playDBAnimation(coinAni, "three");
pg.hw.playLocalAudio('coin');
this.scheduleOnce(() => {
pg.hw.playLocalAudio('coin');
}, 0.3)
this.scheduleOnce(() => {
pg.hw.playLocalAudio('coin');
}, 0.6)
break;
}
}
hideCoin() {
this.scheduleOnce(() => {
pg.view.visible(this.layout_center, false)
pg.event.emit('layer_coin_show_coin_end')
}, 1.0)
}
}
{
"ver": "1.0.8",
"uuid": "7280210e-c21d-4ab8-a9c1-1d8727b60658",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -58,7 +58,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -58,7 +58,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
private time: cc.Node; private time: cc.Node;
private microphone_area: cc.Node; private microphone_area: cc.Node;
private coin_area: cc.Node;
initView() { initView() {
this.layer_bg = pg.view.find(this, "layer_bg") this.layer_bg = pg.view.find(this, "layer_bg")
...@@ -69,7 +68,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -69,7 +68,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.microphone_area = pg.view.find(this.sentence_box, "microphone_area"); this.microphone_area = pg.view.find(this.sentence_box, "microphone_area");
this.time_area = pg.view.find(this.microphone_area, "time_area") this.time_area = pg.view.find(this.microphone_area, "time_area")
this.time = pg.view.find(this.time_area, "time") this.time = pg.view.find(this.time_area, "time")
this.coin_area = pg.view.find(this.layer_game, "coin_area")
} }
initListener() { initListener() {
...@@ -140,8 +138,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -140,8 +138,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playBtnAudio() this.playBtnAudio()
this.initGame() this.initGame()
} }
playBtnAudio(){ playBtnAudio() {
let btn_audio = pg.view.find(this.res,"audio/btn") let btn_audio = pg.view.find(this.res, "audio/btn")
pg.audio.playLocalAudio(btn_audio) pg.audio.playLocalAudio(btn_audio)
} }
...@@ -262,9 +260,18 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -262,9 +260,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playBgAnimation(); this.playBgAnimation();
this.playVoice().then(() => { this.playVoice().then(() => {
this.stopBgAnimation(); this.stopBgAnimation();
this.showCoin(); pg.event.on('layer_coin_show_coin_end', () => {
this.hideCoin();
})
pg.event.emit('layer_coin_show_coin', 3)
}); });
} }
hideCoin() {
this.scheduleOnce(() => {
pg.view.visible(this.time_area, false)
this.initSentence();
}, 0.5)
}
playVoice() { playVoice() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// setTimeout(() => { // setTimeout(() => {
...@@ -302,27 +309,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -302,27 +309,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.visible(icon_mountain, false) pg.view.visible(icon_mountain, false)
} }
showCoin() {
pg.view.visible(this.time_area, false)
pg.view.visible(this.coin_area, true)
let coinAni = pg.view.find(this.coin_area, "coin1_ske");
pg.view.addEventDBAnimation(coinAni, this.hideCoin, this);
pg.view.playDBAnimation(coinAni, "three", 1);
pg.hw.playLocalAudio('coin');
this.scheduleOnce(() => {
pg.hw.playLocalAudio('coin');
}, 0.3)
this.scheduleOnce(() => {
pg.hw.playLocalAudio('coin');
}, 0.6)
}
hideCoin() {
this.scheduleOnce(() => {
pg.view.visible(this.time_area, false)
pg.view.visible(this.coin_area, false)
this.initSentence();
}, 0.5)
}
gameOver() { gameOver() {
pg.view.visible(this.sentence_box, false) pg.view.visible(this.sentence_box, false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment