Commit e0136aff authored by liujiaxin's avatar liujiaxin

111

parent 6ea4e356
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{},"subMetas":{}}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
......@@ -138,13 +138,15 @@ cc.Class({
},
playAni(idx, name, times = 1) {
playAni(idx, name, options) {
const times = (options && options.times) || 1;
const cb = (options && options.callback) || null;
// const cat = cc.find(`Canvas/frame-border/ground/${node}`);
const node = this._animaNodeList[idx]
var dragonDisplay = node.getComponent(dragonBones.ArmatureDisplay);
const state = dragonDisplay.playAnimation(name, times);
// animationDisplay.addEventListener(dragonBones.EventObject.COMPLETE, completeCallback);
return state;
},
// 生命周期 onLoad
......@@ -229,16 +231,22 @@ cc.Class({
},
answer: {
after: {
10000: [
{
target: '#QuestionsArray.next',
actions: raise('CHECK'),
cond: (ctx, evt) => {
console.log('[timeout check] check if end', ctx.questionPlayTimes , ctx.maxQuestionTryTimes);
return ctx.questionPlayTimes >= ctx.maxQuestionTryTimes;
}
},
{ target: 'retry', actions: raise('CHECK') } // reenter 'hint' state
5000: [
// {
// target: '#QuestionsArray.next',
// actions: raise('CHECK'),
// cond: (ctx, evt) => {
// console.log('[timeout check] #QuestionsArray.next', ctx.questionPlayTimes , ctx.maxQuestionTryTimes, (ctx.questionPlayTimes >= ctx.maxQuestionTryTimes));
// return ctx.questionPlayTimes >= ctx.maxQuestionTryTimes;
// },
// },
{
target: 'wrong',
// cond: (ctx, evt) => {
// console.log('[timeout check] wrong', ctx.questionPlayTimes , ctx.maxQuestionTryTimes, (ctx.questionPlayTimes < ctx.maxQuestionTryTimes));
// return ctx.questionPlayTimes < ctx.maxQuestionTryTimes;
// },
} // reenter 'hint' state
]
},
......@@ -343,6 +351,7 @@ cc.Class({
this._lastFingerPosition.dirty = false;
return new Promise((resolve, reject) => {
console.log('answer right');
this.playAni(context.questionIndex, 'normal')
playAudioByUrl(this.rightAudio, () => {
resolve()
})
......@@ -360,44 +369,33 @@ cc.Class({
},
wrong:{
invoke: {
src: (context, event) => {
src: (ctx, event) => {
console.log(1111)
this._lastFingerPosition.pos = null;
this._lastFingerPosition.dirty = false;
return new Promise((resolve, reject) => {
console.log('answer wrong');
console.log('answer wrong', ctx.questionPlayTimes , ctx.maxQuestionTryTimes);
playAudioByUrl(this.wrongAudio, () => {
resolve()
if (ctx.questionPlayTimes >= ctx.maxQuestionTryTimes) {
reject()
} else {
resolve()
}
})
});
},
onDone: {
target: 'retry',
actions: raise('CHECK')
target: 'hint',
// actions: raise('CHECK')
},
onError: {
target: 'retry',
target: '#QuestionsArray.next',
actions: raise('CHECK')
}
}
},
retry: {
on: {
CHECK: [
{ target: 'hint' },
{
target: '#QuestionsArray.next',
actions: raise('CHECK'),
cond: (ctx, evt) => {
const c = ctx.questionPlayTimes >= ctx.maxQuestionTryTimes;
// ctx.questionPlayTimes = ctx.questionPlayTimes + 1;
console.log('#QuestionsArray.next', c)
return c
}
}
]
},
},
}
......
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