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";
import { Item, Part, Game } from "./model/game";
import pg from "./pg";
import Ani from "./ani";
import {
showFireworks,
} from '../script/utils';
const { ccclass, property } = cc._decorator;
enum STATE {
......@@ -49,18 +52,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
initEvent() {
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");
pg.view.touchOn(btn_start, this.onBtnStart, this);
pg.view.touchOn(btn_restart, this.onBtnRestart, this);
pg.view.touchOn(btn_stem, this.onBtnStem, this);
}
onBtnStart() {
this.playLocalAudio("start");
let btn_start: cc.Node = pg.view.find(this, "btn_start");
//执行开始单个游戏开始
cc.tween(btn_start).by(0.3, { x: 1500 }).call(() => {
this.updateState(1);
}).start();
}
onBtnRestart() {
this.playLocalAudio("start");
Game.getIns().current = 0;
this.updateState(1);
}
nextPart() {
Game.getIns().current++;
this.updateState(1);
......@@ -78,12 +89,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
updateWait() {
let btn_start: any;
let panel_percent: cc.Node;
let btn_start: any = pg.view.find(this, "btn_start");
let panel_gary = pg.view.find(this, "panel_gary");
pg.view.visible(btn_start, true);
pg.view.visible(panel_percent, true);
pg.view.visible(panel_gary, true);
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 playing: number;
initPartData() {
......@@ -91,10 +108,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playing = STATE.WAITING;
}
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_restart"), 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.updateBtnStem();
this.updateList();
......@@ -171,7 +197,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
item.data = data;
}
updatePerson() {
updatePerson(noAni: boolean = false) {
let img_person: cc.Node = pg.view.find(this, "img_person");
img_person.active = true;
img_person.x = 0;
......@@ -181,9 +207,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
img_person.on(cc.Node.EventType.TOUCH_MOVE, this.onImgPersonMove, this);
img_person.on(cc.Node.EventType.TOUCH_END, this.onImgPersonEnd, this);
if (!noAni) {
img_person.y -= 1000;
cc.tween(img_person).by(0.3, { y: 1000 }).start();
}
}
updatePersonGuide() {
let img_person: cc.Node = pg.view.find(this, "img_person");
img_person.active = true;
......@@ -241,9 +269,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
itemRight(item) {
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.1).call(() => {
}).delay(0.05).call(() => {
this.playLocalAudio("right");
let layout_items = pg.view.find(this, "layout_items");
layout_items.active = false;
}).start();
......@@ -265,13 +295,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 1700);
}
itemError(item) {
Ani.shake(item)
let bg_board = pg.view.find(item, "bg_board");
let bg_board_down = pg.view.find(item, "bg_board_down");
let icon_arrow = pg.view.find(item, "icon_arrow");
let img_pic = pg.view.find(item, "img_pic");
let label_percent = pg.view.find(item, "label_percent");
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 {
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) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
......
// 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
import {
showFireworks,
} from '../script/utils';
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
showFireworks(
cc.find('Canvas/Main Camera'),
cc.find('RibbonNodeBase').children,
cc.v2(0, -400), cc.v2(0, 1000), 200, 200
);
showFireworks(
cc.find('Canvas/Main Camera'),
cc.find('RibbonNodeBase').children,
cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
);
showFireworks(
cc.find('Canvas/Main Camera'),
cc.find('RibbonNodeBase').children,
cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
);
}
// update (dt) {}
}
{
"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.
{
"ver": "1.0.8",
"uuid": "3bbd94ac-4119-4b46-bc17-21f2f45fff4d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "66044c52-4193-4d76-a424-9507157c9bfc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
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