Commit 55791699 authored by Tt's avatar Tt

增加音效等

parent c55a89be
{
"ver": "2.0.1",
"uuid": "8e3a610f-5635-4988-b325-e261358b7daf",
"downloadMode": 0,
"duration": 0.264,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b9897e46-e174-4e8e-8062-8eefef2fc098",
"downloadMode": 0,
"duration": 4.04898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "805f289a-fdc6-46cd-8853-ab90f5423f80",
"downloadMode": 0,
"duration": 0.470204,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "aebb98ed-7b40-4881-b30a-efdcaa131716",
"downloadMode": 0,
"duration": 0.548571,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "228a9d13-2031-4da7-9570-e1fb67ab6b7b",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -3,6 +3,9 @@ import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; ...@@ -3,6 +3,9 @@ import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import { Item, Part, Game } from "./model/game"; import { Item, Part, Game } from "./model/game";
import pg from "./pg"; import pg from "./pg";
import Ani from "./ani"; import Ani from "./ani";
import {
showFireworks,
} from '../script/utils';
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
enum STATE { enum STATE {
...@@ -49,18 +52,26 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -49,18 +52,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
initEvent() { initEvent() {
let btn_start: cc.Node = pg.view.find(this, "btn_start"); let btn_start: cc.Node = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart");
let btn_stem: cc.Node = pg.view.find(this, "btn_stem"); let btn_stem: cc.Node = pg.view.find(this, "btn_stem");
pg.view.touchOn(btn_start, this.onBtnStart, this); pg.view.touchOn(btn_start, this.onBtnStart, this);
pg.view.touchOn(btn_restart, this.onBtnRestart, this);
pg.view.touchOn(btn_stem, this.onBtnStem, this); pg.view.touchOn(btn_stem, this.onBtnStem, this);
} }
onBtnStart() { onBtnStart() {
this.playLocalAudio("start");
let btn_start: cc.Node = pg.view.find(this, "btn_start"); let btn_start: cc.Node = pg.view.find(this, "btn_start");
//执行开始单个游戏开始 //执行开始单个游戏开始
cc.tween(btn_start).by(0.3, { x: 1500 }).call(() => { cc.tween(btn_start).by(0.3, { x: 1500 }).call(() => {
this.updateState(1); this.updateState(1);
}).start(); }).start();
} }
onBtnRestart() {
this.playLocalAudio("start");
Game.getIns().current = 0;
this.updateState(1);
}
nextPart() { nextPart() {
Game.getIns().current++; Game.getIns().current++;
this.updateState(1); this.updateState(1);
...@@ -78,12 +89,18 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -78,12 +89,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
updateWait() { updateWait() {
let btn_start: any; let btn_start: any = pg.view.find(this, "btn_start");
let panel_percent: cc.Node; let panel_gary = pg.view.find(this, "panel_gary");
pg.view.visible(btn_start, true); pg.view.visible(btn_start, true);
pg.view.visible(panel_percent, true); pg.view.visible(panel_gary, true);
this.updatePartPercent(); this.updatePartPercent();
} }
updateRestart() {
let btn_restart = pg.view.find(this, "btn_restart");
let panel_gary = pg.view.find(this, "panel_gary");
btn_restart.active = true;
panel_gary.active = true;
}
private part: Part; private part: Part;
private playing: number; private playing: number;
initPartData() { initPartData() {
...@@ -91,10 +108,19 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -91,10 +108,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playing = STATE.WAITING; this.playing = STATE.WAITING;
} }
updatePart() { updatePart() {
if (!this.part) return; if (!this.part) {
//出现重新开始的按钮
this.showFireFlower().then(() => {
this.updateRestart();
onHomeworkFinish();
});
return;
}
pg.view.visible(pg.view.find(this, "btn_start"), false); pg.view.visible(pg.view.find(this, "btn_start"), false);
pg.view.visible(pg.view.find(this, "btn_restart"), false);
pg.view.visible(pg.view.find(this, "panel_gary"), false); pg.view.visible(pg.view.find(this, "panel_gary"), false);
pg.view.visible(pg.view.find(this, "btn_stem/icon_hand"), true); let btn_stem: cc.Node = pg.view.find(this, "btn_stem");
pg.view.visible(pg.view.find(btn_stem, "icon_hand"), true);
this.updatePartPercent(); this.updatePartPercent();
this.updateBtnStem(); this.updateBtnStem();
this.updateList(); this.updateList();
...@@ -171,7 +197,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -171,7 +197,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
item.data = data; item.data = data;
} }
updatePerson() { updatePerson(noAni: boolean = false) {
let img_person: cc.Node = pg.view.find(this, "img_person"); let img_person: cc.Node = pg.view.find(this, "img_person");
img_person.active = true; img_person.active = true;
img_person.x = 0; img_person.x = 0;
...@@ -181,8 +207,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -181,8 +207,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
img_person.on(cc.Node.EventType.TOUCH_MOVE, this.onImgPersonMove, this); img_person.on(cc.Node.EventType.TOUCH_MOVE, this.onImgPersonMove, this);
img_person.on(cc.Node.EventType.TOUCH_END, this.onImgPersonEnd, this); img_person.on(cc.Node.EventType.TOUCH_END, this.onImgPersonEnd, this);
img_person.y -= 1000; if (!noAni) {
cc.tween(img_person).by(0.3, { y: 1000 }).start(); img_person.y -= 1000;
cc.tween(img_person).by(0.3, { y: 1000 }).start();
}
} }
updatePersonGuide() { updatePersonGuide() {
let img_person: cc.Node = pg.view.find(this, "img_person"); let img_person: cc.Node = pg.view.find(this, "img_person");
...@@ -241,9 +269,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -241,9 +269,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
itemRight(item) { itemRight(item) {
let img_person: cc.Node = pg.view.find(this, "img_person"); let img_person: cc.Node = pg.view.find(this, "img_person");
this.playLocalAudio("sonw");
cc.tween(img_person).to(1, { cc.tween(img_person).to(1, {
scale: 0.8, x: item.x, y: -0 scale: 0.8, x: item.x, y: -0
}).delay(0.1).call(() => { }).delay(0.05).call(() => {
this.playLocalAudio("right");
let layout_items = pg.view.find(this, "layout_items"); let layout_items = pg.view.find(this, "layout_items");
layout_items.active = false; layout_items.active = false;
}).start(); }).start();
...@@ -265,13 +295,23 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -265,13 +295,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 1700); }, 1700);
} }
itemError(item) { itemError(item) {
Ani.shake(item)
let bg_board = pg.view.find(item, "bg_board"); let bg_board = pg.view.find(item, "bg_board");
let bg_board_down = pg.view.find(item, "bg_board_down"); let bg_board_down = pg.view.find(item, "bg_board_down");
let icon_arrow = pg.view.find(item, "icon_arrow"); let icon_arrow = pg.view.find(item, "icon_arrow");
let img_pic = pg.view.find(item, "img_pic"); let img_pic = pg.view.find(item, "img_pic");
let label_percent = pg.view.find(item, "label_percent"); let label_percent = pg.view.find(item, "label_percent");
pg.view.visible(icon_arrow, false); let img_person: cc.Node = pg.view.find(this, "img_person");
this.playLocalAudio("sonw");
cc.tween(img_person).to(1, {
scale: 0.8, x: item.x, y: -0
}).delay(0.05).call(() => {
this.playLocalAudio("error");
Ani.shake(item)
pg.view.visible(icon_arrow, false);
setTimeout(() => {
this.updatePerson(true);
}, 100);
}).start();
} }
...@@ -319,7 +359,29 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -319,7 +359,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
showFireFlower() {
return new Promise((resolve, reject) => {
this.playLocalAudio("flower")
showFireworks(
this.node,
pg.view.find(this, 'RibbonNodeBase').children,
cc.v2(0, -600), cc.v2(0, 1000), 200, 200
);
showFireworks(
this.node,
pg.view.find(this, 'RibbonNodeBase').children,
cc.v2(-600, -600), cc.v2(200, 1000), 200, 200
);
showFireworks(
this.node,
pg.view.find(this, 'RibbonNodeBase').children,
cc.v2(600, -600), cc.v2(-200, 1000), 200, 200
);
setTimeout(() => {
resolve('');
}, 1500);
});
}
playLocalAudio(audioName) { playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource); const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "a143f3ce-1349-4709-8647-3376cd257cc1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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