Commit 07d69699 authored by yu's avatar yu

8.16调整

parent ae298c79
......@@ -144,7 +144,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
data.total = Game.getIns().getTotla;
data.right = Game.getIns().player.right;
data.scores = Game.getIns().player.voices;
this.log("total: " + data.total + " right: " + data.right);
data.stone = Math.floor(10 * data.right / data.total);
this.log("total: " + data.total + " right: " + data.right + " stone: " + data.stone);
onHomeworkFinish(data)
})
}
......@@ -155,8 +156,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
private count: number;
private list: Option[];
private fishs: cc.Node[];
gameStart() {
Game.getIns().state = GAME_STATE.RUNNING;
//游戏开始小鱼出现等等
......@@ -166,29 +165,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.audio.stopAudio(this.audioId);
}
//开始
// //根据数据随机热气球
// let page = Game.getIns().getCurrentPage();
// let list = page.optionList.concat();
// list = JSON.parse(JSON.stringify(list));
// list.sort((A, B) => { return Math.random() < 0.5 });
// Game.getIns().player.addScore(this.list.length);
this.count = 0;
this.lastCount = null;
this.fishs = [];
this.viewFishs = [];
this.touchFishs = [];
//根据顺序生成对应的鱼。
//顺序根据时间来进行跳动。当顺序跳动之后,就会产生新的鱼。
}
private lastCount: number;
private viewFishs: Option[];
private touchFishs: Option[];
update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return;
// if (this.fishLen < 5) this.count++;
// let fish = this.getFishByCount(this.count);
// if (fish) this.fishs.push(fish);
}
playLocalAudio(audioName) {
......@@ -215,7 +194,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (stop && count % 3 == 2) clearInterval(this.intervalId);
}, 150)
pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio).then(() => { stop = true; })
pg.audio.playAudioByUrl(Game.getIns().getCurrentPage().audio, (() => {
stop = true;
}))
}
......
......@@ -41,6 +41,10 @@ export default class layout_game extends cc.Component {
this.rightNum = 0;
this.initEvent();
}
protected onDestroy(): void {
cc.Tween.stopAll();
cc.audioEngine.stopAll();
}
private initEvent() {
pg.event.on("game_start", () => {
......@@ -60,7 +64,7 @@ export default class layout_game extends cc.Component {
list = JSON.parse(JSON.stringify(list));
list.sort((A, B) => { return Math.random() < 0.5 });
this.layout_same.removeAllChildren();
let isPic = this.checkIsAllPic(list);
let isPic = this.checkIsAllPic(list) && list.length == 4;
list.forEach((data, idx) => {
data.id = idx;
if (data.type == "txt") {
......@@ -79,8 +83,9 @@ export default class layout_game extends cc.Component {
this.layout_same.getComponent(cc.Layout).paddingLeft = isPic ? 30 : 0;
cc.find("bg_ornament", this.node).active = isPic;
cc.find("bg_ornament2", this.node).active = !isPic;
let img_player = cc.find("Canvas/bg/bg_could/img_player");
img_player.y = -260;
let img_player = cc.find("Canvas/player/img_player");
let start = cc.find("Canvas/bg/bg_could/startPos");
img_player.y = -330;
img_player.scale = 1;
}
private initWordItem(item, data) {
......@@ -113,6 +118,7 @@ export default class layout_game extends cc.Component {
pg.audio.playAudioByUrl(data.audioUrl, () => {
let pag = Game.getIns().getCurrentPage()
if (!pag.checkMore || this.rightNum > 1) {
this.layout_same.removeAllChildren();
this.clickRight().then(() => {
pg.event.emit("game_time_over");
});
......@@ -152,28 +158,30 @@ export default class layout_game extends cc.Component {
}
private clickRight() {
return new Promise((resolve, reject) => {
let img_player = cc.find("Canvas/bg/bg_could/img_player");
let img_player = cc.find("Canvas/player/img_player");
let endPos = cc.find("Canvas/bg/bg_could/endPos");
let start = cc.find("Canvas/bg/bg_could/startPos");
cc.tween(img_player)
.delay(0.1)
.call(() => { this.playLocalAudio("huaxue"); })
.to(1, { x: img_player.x, y: endPos.y, scale: 0.16 })
.to(1, { y: endPos.y, scale: 0.16 })
.call(() => { pg.event.emit("skiing_show_firework") })
.delay(1)
.delay(3)
.call(() => { return resolve('') })
.start();
})
}
private clickError() {
return new Promise((resolve, reject) => {
let img_player = cc.find("Canvas/bg/bg_could/img_player");
let img_player = cc.find("Canvas/player/img_player");
let errorPos = cc.find("Canvas/bg/bg_could/errorPos");
let startPos = img_player.getPosition();
let start = cc.find("Canvas/bg/bg_could/startPos");
let startPos = start.getPosition();
cc.tween(img_player).to(1, { y: errorPos.y, scale: 0.65 })
.delay(1)
.call(() => { this.playLocalAudio("error"); })
.to(1, { y: startPos.y, scale: 1 })
.call(() => {
this.playLocalAudio("error");
return resolve('')
})
.start();
......
......@@ -46,6 +46,7 @@ export class Item {
public duration;
public optionList;
public checkMore: boolean;
public rNum: number;
constructor(data, page) {
this.audio = data.questionAudio;
this.duration = data.duration;
......@@ -58,11 +59,11 @@ export class Item {
this.optionList.sort(function () {
return (0.5 - Math.random());
});
let rNum = 0;
this.rNum = 0;
for (let i = 0; i < this.optionList.length; i++) {
if (this.optionList[i].right) rNum++;
if (this.optionList[i].right) this.rNum++;
}
this.checkMore = rNum > 1;
this.checkMore = this.rNum > 1;
this.page = page;
}
}
......@@ -128,6 +129,7 @@ export default class Game {
public player: Player;
public robot: Robot;
public state: GAME_STATE;
public total: number;
constructor() {
this.start = false;
......@@ -160,6 +162,7 @@ export default class Game {
this.page = 1;
this.start = true;
this.lists = [];
this.total = 0;
for (let i = 0; i < this.data.length; i++) {
let data = this.data[i];
this.lists.push(new Item(data, i + 1));
......@@ -196,7 +199,11 @@ export default class Game {
this.page += 1;
}
get getTotla() {
return this.data.length;
this.total = 0;
this.lists.forEach((item) => {
this.total += item.rNum;
})
return this.total;
}
get isOver() {
return this.page > this.lists.length;
......
export const defaultData = {
"title": "急速滑雪",
"questionText": "可恶的小偷将魔法卡牌藏在热气球里,准备偷走!快击落热气球,夺回魔法卡牌。游戏开始,请点击弹弓,发射小球,击落热气球,魔法卡牌就会掉落下来。请仔细观察魔法卡牌,并大声说出魔法咒语。魔法咒语正确,你将获得该张魔法卡牌。游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
"questionTextAudio": "https://staging-teach.cdn.ireadabc.com/3152e0ea17b07406a002b2c05028b0cc.mp3",
"questionText": "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!",
"questionTextAudio": "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
"questions": [
{
"questionAudio": "https://teach.cdn.ireadabc.com/73dae647c4099fe65bc28f568e351e96.mp3",
"options": [
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/1832bc553f77f876e0bba64062bd6b38.jpg",
"audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
"text": "Please apple",
"right": false
"image": "http://staging-teach.cdn.ireadabc.com/0af1f16b7143f5027c8efcea56c4d8fb.png",
"audio": "http://staging-teach.cdn.ireadabc.com/416b6d52f024005d31898ef1da23daa7_l.mp3",
"text": "",
"time": "",
"right": true,
"audioName": "sahua.mp3"
},
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/52e8f2868ab7ea8b584bf6beb6b9672d.png",
"audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "Please take some Bag",
"right": false
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/5f5d6834729bb822158a4c9a70cc955d_l.mp3",
"text": "good",
"time": "",
"right": true,
"audioName": "huaxue.mp3"
},
// {
// "type": "txt",
// "image": "https://staging-teach.cdn.ireadabc.com/8c6fef67a0095c2564e8df4b536fc540.png",
// "audio": "https://staging-teach.cdn.ireadabc.com/b44fa51172b19b555fda30717c773027.mp3",
// "text": "take cat",
// "right": true
// },
// {
// "type": "txt",
// "image": "",
// "audio": "https://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
// "text": "Please take some cookies",
// "right": false
// },
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/7b315ba7227294d63933cd659d5372fb.png",
"audio": "https://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
"text": "egg",
"right": true
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/0913981cdeb2c6bc785de1054e80a500_l.mp3",
"text": "ghnggfgf",
"time": "",
"right": false,
"audioName": "error.mp3"
},
{
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/1410f63265ca58cb612df0ee2911b287.png",
"audio": "https://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
"text": "egg",
"right": true
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
"text": "gfdgdf ",
"time": "",
"right": false,
"audioName": "btn.mp3"
}
]
],
"type": "",
"questionAudio": "http://staging-teach.cdn.ireadabc.com/cdc41b6682e155c385093c52d2a4adff_l.mp3",
"audioName": "完成-全部答题完成或点击了答题完成按钮.mp3"
},
{
"questionAudio": "https://teach.cdn.ireadabc.com/73dae647c4099fe65bc28f568e351e96.mp3",
"options": [
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/d948ef84a50e6ac36bc31110f9062878.mp3",
"text": "umbrella",
"right": true
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/2bc20ac5b284dd8cf379bb1e1c75848a.png",
"audio": "http://staging-teach.cdn.ireadabc.com/b004c86f1a26a367cfa329b11e365f0f_l.mp3",
"text": "",
"time": "",
"right": true,
"audioName": "选项被选择(该音效指选项属性无对错概念时候用的).mp3"
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/8d6a8d7764011afb0ef537d5a44d1d10.mp3",
"text": "key",
"right": true
"audio": "http://staging-teach.cdn.ireadabc.com/0913981cdeb2c6bc785de1054e80a500_l.mp3",
"text": "ame",
"time": "",
"right": false,
"audioName": "error.mp3"
},
{
"type": "txt",
"image": "",
"audio": "https://staging-teach.cdn.ireadabc.com/6b3846cee6afa2ae450234aeec835beb.mp3",
"text": "bag",
"right": false
"audio": "http://staging-teach.cdn.ireadabc.com/5f5d6834729bb822158a4c9a70cc955d_l.mp3",
"text": "chilce",
"time": "",
"right": false,
"audioName": "huaxue.mp3"
},
{
"type": "img",
"image": "https://staging-teach.cdn.ireadabc.com/7b315ba7227294d63933cd659d5372fb.png",
"audio": "https://staging-teach.cdn.ireadabc.com/a6a5c388c636bc6d063946e91b4bd21a.mp3",
"text": "egg",
"right": true
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/416b6d52f024005d31898ef1da23daa7_l.mp3",
"text": "xnory",
"time": "",
"right": false,
"audioName": "sahua.mp3"
}
]
],
"type": "",
"questionAudio": "http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d_l.mp3",
"audioName": "选择正确.mp3"
}
]
],
"audioName": "极速滑雪 游戏说明.MP3"
}
\ No newline at end of file
......@@ -99,6 +99,23 @@
<div class="word-type-title">
题目{{i+1}}
</div>
<div class="option-audio">
<div class="word-input-title">
题目音频:
</div>
<div style="display: flex">
<div>
<app-audio-recorder [audioUrl]="question.questionAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'questionAudio', question)">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>
{{ question.audioName}}
</span>
</div>
</div>
</div>
<div class="word-type-option-title" style="margin-top:20px;">
选项内容:
</div>
......@@ -163,33 +180,32 @@
</div>
</div>
</div>
<div class="option-text">
<div *ngIf="option.type=='txt'" class="option-text">
<div class="word-input-title">
<span style="color:red;margin-left:-15px">* </span>
<!-- <span style="color:red;margin-left:-15px">* </span> -->
<span>文本: </span>
</div>
<input class="input-place-red" type="text" placeholder="必填,语音评测是根据文本内容去对比打分的" nz-input
[(ngModel)]="option.text" (blur)="save()">
<input class="input-place-red" type="text" nz-input [(ngModel)]="option.text" (blur)="save()">
</div>
<div class="option-time">
<!-- <div class="option-time">
<div class="word-input-title">
<span>录音时间: </span>
</div>
<input type="number" placeholder="录音超过时间将自动提交成绩" nz-input [(ngModel)]="option.time"
(blur)="save()">
</div>
</div> -->
</div>
</div>
<div class="option-btns">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeoption(i,j)">删除选项</button>
<button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger
(click)="copyoption(i,j)">复制选项</button>
<button *ngIf="question.options.length <4" class="btn-blue" style="margin-top: 10px;" nz-button
nzType="default" nzDanger (click)="copyoption(i,j)">复制选项</button>
</div>
</div>
</div>
<div style="margin-left: 69px;margin-top: 15px;">
<div *ngIf="question.options.length <4" style="margin-left: 69px;margin-top: 15px;">
<button class="btn-blue" nz-button nzType="default" nzDanger (click)="addoption(i)">+增加选项</button>
</div>
</div>
......
......@@ -13,8 +13,8 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
item = {
title: "急速滑雪",
questionText: "可恶的小偷将魔法卡牌藏在热气球里,准备偷走!快来夺回魔法卡牌吧!只要击落热气球,魔法卡牌就会掉落下来。请仔细观察魔法卡牌,并大声说出魔法咒语。魔法咒语正确,你将获得该张魔法卡牌。游戏结束后,根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!",
questionTextAudio: "http://staging-teach.cdn.ireadabc.com/d60710f8580f77d494a6ab95d5cc46c5.mp3",
questionText: "雪地里有许多不同的指示牌,运动员要选择哪一个呢?亲爱的小玩家,请你认真听游戏指令,帮助运动员选择正确的指示牌吧!游戏结束后,根据收集到的指示牌数量,你将获得相应的能量石奖励哟!开始挑战吧!",
questionTextAudio: "http://staging-teach.cdn.ireadabc.com/c3b69ad3d51385eac7d4195773ef59f7_l.mp3",
questions: [],
audioName: ""
};
......@@ -52,7 +52,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addoption(i) {
this.item.questions[i].options.push({
type: "",
type: "txt",
image: "",
audio: "",
text: "",
......@@ -72,7 +72,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
addquestion() {
this.item.questions.push({
options: [],
type: ""
type: "",
questionAudio:"",
audioName:"",
});
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