Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AK09
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
AK09
Commits
9669e4ad
Commit
9669e4ad
authored
May 10, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 不同步的问题
parent
9eb13bc0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
59 deletions
+65
-59
AK09.js
play/assets/AK09/scene/AK09.js
+61
-55
build.sh
publish/build.sh
+3
-3
config.json
publish/publish/config.json
+1
-1
No files found.
play/assets/AK09/scene/AK09.js
View file @
9669e4ad
...
@@ -303,13 +303,13 @@ cc.Class({
...
@@ -303,13 +303,13 @@ cc.Class({
await
this
.
showQuestion
();
await
this
.
showQuestion
();
next
();
next
();
});
});
window
.
courseware
.
onEvent
(
'
hideOption
'
,
(
data
,
next
)
=>
{
window
.
courseware
.
onEvent
(
'
hideOption
'
,
async
(
data
,
next
)
=>
{
this
.
hideOption
();
await
this
.
hideOption
();
this
.
updateStatus
(
data
.
status
);
this
.
updateStatus
(
data
.
status
);
next
();
next
();
});
});
window
.
courseware
.
onEvent
(
'
hideQuestion
'
,
(
data
,
next
)
=>
{
window
.
courseware
.
onEvent
(
'
hideQuestion
'
,
async
(
data
,
next
)
=>
{
this
.
hideQuestion
();
await
this
.
hideQuestion
();
this
.
updateStatus
(
data
.
status
);
this
.
updateStatus
(
data
.
status
);
next
();
next
();
});
});
...
@@ -332,6 +332,8 @@ cc.Class({
...
@@ -332,6 +332,8 @@ cc.Class({
tipNode
.
active
=
this
.
teachFlag
;
tipNode
.
active
=
this
.
teachFlag
;
},
},
gameEnd
:
false
,
isShowTemplateEndAnima
:
false
,
updateStatus
(
status
)
{
updateStatus
(
status
)
{
this
.
_status
=
status
;
this
.
_status
=
status
;
this
.
_status
.
options
.
forEach
((
optionData
,
idx
)
=>
{
this
.
_status
.
options
.
forEach
((
optionData
,
idx
)
=>
{
...
@@ -350,9 +352,11 @@ cc.Class({
...
@@ -350,9 +352,11 @@ cc.Class({
}
}
});
});
const
allOptionSelected
=
this
.
_status
.
options
.
every
(
optionData
=>
optionData
.
selected
);
const
allOptionSelected
=
this
.
_status
.
options
.
every
(
optionData
=>
optionData
.
selected
);
if
(
this
.
_status
.
quesion
.
selected
&&
allOptionSelected
)
{
this
.
gameEnd
=
this
.
_status
.
quesion
.
selected
&&
allOptionSelected
;
if
(
this
.
gameEnd
&&
!
this
.
isShowTemplateEndAnima
)
{
this
.
isShowTemplateEndAnima
=
true
;
cc
.
tween
({}).
delay
(
2
).
call
(()
=>
{
cc
.
tween
({}).
delay
(
2
).
call
(()
=>
{
this
.
showTemplateEndAnima
();
this
.
showTemplateEndAnima
();
}).
start
();
}).
start
();
...
@@ -371,6 +375,9 @@ cc.Class({
...
@@ -371,6 +375,9 @@ cc.Class({
starOff
.
opacity
=
255
;
starOff
.
opacity
=
255
;
}
}
}
}
this
.
_status
.
currentShowOptionIdx
=
null
;
this
.
_status
.
currentShowQuestion
=
false
;
},
},
initOptions
()
{
initOptions
()
{
...
@@ -444,15 +451,11 @@ cc.Class({
...
@@ -444,15 +451,11 @@ cc.Class({
if
(
!
optionNode
)
{
if
(
!
optionNode
)
{
console
.
log
(
"
!optionNode:
"
);
console
.
log
(
"
!optionNode:
"
);
return
;
return
;
}
}
this
.
_status
.
currentShowOptionIdx
=
idx
;
this
.
_status
.
currentShowOptionIdx
=
idx
;
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
cc
.
tween
(
mask
).
to
(
0.5
,
{
opacity
:
255
}).
start
();
const
maskBase
=
cc
.
find
(
'
Canvas/bg/maskBase
'
);
const
maskBase
=
cc
.
find
(
'
Canvas/bg/maskBase
'
);
const
oldPosition
=
optionNode
.
getPosition
();
const
oldPosition
=
optionNode
.
getPosition
();
const
newPos
=
maskBase
.
convertToNodeSpaceAR
(
const
newPos
=
maskBase
.
convertToNodeSpaceAR
(
...
@@ -461,12 +464,20 @@ cc.Class({
...
@@ -461,12 +464,20 @@ cc.Class({
optionNode
.
parent
=
maskBase
;
optionNode
.
parent
=
maskBase
;
optionNode
.
setPosition
(
newPos
);
optionNode
.
setPosition
(
newPos
);
optionNode
.
oldPosition
=
cc
.
v2
(
oldPosition
.
x
,
oldPosition
.
y
);
optionNode
.
oldPosition
=
cc
.
v2
(
oldPosition
.
x
,
oldPosition
.
y
);
await
asyncTweenTo
(
optionNode
,
0.6
,
{
x
:
0
,
y
:
0
,
scale
:
1.7
},
{
easing
:
'
sineInOut
'
});
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
await
Promise
.
all
([
asyncTweenTo
(
mask
,
0.5
,
{
opacity
:
255
}),
asyncTweenTo
(
optionNode
,
0.6
,
{
x
:
0
,
y
:
0
,
scale
:
1.7
},
{
easing
:
'
sineInOut
'
})
]);
const
imageStarOn
=
optionNode
.
getChildByName
(
'
ImageStarOn
'
);
const
imageStarOn
=
optionNode
.
getChildByName
(
'
ImageStarOn
'
);
const
imageStarOff
=
optionNode
.
getChildByName
(
'
ImageStarOff
'
);
const
imageStarOff
=
optionNode
.
getChildByName
(
'
ImageStarOff
'
);
asyncTweenTo
(
imageStarOn
,
0.2
,
{
opacity
:
255
});
asyncTweenTo
(
imageStarOff
,
0.2
,
{
opacity
:
0
});
await
Promise
.
all
([
asyncTweenTo
(
imageStarOn
,
0.2
,
{
opacity
:
255
}),
asyncTweenTo
(
imageStarOff
,
0.2
,
{
opacity
:
0
})
]);
this
.
_status
.
options
[
idx
].
selected
=
true
;
this
.
_status
.
options
[
idx
].
selected
=
true
;
this
.
playAudioByNodeName
(
'
right
'
);
this
.
playAudioByNodeName
(
'
right
'
);
...
@@ -481,42 +492,38 @@ cc.Class({
...
@@ -481,42 +492,38 @@ cc.Class({
await
asyncTweenTo
(
label
,
0.15
,
{
scale
:
1.1
},
{
easing
:
'
sineIn
'
});
await
asyncTweenTo
(
label
,
0.15
,
{
scale
:
1.1
},
{
easing
:
'
sineIn
'
});
await
asyncTweenTo
(
label
,
0.1
,
{
scale
:
1
},
{
easing
:
'
sineOut
'
});
await
asyncTweenTo
(
label
,
0.1
,
{
scale
:
1
},
{
easing
:
'
sineOut
'
});
await
asyncDelay
(
2
);
await
asyncDelay
(
2
);
this
.
sendServerEvent
(
'
hideOption
'
,
{
data
:
{
idx
:
idx
},
status
:
this
.
_status
});
if
(
this
.
teachFlag
)
{
// 以老师的同步消息为准
this
.
sendServerEvent
(
'
hideOption
'
,
{
data
:
{
idx
:
idx
},
status
:
this
.
_status
});
}
},
},
hideOption
()
{
async
hideOption
()
{
const
idx
=
this
.
_status
.
currentShowOptionIdx
;
const
idx
=
this
.
_status
.
currentShowOptionIdx
;
if
(
idx
===
null
)
{
if
(
idx
===
null
)
{
console
.
log
(
'
idx =
'
+
idx
);
return
;
return
;
}
}
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
cc
.
tween
(
mask
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
const
optionNode
=
cc
.
find
(
`Canvas/bg/maskBase/option_
${
idx
}
`
);
const
optionNode
=
cc
.
find
(
`Canvas/bg/maskBase/option_
${
idx
}
`
);
if
(
!
optionNode
)
{
if
(
!
optionNode
)
{
console
.
log
(
'
optionNode is null
'
);
console
.
log
(
'
optionNode is null
'
);
return
;
return
;
}
}
const
optionBase
=
cc
.
find
(
`Canvas/bg/book/option`
);
const
optionBase
=
cc
.
find
(
`Canvas/bg/book/option`
);
const
maskBase
=
cc
.
find
(
'
Canvas/bg/maskBase
'
);
const
maskBase
=
cc
.
find
(
'
Canvas/bg/maskBase
'
);
const
movePos
=
maskBase
.
convertToNodeSpaceAR
(
const
movePos
=
maskBase
.
convertToNodeSpaceAR
(
optionBase
.
convertToWorldSpaceAR
(
optionNode
.
oldPosition
)
optionBase
.
convertToWorldSpaceAR
(
optionNode
.
oldPosition
)
);
);
if
(
!
optionNode
.
hideAction
)
{
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
optionNode
.
hideAction
=
cc
.
tween
(
optionNode
)
await
Promise
.
all
([
.
to
(
0.6
,
{
x
:
movePos
.
x
,
y
:
movePos
.
y
,
scale
:
1
},
{
easing
:
'
sineInOut
'
})
asyncTweenTo
(
mask
,
0.5
,
{
opacity
:
0
}),
.
call
(()
=>
{
asyncTweenTo
(
optionNode
,
0.6
,
{
x
:
movePos
.
x
,
y
:
movePos
.
y
,
scale
:
1
},
{
easing
:
'
sineInOut
'
})
optionNode
.
parent
=
optionBase
;
]);
optionNode
.
setPosition
(
optionNode
.
oldPosition
);
optionNode
.
hideAction
=
null
;
optionNode
.
parent
=
optionBase
;
this
.
_status
.
currentShowOptionIdx
=
null
;
optionNode
.
setPosition
(
optionNode
.
oldPosition
);
})
.
start
();
}
},
},
async
showQuestion
()
{
async
showQuestion
()
{
...
@@ -527,10 +534,7 @@ cc.Class({
...
@@ -527,10 +534,7 @@ cc.Class({
}
}
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
cc
.
tween
(
mask
).
to
(
0.5
,
{
opacity
:
255
}).
start
();
const
questionBg
=
questionNode
.
getChildByName
(
'
bg
'
);
const
questionBg
=
questionNode
.
getChildByName
(
'
bg
'
);
cc
.
tween
(
questionBg
).
to
(
0.5
,
{
opacity
:
255
}).
start
();
const
oldPosition
=
questionNode
.
getPosition
();
const
oldPosition
=
questionNode
.
getPosition
();
questionNode
.
oldPosition
=
oldPosition
;
questionNode
.
oldPosition
=
oldPosition
;
...
@@ -541,13 +545,20 @@ cc.Class({
...
@@ -541,13 +545,20 @@ cc.Class({
);
);
questionNode
.
parent
=
maskBase
;
questionNode
.
parent
=
maskBase
;
questionNode
.
setPosition
(
newPos
);
questionNode
.
setPosition
(
newPos
);
await
asyncTweenTo
(
questionNode
,
0.6
,
{
x
:
0
,
y
:
0
,
scale
:
1.4
},
{
easing
:
'
sineInOut
'
});
await
Promise
.
all
([
asyncTweenTo
(
mask
,
0.5
,
{
opacity
:
255
}),
asyncTweenTo
(
questionBg
,
0.5
,
{
opacity
:
255
}),
asyncTweenTo
(
questionNode
,
0.6
,
{
x
:
0
,
y
:
0
,
scale
:
1.4
},
{
easing
:
'
sineInOut
'
})
]);
this
.
playAudioByNodeName
(
'
right
'
);
this
.
playAudioByNodeName
(
'
right
'
);
const
starOn
=
cc
.
find
(
'
questionLayout/starNode/ImageStarOn
'
,
questionNode
);
const
starOn
=
cc
.
find
(
'
questionLayout/starNode/ImageStarOn
'
,
questionNode
);
const
starOff
=
cc
.
find
(
'
questionLayout/starNode/ImageStarOff
'
,
questionNode
);
const
starOff
=
cc
.
find
(
'
questionLayout/starNode/ImageStarOff
'
,
questionNode
);
asyncTweenTo
(
starOn
,
0.2
,
{
opacity
:
255
});
await
asyncTweenTo
(
starOff
,
0.2
,
{
opacity
:
0
});
await
Promise
.
all
([
asyncTweenTo
(
starOn
,
0.2
,
{
opacity
:
255
}),
asyncTweenTo
(
starOff
,
0.2
,
{
opacity
:
0
})
]);
this
.
_status
.
quesion
.
selected
=
true
;
this
.
_status
.
quesion
.
selected
=
true
;
...
@@ -556,7 +567,10 @@ cc.Class({
...
@@ -556,7 +567,10 @@ cc.Class({
await
asyncTweenTo
(
label
,
0.2
,
{
scale
:
1.0
},
{
easing
:
'
sineInOut
'
});
await
asyncTweenTo
(
label
,
0.2
,
{
scale
:
1.0
},
{
easing
:
'
sineInOut
'
});
}
}
await
asyncDelay
(
2
);
await
asyncDelay
(
2
);
this
.
sendServerEvent
(
'
hideQuestion
'
,
{
data
:
null
,
status
:
this
.
_status
});
if
(
this
.
teachFlag
)
{
// 以老师的同步消息为准
this
.
sendServerEvent
(
'
hideQuestion
'
,
{
data
:
null
,
status
:
this
.
_status
});
}
},
},
async
hideQuestion
()
{
async
hideQuestion
()
{
...
@@ -566,29 +580,21 @@ cc.Class({
...
@@ -566,29 +580,21 @@ cc.Class({
}
}
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
const
mask
=
cc
.
find
(
'
Canvas/bg/maskBase/mask
'
);
cc
.
tween
(
mask
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
const
questionBg
=
questionNode
.
getChildByName
(
'
bg
'
);
const
questionBg
=
questionNode
.
getChildByName
(
'
bg
'
);
cc
.
tween
(
questionBg
).
to
(
0.5
,
{
opacity
:
0
}).
start
();
const
questionBase
=
cc
.
find
(
'
Canvas/bg/book/question
'
);
const
questionBase
=
cc
.
find
(
'
Canvas/bg/book/question
'
);
const
newPos
=
questionNode
.
parent
.
convertToNodeSpaceAR
(
const
newPos
=
questionNode
.
parent
.
convertToNodeSpaceAR
(
questionBase
.
convertToWorldSpaceAR
(
questionNode
.
oldPosition
)
questionBase
.
convertToWorldSpaceAR
(
questionNode
.
oldPosition
)
);
);
if
(
!
questionNode
.
hideAction
)
{
await
Promise
.
all
([
questionNode
.
hideAction
=
cc
.
tween
(
questionNode
)
asyncTweenTo
(
mask
,
0.5
,
{
opacity
:
0
}),
.
to
(
0.6
,
{
x
:
newPos
.
x
,
y
:
newPos
.
y
,
scale
:
1
},
{
easing
:
'
sineInOut
'
})
asyncTweenTo
(
questionBg
,
0.5
,
{
opacity
:
0
}),
.
call
(()
=>
{
asyncTweenTo
(
questionNode
,
0.6
,
{
x
:
newPos
.
x
,
y
:
newPos
.
y
,
scale
:
1
},
{
easing
:
'
sineInOut
'
})
questionNode
.
parent
=
questionBase
;
]);
questionNode
.
x
=
questionNode
.
oldPosition
.
x
;
questionNode
.
parent
=
questionBase
;
questionNode
.
y
=
questionNode
.
oldPosition
.
y
;
questionNode
.
x
=
questionNode
.
oldPosition
.
x
;
this
.
_status
.
currentShowQuestion
=
false
;
questionNode
.
y
=
questionNode
.
oldPosition
.
y
;
questionNode
.
hideAction
=
null
;
})
.
start
();
}
},
},
playAudioByNodeName
(
name
)
{
playAudioByNodeName
(
name
)
{
...
...
publish/build.sh
View file @
9669e4ad
...
@@ -8,11 +8,11 @@ node build_check.js
...
@@ -8,11 +8,11 @@ node build_check.js
set
+e
set
+e
#
cd ../form
cd
../form
#
npm install
npm
install
#
npm run publish
npm run publish
cd
../publish
cd
../publish
...
...
publish/publish/config.json
View file @
9669e4ad
{
"ios"
:{
"sceneName"
:
"AK09"
,
"version"
:
"2a5a4"
},
"android"
:{
"sceneName"
:
"AK09"
,
"version"
:
"2a5a4"
}}
{
"ios"
:{
"sceneName"
:
"AK09"
,
"version"
:
""
},
"android"
:{
"sceneName"
:
"AK09"
,
"version"
:
""
}}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment