Commit 40cd4b23 authored by liujiaxin's avatar liujiaxin

123

parent f3bcc7bd
...@@ -2,10 +2,24 @@ ...@@ -2,10 +2,24 @@
<div style="padding: 10px;"> <div style="padding: 10px;">
<div style="margin-top: 5px"> <div style="margin-top: 5px">
<span>音频: </span> <span>始第1遍音频: </span>
<app-audio-recorder <app-audio-recorder
[audioUrl]="item.begin_audio" [audioUrl]="item.begin_audio1"
(audioUploaded)="onAudioUploadSuccess($event, 'begin_audio')" (audioUploaded)="onAudioUploadSuccess($event, 'begin_audio1')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px">
<span>开始第2遍音频: </span>
<app-audio-recorder
[audioUrl]="item.begin_audio2"
(audioUploaded)="onAudioUploadSuccess($event, 'begin_audio2')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px">
<span>做题引导音频: </span>
<app-audio-recorder
[audioUrl]="item.guide_audio"
(audioUploaded)="onAudioUploadSuccess($event, 'guide_audio')"
></app-audio-recorder> ></app-audio-recorder>
</div> </div>
<div style="margin-top: 5px"> <div style="margin-top: 5px">
...@@ -15,6 +29,41 @@ ...@@ -15,6 +29,41 @@
(audioUploaded)="onAudioUploadSuccess($event, 'playing_audio')" (audioUploaded)="onAudioUploadSuccess($event, 'playing_audio')"
></app-audio-recorder> ></app-audio-recorder>
</div> </div>
<!-- <div style="margin-top: 5px">-->
<!-- <span>做题引导音频: </span>-->
<!-- <app-audio-recorder-->
<!-- [audioUrl]="item.guide_audio"-->
<!-- (audioUploaded)="onAudioUploadSuccess($event, 'guide_audio')"-->
<!-- ></app-audio-recorder>-->
<!-- </div>-->
<div style="margin-top: 5px">
<span>正确提示音: </span>
<app-audio-recorder
[audioUrl]="item.right_audio"
(audioUploaded)="onAudioUploadSuccess($event, 'right_audio')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px">
<span>默认错误提示音: </span>
<app-audio-recorder
[audioUrl]="item.wrong_audio"
(audioUploaded)="onAudioUploadSuccess($event, 'wrong_audio')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px">
<span>错误提示音频1: </span>
<app-audio-recorder
[audioUrl]="item.wrong_audio1"
(audioUploaded)="onAudioUploadSuccess($event, 'wrong_audio1')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px">
<span>错误提示音频2: </span>
<app-audio-recorder
[audioUrl]="item.wrong_audio2"
(audioUploaded)="onAudioUploadSuccess($event, 'wrong_audio2')"
></app-audio-recorder>
</div>
<div style="margin-top: 5px"> <div style="margin-top: 5px">
<span>结尾音频: </span> <span>结尾音频: </span>
<app-audio-recorder <app-audio-recorder
......
{
"ver": "1.1.2",
"uuid": "7b142208-7ebf-4c01-894f-e214d8bc95c8",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
...@@ -2169,22 +2169,26 @@ ...@@ -2169,22 +2169,26 @@
} }
], ],
"_armatureName": "Armature", "_armatureName": "Armature",
"_animationName": "", "_animationName": "enlarge",
"_preCacheMode": 0, "_preCacheMode": 0,
"_cacheMode": 0, "_cacheMode": 0,
"playTimes": -1, "playTimes": -1,
"premultipliedAlpha": false, "premultipliedAlpha": false,
"_armatureKey": "4d85228f-ec02-4cbe-a0d8-cc8628fe805d#146d0d76-3625-438b-a6c8-dbd27ca2af63", "_armatureKey": "ff020f6d-a4b6-4baf-bcad-94ae605c2977#ac49bcc0-d84e-4dd4-a8e3-7d81d1885337",
"_accTime": 0, "_accTime": 0,
"_playCount": 0, "_playCount": 0,
"_frameCache": null, "_frameCache": null,
"_curFrame": null, "_curFrame": null,
"_playing": false, "_playing": false,
"_armatureCache": null, "_armatureCache": null,
"_N$dragonAsset": null, "_N$dragonAsset": {
"_N$dragonAtlasAsset": null, "__uuid__": "ff020f6d-a4b6-4baf-bcad-94ae605c2977"
},
"_N$dragonAtlasAsset": {
"__uuid__": "ac49bcc0-d84e-4dd4-a8e3-7d81d1885337"
},
"_N$_defaultArmatureIndex": 0, "_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0, "_N$_animationIndex": 2,
"_N$_defaultCacheMode": 0, "_N$_defaultCacheMode": 0,
"_N$timeScale": 1, "_N$timeScale": 1,
"_N$debugBones": false, "_N$debugBones": false,
......
...@@ -110,11 +110,14 @@ cc.Class({ ...@@ -110,11 +110,14 @@ cc.Class({
_hintsNodeList : null, _hintsNodeList : null,
_figurePointRectArray: null, _figurePointRectArray: null,
_allAnimationNodes: null,
initSceneData() { initSceneData() {
this._imageResList = []; this._imageResList = [];
this._audioResList = []; this._audioResList = [];
this._animaResList = []; this._animaResList = [];
this._allAnimationNodes = [];
this._hintsNodeList = []; this._hintsNodeList = [];
this._lastFingerPosition= { this._lastFingerPosition= {
pos: null, pos: null,
...@@ -208,12 +211,12 @@ cc.Class({ ...@@ -208,12 +211,12 @@ cc.Class({
src: (context, event) => (callback, onReceive) => { src: (context, event) => (callback, onReceive) => {
console.log('[answer] thinking and playing'); console.log('[answer] thinking and playing');
// This will send the 'INC' event to the parent every second // check every second
const id = setInterval(() => { const id = setInterval(() => {
const region = context.questions[context.questionIndex]; const region = context.questions[context.questionIndex];
const result = this.checkInRegion(region.rect); const result = this.checkInRegion(region.rect);
console.log('checkInRegion', JSON.stringify(this._lastFingerPosition), JSON.stringify(region.rect), result); // console.log('checkInRegion', JSON.stringify(this._lastFingerPosition), JSON.stringify(region.rect), result);
if (result) { if (result) {
callback('RIGHT') callback('RIGHT')
// playAudioByUrl(this.data.begin_audio, () => { // playAudioByUrl(this.data.begin_audio, () => {
...@@ -277,17 +280,27 @@ cc.Class({ ...@@ -277,17 +280,27 @@ cc.Class({
wrong:{ wrong:{
invoke: { invoke: {
src: (context, event) => { src: (context, event) => {
console.log(1111)
this._lastFingerPosition.pos = null; this._lastFingerPosition.pos = null;
this._lastFingerPosition.dirty = false; this._lastFingerPosition.dirty = false;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log('answer wrong', context.questionPlayTimes , context.maxQuestionTryTimes); console.log('answer wrong', context.questionIndex, context.questionPlayTimes , context.maxQuestionTryTimes);
const ddLogoCat = this.logoCat.getComponent(dragonBones.ArmatureDisplay) const ddLogoCat = this.logoCat.getComponent(dragonBones.ArmatureDisplay)
ddLogoCat.playAnimation('wrong', 1) ddLogoCat.playAnimation('wrong', 1)
ddLogoCat.once(dragonBones.EventObject.COMPLETE, function() { ddLogoCat.once(dragonBones.EventObject.COMPLETE, function() {
this.logoCat.getComponent(dragonBones.ArmatureDisplay).playAnimation('normal', 0) this.logoCat.getComponent(dragonBones.ArmatureDisplay).playAnimation('normal', 0)
}, this) }, this);
playAudioByUrl(this.wrongAudio, () => { let wrongEffect = this.wrongAudio;
// 第一和第二题的提示音
if ([0, 1].includes(context.questionIndex)) {
wrongEffect = this.data[`wrong_audio${context.questionPlayTimes}`]
} else {
// 非第一和第二题,并且做第二遍的提示音
if (context.questionPlayTimes == 2) {
wrongEffect = this.data[`wrong_audio${context.questionPlayTimes}`]
}
}
playAudioByUrl(wrongEffect, () => {
if (context.questionPlayTimes >= context.maxQuestionTryTimes) { if (context.questionPlayTimes >= context.maxQuestionTryTimes) {
const an = context.questions[context.questionIndex].node; const an = context.questions[context.questionIndex].node;
an.active = true; an.active = true;
...@@ -298,7 +311,6 @@ cc.Class({ ...@@ -298,7 +311,6 @@ cc.Class({
} else { } else {
resolve() resolve()
} }
}) })
}); });
}, },
...@@ -312,9 +324,6 @@ cc.Class({ ...@@ -312,9 +324,6 @@ cc.Class({
} }
} }
}, },
} }
} }
const QuestionsArrayStatus = { const QuestionsArrayStatus = {
...@@ -322,7 +331,6 @@ cc.Class({ ...@@ -322,7 +331,6 @@ cc.Class({
initial: 'play', initial: 'play',
states: { states: {
play: { play: {
...QuestionState ...QuestionState
}, },
next: { next: {
...@@ -356,10 +364,9 @@ cc.Class({ ...@@ -356,10 +364,9 @@ cc.Class({
}, },
states: { states: {
begin: { begin: {
invoke: { invoke: {
src: (ctx) => { src: (ctx) => {
console.log('game begin'); console.log('game begin 1');
if(window.courseware && window.courseware.openOsmoFingerRead) { if(window.courseware && window.courseware.openOsmoFingerRead) {
this.isOpenedOsmoFingerRead = true; this.isOpenedOsmoFingerRead = true;
window.courseware.openOsmoFingerRead() window.courseware.openOsmoFingerRead()
...@@ -367,21 +374,56 @@ cc.Class({ ...@@ -367,21 +374,56 @@ cc.Class({
var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay); var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay);
const state = dragonDisplay.playAnimation('begin', 0); const state = dragonDisplay.playAnimation('begin', 0);
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
playAudioByUrl(this.data.begin_audio, () => { playAudioByUrl(this.data.begin_audio1, () => {
console.log('game begin audio finish'); console.log('game begin audio finish');
resolve() resolve()
}) })
}); });
}, },
onDone: 'begin2',
onError: 'begin2'
}
},
begin2: {
invoke: {
src: (ctx) => {
console.log('game begin 2');
for(let i = 0 ;i < this._allAnimationNodes.length; i++) {
const t = this._allAnimationNodes[i];
const dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('normal', 0);
}
return new Promise((resolve,reject) => {
playAudioByUrl(this.data.begin_audio2, () => {
resolve()
})
});
},
onDone: 'guide',
onError: 'guide'
}
},
guide:{
invoke: {
src: (ctx) => {
return new Promise((resolve,reject) => {
playAudioByUrl(this.data.guide_audio, () => {
console.log('game guide audio finish');
reject()
})
});
},
onDone: 'playing', onDone: 'playing',
onError: 'playing' onError: 'playing'
} },
}, },
playing: { playing: {
entry: (ctx) => { entry: (ctx) => {
console.log('entry play stage'); console.log('entry play stage');
var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay); var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay);
const state = dragonDisplay.playAnimation('normal', 0); const state = dragonDisplay.playAnimation('normal', 0);
cc.assetManager.loadRemote(this.data.playing_audio, (err, audioClip) => { cc.assetManager.loadRemote(this.data.playing_audio, (err, audioClip) => {
cc.audioEngine.playMusic(audioClip, true, 0.8); cc.audioEngine.playMusic(audioClip, true, 0.8);
}); });
...@@ -401,9 +443,9 @@ cc.Class({ ...@@ -401,9 +443,9 @@ cc.Class({
}, },
end: { end: {
entry: (ctx, event) => { entry: (ctx, event) => {
console.log('game end', ctx, event); console.log('game end');
var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay); var dragonDisplay = this.logoCat.getComponent(dragonBones.ArmatureDisplay);
const state = dragonDisplay.playAnimation('end', 0); const state = dragonDisplay.playAnimation('finish', 0);
if(window.courseware && window.courseware.closeOsmoFingerRead) { if(window.courseware && window.courseware.closeOsmoFingerRead) {
this.isOpenedOsmoFingerRead = false; this.isOpenedOsmoFingerRead = false;
window.courseware.closeOsmoFingerRead() window.courseware.closeOsmoFingerRead()
...@@ -428,17 +470,26 @@ cc.Class({ ...@@ -428,17 +470,26 @@ cc.Class({
const k = this._hintsNodeList[i].after; const k = this._hintsNodeList[i].after;
after[k]= { after[k]= {
actions: () => { actions: () => {
console.log(k)
// this.playAni(i, 'normal')
// cc.tween(t).to(.8, {scale: .3}).to(.8, {scale: .25}).start();
const dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay); const dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.playAnimation('enlarge', 1); dragonDisplay.playAnimation('enlarge', 1);
console.log(dragonDisplay._armatureKey, 'enlarge')
dragonDisplay.addEventListener(dragonBones.EventObject.COMPLETE, (event) => { dragonDisplay.addEventListener(dragonBones.EventObject.COMPLETE, (event) => {
//TODO 这里写触发事件 // TODO 这里写触发事件
//event.name为事件名称 // event.name为事件名称
event.armature.animation.play('normal', 0); // event.armature.animation.play('normal', 0);
console.log(event.animationState.name) // console.log(event.animationState.name, dragonDisplay._armatureKey, 'end')
}, this); }, this);
// const dragonDisplay = t.getComponent(dragonBones.ArmatureDisplay);
// dragonDisplay.playAnimation('enlarge', 1);
// console.log(dragonDisplay._armatureKey, 'enlarge')
// dragonDisplay.addEventListener(dragonBones.EventObject.COMPLETE, (event) => {
// //TODO 这里写触发事件
// //event.name为事件名称
// event.armature.animation.play('normal', 0);
// console.log(event.animationState.name, dragonDisplay._armatureKey, 'end')
// }, this);
} }
} }
} }
...@@ -463,7 +514,7 @@ cc.Class({ ...@@ -463,7 +514,7 @@ cc.Class({
} }
getData((data) => { getData((data) => {
console.log('data:', data); // console.log('data:', data);
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data)) this.data = JSON.parse(JSON.stringify(this.data))
...@@ -549,8 +600,20 @@ cc.Class({ ...@@ -549,8 +600,20 @@ cc.Class({
addPreloadAudio() { addPreloadAudio() {
this._audioResList.push({ url: this.data.begin_audio }); this._audioResList.push({ url: this.data.begin_audio1 });
this._audioResList.push({ url: this.data.begin_audio2 });
this._audioResList.push({ url: this.data.guide_audio });
this._audioResList.push({ url: this.data.playing_audio }); this._audioResList.push({ url: this.data.playing_audio });
if (this.data.wrong_audio) {
this._audioResList.push({ url: this.data.wrong_audio });
this.wrongAudio = this.data.wrong_audio
}
if (this.data.right_audio) {
this._audioResList.push({ url: this.data.right_audio });
this.rightAudio = this.data.right_audio
}
this._audioResList.push({ url: this.data.wrong_audio1 });
this._audioResList.push({ url: this.data.wrong_audio2 });
this._audioResList.push({ url: this.data.end_audio }); this._audioResList.push({ url: this.data.end_audio });
...@@ -572,7 +635,7 @@ cc.Class({ ...@@ -572,7 +635,7 @@ cc.Class({
cc.assetManager.loadAny(preloadArr, null, (f, t, item) => { cc.assetManager.loadAny(preloadArr, null, (f, t, item) => {
// console.log(f, t, item) // console.log(f, t, item)
}, (err, data) => { }, (err, data) => {
console.log(err, data); // console.log(err, data);
const ground = cc.find(`Canvas/frame-border/ground`); const ground = cc.find(`Canvas/frame-border/ground`);
const groundBg = cc.find(`Canvas/frame-border/ground/bg`); const groundBg = cc.find(`Canvas/frame-border/ground/bg`);
groundBg.active = false; groundBg.active = false;
...@@ -617,7 +680,8 @@ cc.Class({ ...@@ -617,7 +680,8 @@ cc.Class({
n.width = width; n.width = width;
n.height = height; n.height = height;
n.active = true; n.active = true;
db.playAnimation('normal', 0); db.playAnimation('null', 0);
this._allAnimationNodes.push(n);
finishDbCount++; finishDbCount++;
console.log(finishDbCount, dbCount) console.log(finishDbCount, dbCount)
if (finishDbCount == dbCount) { if (finishDbCount == dbCount) {
......
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