Commit 9f8aa7ad authored by Tt's avatar Tt

单机版完成

parent 807e2ac9
This diff is collapsed.
...@@ -40,12 +40,13 @@ export default class NewClass extends cc.Component { ...@@ -40,12 +40,13 @@ export default class NewClass extends cc.Component {
pg.event.on("game_set_game_time", (count) => { pg.event.on("game_set_game_time", (count) => {
this.countDown = count; this.countDown = count;
}); });
pg.event.on("game_play_laba", () => {
this.playLaba();
});
this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this); this.btn_laba.on(cc.Node.EventType.TOUCH_END, this.playLaba, this);
} }
private gameStart() { private gameStart() {
this.countDown = Game.getIns().getCurrentPage().duration; this.countDown = Game.getIns().getCurrentPage().duration;
// this.showRound();
this.playLaba();
} }
private bg_round: cc.Node; private bg_round: cc.Node;
private initView() { private initView() {
...@@ -82,6 +83,7 @@ export default class NewClass extends cc.Component { ...@@ -82,6 +83,7 @@ export default class NewClass extends cc.Component {
if (stop && count % 3 == 2) { if (stop && count % 3 == 2) {
this.playing = false; this.playing = false;
clearInterval(this.intervalId); clearInterval(this.intervalId);
pg.event.emit("game_play_laba_successed");
} }
}, 150); }, 150);
pg.audio.playAudioByUrlThen(Game.getIns().getCurrentPage().audio).then(() => { pg.audio.playAudioByUrlThen(Game.getIns().getCurrentPage().audio).then(() => {
......
This diff is collapsed.
...@@ -52,7 +52,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -52,7 +52,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.audioId = await pg.audio.playAudioByUrl(Game.getIns().question.audio); this.audioId = await pg.audio.playAudioByUrl(Game.getIns().question.audio);
if (this.audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) { if (this.audioId > -1 && Game.getIns().state == GAME_STATE.RUNNING) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
// pg.audio.stopAudio(this.audioId);
} }
} }
initEvent() { initEvent() {
...@@ -81,7 +80,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -81,7 +80,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.layout_start.active = false; this.layout_start.active = false;
if (this.audioId > -1) { if (this.audioId > -1) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
// pg.audio.stopAudio(this.audioId);
} }
if (!Game.getIns().singleGame) { if (!Game.getIns().singleGame) {
this.showVs(); this.showVs();
...@@ -91,12 +89,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -91,12 +89,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
gameStart() { gameStart() {
Game.getIns().state = GAME_STATE.RUNNING;
//游戏开始小鱼出现等等 //游戏开始小鱼出现等等
this.layout_start.active = false; this.layout_start.active = false;
if (this.audioId > -1 && Game.getIns().state != GAME_STATE.WAIT) { if (this.audioId > -1 && Game.getIns().state != GAME_STATE.WAIT) {
cc.audioEngine.stopAllEffects(); cc.audioEngine.stopAllEffects();
// pg.audio.stopAudio(this.audioId);
} }
} }
private showVs() { private showVs() {
......
...@@ -42,10 +42,12 @@ export class Item { ...@@ -42,10 +42,12 @@ export class Item {
public audio; public audio;
public duration; public duration;
public optionList; public optionList;
public img;
constructor(data, page) { constructor(data, page) {
this.audio = data.questionAudio; this.audio = data.questionAudio;
this.duration = data.duration; this.duration = data.duration;
let id = 0; let id = 0;
this.img = data.questionImg;
this.optionList = data.options.map(o => { this.optionList = data.options.map(o => {
return new Option(o, id++); return new Option(o, id++);
......
...@@ -2,5 +2,25 @@ export const defaultData = ...@@ -2,5 +2,25 @@ export const defaultData =
{ {
"onlineFlg": false, "onlineFlg": false,
"title": "疯狂打地鼠", "title": "疯狂打地鼠",
"questionText": "调皮的地鼠偷走了魔法卡牌,亲爱的小玩家,请仔细听游戏指令,快速找到藏着正确魔法卡牌的地鼠,用锤子敲打它,就能夺回魔法卡牌。在本次的游戏中,你将和其他玩家进行PK,游戏结束,获得魔法卡牌数量最多的玩家,将获得胜利。最后根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!", "questionTextAudio": "http://staging-teach.cdn.ireadabc.com/d08192ced3bd81941d38941bb36e5042_l.mp3", "questions": [{ "questionAudio": "http://staging-teach.cdn.ireadabc.com/130feba39f7665f46adfc6765f86c6cd_l.mp3", "duration": 120, "options": [{ "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png", "audio": "http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3", "text": "", "right": true, "audioName": "加分.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "xfuw", "right": false, "audioName": "冒出.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3", "text": "head", "right": true, "audioName": "错误.mp3" }, { "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png", "audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "", "right": false, "audioName": "冒出.mp3" }], "questionImg": "http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png", "audioName": "胜利.mp3" }, { "questionAudio": "http://staging-teach.cdn.ireadabc.com/26e6e997562503a98918fadab7e7b6c2_l.mp3", "duration": 120, "options": [{ "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png", "audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "", "right": true, "audioName": "冒出.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3", "text": "eye", "right": true, "audioName": "错误.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3", "text": "fffsxz", "right": false, "audioName": "加分.mp3" }, { "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/01247e69d70b995da41e6b7e2000b540.png", "audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3", "text": "", "right": false, "audioName": "按钮.mp3" }], "questionImg": "http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png", "audioName": "失败.mp3" }], "audioName": "头像移动.mp3", "bgAudio": "http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3" "questionText":
"调皮的地鼠偷走了魔法卡牌,亲爱的小玩家,请仔细听游戏指令,快速找到藏着正确魔法卡牌的地鼠,用锤子敲打它,就能夺回魔法卡牌。在本次的游戏中,你将和其他玩家进行PK,游戏结束,获得魔法卡牌数量最多的玩家,将获得胜利。最后根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
"questionTextAudio": "http://staging-teach.cdn.ireadabc.com/d08192ced3bd81941d38941bb36e5042_l.mp3",
"questions": [
{
"questionAudio": "http://staging-teach.cdn.ireadabc.com/130feba39f7665f46adfc6765f86c6cd_l.mp3",
"duration": 120,
"options": [{
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png",
"audio": "http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3", "text": "", "right": true,
"audioName": "加分.mp3"
}, {
"type": "txt", "image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "xfuw", "right": false,
"audioName": "冒出.mp3"
}, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3", "text": "head", "right": true, "audioName": "错误.mp3" }, { "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png", "audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "", "right": false, "audioName": "冒出.mp3" }],
"questionImg": "http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png",
"audioName": "胜利.mp3"
}, { "questionAudio": "http://staging-teach.cdn.ireadabc.com/26e6e997562503a98918fadab7e7b6c2_l.mp3", "duration": 120, "options": [{ "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png", "audio": "http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3", "text": "", "right": true, "audioName": "冒出.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3", "text": "eye", "right": true, "audioName": "错误.mp3" }, { "type": "txt", "image": "", "audio": "http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3", "text": "fffsxz", "right": false, "audioName": "加分.mp3" }, { "type": "img", "image": "http://staging-teach.cdn.ireadabc.com/01247e69d70b995da41e6b7e2000b540.png", "audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3", "text": "", "right": false, "audioName": "按钮.mp3" }], "questionImg": "http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png", "audioName": "失败.mp3" }],
"audioName": "头像移动.mp3", "bgAudio": "http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3"
} }
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "28a64216-70e2-481e-b68f-fe1903e2855c", "uuid": "0dcbe4c6-9dc4-4f4d-84bc-81382889e5c5",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"text_round": { "text_round": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "85b42405-9be3-45cc-8094-724da319850f", "uuid": "8bf6fd14-026b-4777-b9b7-69d9b17d97f0",
"rawTextureUuid": "28a64216-70e2-481e-b68f-fe1903e2855c", "rawTextureUuid": "0dcbe4c6-9dc4-4f4d-84bc-81382889e5c5",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
...@@ -4588,6 +4588,7 @@ declare namespace cc { ...@@ -4588,6 +4588,7 @@ declare namespace cc {
/** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space. /** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */ !#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
forward: Vec3; forward: Vec3;
data: Option;
/** /**
@param name name @param name name
...@@ -67,12 +67,12 @@ export class ComponentBase { ...@@ -67,12 +67,12 @@ export class ComponentBase {
* 储存音频数据 * 储存音频数据
* @param e * @param e
*/ */
onAudioUploadSuccess(e, key, it = this.item) { onAudioUploadSuccess(e, key, it = this.item, name = 'audioName') {
let url = e.url; let url = e.url;
let sp = url.split(".mp3"); let sp = url.split(".mp3");
let u = sp[0] + "_l.mp3"; let u = sp[0] + "_l.mp3";
it[key] = u; it[key] = u;
it["audioName"] = e.name || ""; it[name] = e.name || "";
this.save(); this.save();
} }
......
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