Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Coloring_OL
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
Coloring_OL
Commits
73e22e84
Commit
73e22e84
authored
Jul 12, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
2b3c9c8f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
34 deletions
+107
-34
.DS_Store
.DS_Store
+0
-0
Coloring_OL.meta
assets/Coloring_OL.meta
+1
-15
Coloring_OL.js
assets/Coloring_OL/scene/Coloring_OL.js
+104
-17
util.js
assets/Coloring_OL/script/util.js
+2
-2
No files found.
.DS_Store
View file @
73e22e84
No preview for this file type
assets/Coloring_OL.meta
View file @
73e22e84
{
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
"ver": "1.1.2",
\ No newline at end of file
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
assets/Coloring_OL/scene/Coloring_OL.js
View file @
73e22e84
...
@@ -742,6 +742,7 @@ cc.Class({
...
@@ -742,6 +742,7 @@ cc.Class({
},
},
setPlayerResult
(
data
)
{
setPlayerResult
(
data
)
{
console
.
log
(
'
in setPlayerResult
'
);
const
{
uuid
}
=
data
;
const
{
uuid
}
=
data
;
this
.
gameEndData
[
uuid
]
=
data
;
this
.
gameEndData
[
uuid
]
=
data
;
...
@@ -1050,7 +1051,7 @@ cc.Class({
...
@@ -1050,7 +1051,7 @@ cc.Class({
}
}
const
aiArr
=
this
.
getAiArr
();
const
aiArr
=
this
.
getAiArr
();
if
(
aiArr
.
length
==
0
||
true
)
{
if
(
aiArr
.
length
==
0
)
{
this
.
teacherEnd
();
this
.
teacherEnd
();
return
;
return
;
}
}
...
@@ -1073,45 +1074,116 @@ cc.Class({
...
@@ -1073,45 +1074,116 @@ cc.Class({
// return;
// return;
c
.
getAnswer
({
count
:
aiArr
.
length
},
(
res
)
=>
{
this
.
getAnswer
(
aiArr
);
console
.
log
(
'
getAnswer res:
'
,
res
);
if
(
res
)
{
// this.teacherEnd();
},
async
getAnswer
(
aiArr
)
{
if
(
typeof
(
res
)
==
'
string
'
)
{
const
node
=
cc
.
find
(
'
middleLayer
'
);
if
(
node
)
{
console
.
log
(
'
node exist
'
);
const
mScript
=
node
.
getComponent
(
'
middleLayer
'
);
const
coursewareid
=
mScript
?.
courseItem
?.
id
;
if
(
!
coursewareid
)
{
console
.
log
(
"
!coursewareid~:
"
);
this
.
teacherEnd
();
return
;
}
console
.
log
(
'
~ coursewareid :
'
,
coursewareid
);
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
const
url
=
"
/api/oxford/courseware/v1/
"
+
coursewareid
+
"
/getanswer
"
mScript
.
callNetworkApiGet
(
url
,
{
coursewareid
,
token
,
count
:
aiArr
.
length
},
(
res
)
=>
{
console
.
log
(
"
res~:
"
,
res
);
if
(
typeof
(
res
)
==
"
string
"
)
{
res
=
JSON
.
parse
(
res
);
res
=
JSON
.
parse
(
res
);
console
.
log
(
'
objRes:
'
,
res
);
}
if
(
res
.
code
==
200
)
{
// const rankArr = res.data?.rows || [];
// OP12.rank.inst.onShow(rankArr);
const
rows
=
res
.
data
?.
rows
||
[];
await
this
.
addAiResult
(
rows
,
aiArr
);
// await this.asyncDelay(1);
console
.
log
(
"
res:
"
,
res
);
}
}
this
.
addAiResult
(
res
,
aiArr
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
teacherEnd
();
this
.
teacherEnd
();
},
200
));
},
200
));
// await this.asyncDelay(1
);
}
);
}
else
{
}
else
{
console
.
log
(
'
node not exist
'
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
teacherEnd
();
this
.
teacherEnd
();
},
200
));
},
200
));
}
}
})
// c.getAnswer({ count: aiArr.length }, (res) => {
// console.log('getAnswer res: ', res);
// if (res) {
// if (typeof (res) == 'string') {
// res = JSON.parse(res);
// }
// this.addAiResult(res, aiArr);
// this._timeoutIds.push(setTimeout(() => {
// this.teacherEnd();
// }, 200));
// // await this.asyncDelay(1);
// } else {
// this._timeoutIds.push(setTimeout(() => {
// this.teacherEnd();
// }, 200));
// }
// })
},
},
async
addAiResult
(
data
,
aiArr
)
{
async
addAiResult
(
data
,
aiArr
)
{
console
.
log
(
'
in addAiResult
'
)
console
.
log
(
'
in addAiResult
'
)
const
randomResultArr
=
data
;
const
randomResultArr
=
data
;
for
(
let
i
=
0
;
i
<
aiArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
aiArr
.
length
;
i
++
)
{
const
resultStr
=
randomResultArr
[
i
].
result
;
if
(
!
randomResultArr
[
i
])
{
console
.
log
(
'
break
'
);
break
;
}
const
resultStr
=
randomResultArr
[
i
]?.
result
;
if
(
!
resultStr
)
{
console
.
log
(
'
continue
'
);
continue
;
}
else
{
console
.
log
(
'
resultStr:
'
,
resultStr
);
}
const
result
=
JSON
.
parse
(
resultStr
);
const
result
=
JSON
.
parse
(
resultStr
);
const
aiUser
=
aiArr
[
i
];
const
aiUser
=
aiArr
[
i
];
if
(
aiUser
&&
result
)
{
if
(
aiUser
&&
result
)
{
const
resultData
=
{
teethDataArr
:
result
.
teethDataArr
,
uuid
:
aiUser
.
id
,
isAi
:
true
}
const
resultData
=
{
teethDataArr
:
result
.
teethDataArr
,
uuid
:
aiUser
.
id
,
isAi
:
true
}
this
.
sendServerEvent
(
'
send_result
'
,
resultData
);
this
.
sendServerEvent
(
'
send_result
'
,
resultData
);
await
asyncDelay
(
0.02
);
await
asyncDelay
(
0.02
);
...
@@ -1124,6 +1196,7 @@ cc.Class({
...
@@ -1124,6 +1196,7 @@ cc.Class({
let
aiArr
=
[];
let
aiArr
=
[];
for
(
let
i
=
0
;
i
<
this
.
serverAllUser
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
serverAllUser
.
length
;
i
++
)
{
console
.
log
(
'
serverAllUser[i]:
'
,
this
.
serverAllUser
[
i
]);
if
(
!
this
.
serverAllUser
[
i
].
result
)
{
if
(
!
this
.
serverAllUser
[
i
].
result
)
{
aiArr
.
push
(
this
.
serverAllUser
[
i
]);
aiArr
.
push
(
this
.
serverAllUser
[
i
]);
}
}
...
@@ -1240,7 +1313,7 @@ cc.Class({
...
@@ -1240,7 +1313,7 @@ cc.Class({
this
.
playAudioByName
(
'
result_
'
+
id
,
()
=>
{
this
.
playAudioByName
(
'
result_
'
+
id
,
()
=>
{
playDragonBoneAnimation
(
this
.
coolcat
,
'
normal
'
);
playDragonBoneAnimation
(
this
.
coolcat
,
'
normal
'
);
onHomeworkFinish
();
onHomeworkFinish
(
null
,
null
,
false
);
});
});
},
},
...
@@ -1659,6 +1732,7 @@ cc.Class({
...
@@ -1659,6 +1732,7 @@ cc.Class({
}
}
this
.
isGameEnd
=
true
;
this
.
isGameEnd
=
true
;
this
.
showResultView
()
this
.
showResultView
()
},
},
// gameEnd(){
// gameEnd(){
...
@@ -1856,12 +1930,25 @@ cc.Class({
...
@@ -1856,12 +1930,25 @@ cc.Class({
},
},
sendResult
()
{
sendResult
()
{
return
;
const
data
=
{
teethDataArr
:
this
.
teethDataArr
,
uuid
:
this
.
playerId
};
const
data
=
{
teethDataArr
:
this
.
teethDataArr
,
uuid
:
this
.
playerId
};
if
(
window
&&
window
.
courseware
)
{
const
node
=
cc
.
find
(
'
middleLayer
'
);
window
.
courseware
.
sendAnswer
(
data
);
if
(
node
)
{
console
.
log
(
'
node exist
'
);
const
mScript
=
node
.
getComponent
(
'
middleLayer
'
);
console
.
log
(
'
saveAnswer ~ :
'
,
JSON
.
stringify
(
data
));
mScript
.
saveAnswer
(
data
,
()
=>
{
callback
&&
callback
();
})
}
}
// if (window && window.courseware) {
// window.courseware.sendAnswer(data);
// }
},
},
sendServerEvent
(
key
,
data
)
{
sendServerEvent
(
key
,
data
)
{
...
...
assets/Coloring_OL/script/util.js
View file @
73e22e84
...
@@ -392,12 +392,12 @@ export function showTrebleFirework(baseNode, rabbonList) {
...
@@ -392,12 +392,12 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks
(
right
);
showFireworks
(
right
);
}
}
export
function
onHomeworkFinish
()
{
export
function
onHomeworkFinish
(
cb
,
data
,
isSave
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
middleLayerComponent
.
onHomeworkFinish
(
()
=>
{
}
);
middleLayerComponent
.
onHomeworkFinish
(
cb
,
data
,
isSave
);
}
}
}
else
{
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
console
.
log
(
'
onHomeworkFinish
'
);
...
...
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