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
1ad5a620
Commit
1ad5a620
authored
Jul 12, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 上报成绩 ai成绩
parent
73e22e84
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
13 deletions
+65
-13
.DS_Store
.DS_Store
+0
-0
Coloring_OL.meta
assets/Coloring_OL.meta
+15
-1
Coloring_OL.js
assets/Coloring_OL/scene/Coloring_OL.js
+50
-12
No files found.
.DS_Store
View file @
1ad5a620
No preview for this file type
assets/Coloring_OL.meta
View file @
1ad5a620
{"ver":"1.1.2","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
"ver": "1.1.2",
"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 @
1ad5a620
...
@@ -2,12 +2,13 @@ import { onHomeworkFinish, RandomInt, playAudio, playDragonBoneAnimation, getSpr
...
@@ -2,12 +2,13 @@ import { onHomeworkFinish, RandomInt, playAudio, playDragonBoneAnimation, getSpr
import
{
defaultData
}
from
"
../script/defaultData
"
;
import
{
defaultData
}
from
"
../script/defaultData
"
;
import
{
GameServer
}
from
"
../script/server
"
;
import
{
GameServer
}
from
"
../script/server
"
;
import
{
NetworkHelper
}
from
"
../script/NetworkHelper
"
;
import
{
NetworkHelper
}
from
"
../script/NetworkHelper
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
cc
.
Class
({
cc
.
Class
({
extends
:
MyCocosSceneComponent
,
//
cc.Component,
extends
:
cc
.
Component
,
properties
:
{
properties
:
{
paint
:
{
paint
:
{
...
@@ -632,7 +633,7 @@ cc.Class({
...
@@ -632,7 +633,7 @@ cc.Class({
return
;
return
;
case
'
send_result
'
:
case
'
send_result
'
:
console
.
log
(
'
in send_result ~
'
);
console
.
log
(
'
in send_result ~
'
,
JSON
.
stringify
(
res
.
data
)
);
this
.
setPlayerResult
(
res
.
data
);
this
.
setPlayerResult
(
res
.
data
);
return
;
return
;
...
@@ -873,7 +874,7 @@ cc.Class({
...
@@ -873,7 +874,7 @@ cc.Class({
const
arr
=
this
.
serverAllUser
;
const
arr
=
this
.
serverAllUser
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
console
.
log
(
'
this.serverAllUser[i]
.id:
'
,
this
.
serverAllUser
[
i
]
);
console
.
log
(
'
this.serverAllUser[i]
:
'
,
JSON
.
stringify
(
this
.
serverAllUser
[
i
])
);
console
.
log
(
'
uuid:
'
,
uuid
);
console
.
log
(
'
uuid:
'
,
uuid
);
if
(
this
.
serverAllUser
[
i
].
playerId
==
uuid
)
{
if
(
this
.
serverAllUser
[
i
].
playerId
==
uuid
)
{
return
this
.
serverAllUser
[
i
].
name
;
return
this
.
serverAllUser
[
i
].
name
;
...
@@ -1097,7 +1098,7 @@ cc.Class({
...
@@ -1097,7 +1098,7 @@ cc.Class({
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
const
token
=
cc
.
sys
.
localStorage
.
getItem
(
'
token
'
);
const
url
=
"
/api/oxford/courseware/v1/
"
+
coursewareid
+
"
/getanswer
"
const
url
=
"
/api/oxford/courseware/v1/
"
+
coursewareid
+
"
/getanswer
"
mScript
.
callNetworkApiGet
(
url
,
{
coursewareid
,
token
,
count
:
aiArr
.
length
},
(
res
)
=>
{
mScript
.
callNetworkApiGet
(
url
,
{
coursewareid
,
token
,
count
:
aiArr
.
length
},
async
(
res
)
=>
{
console
.
log
(
"
res~:
"
,
res
);
console
.
log
(
"
res~:
"
,
res
);
if
(
typeof
(
res
)
==
"
string
"
)
{
if
(
typeof
(
res
)
==
"
string
"
)
{
...
@@ -1110,7 +1111,7 @@ cc.Class({
...
@@ -1110,7 +1111,7 @@ cc.Class({
// OP12.rank.inst.onShow(rankArr);
// OP12.rank.inst.onShow(rankArr);
const
rows
=
res
.
data
?.
rows
||
[];
const
rows
=
res
?.
rows
||
[];
await
this
.
addAiResult
(
rows
,
aiArr
);
await
this
.
addAiResult
(
rows
,
aiArr
);
...
@@ -1168,8 +1169,8 @@ cc.Class({
...
@@ -1168,8 +1169,8 @@ cc.Class({
for
(
let
i
=
0
;
i
<
aiArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
aiArr
.
length
;
i
++
)
{
if
(
!
randomResultArr
[
i
])
{
if
(
!
randomResultArr
[
i
])
{
console
.
log
(
'
break
'
);
console
.
log
(
'
continue ~
'
);
break
;
continue
;
}
}
const
resultStr
=
randomResultArr
[
i
]?.
result
;
const
resultStr
=
randomResultArr
[
i
]?.
result
;
if
(
!
resultStr
)
{
if
(
!
resultStr
)
{
...
@@ -1184,9 +1185,9 @@ cc.Class({
...
@@ -1184,9 +1185,9 @@ cc.Class({
const
aiUser
=
aiArr
[
i
];
const
aiUser
=
aiArr
[
i
];
if
(
aiUser
&&
result
)
{
if
(
aiUser
&&
result
)
{
const
resultData
=
{
teethDataArr
:
result
.
teethDataArr
,
uuid
:
aiUser
.
i
d
,
isAi
:
true
}
const
resultData
=
{
teethDataArr
:
result
.
teethDataArr
,
uuid
:
aiUser
.
playerI
d
,
isAi
:
true
}
this
.
sendServerEvent
(
'
send_result
'
,
resultData
);
this
.
sendServerEvent
(
'
send_result
'
,
resultData
);
await
asyncDelay
(
0.02
);
//
await asyncDelay(0.02);
}
}
}
}
...
@@ -1300,6 +1301,9 @@ cc.Class({
...
@@ -1300,6 +1301,9 @@ cc.Class({
isGoodEnd
:
null
,
isGoodEnd
:
null
,
countDownEnd
()
{
countDownEnd
()
{
this
.
isGoodEnd
=
true
;
this
.
isGoodEnd
=
true
;
const
rank
=
this
.
getRank
();
if
(
this
.
selfScore
==
0
)
{
if
(
this
.
selfScore
==
0
)
{
this
.
sendServerEvent
(
'
get_good
'
,
this
.
playerId
)
this
.
sendServerEvent
(
'
get_good
'
,
this
.
playerId
)
}
}
...
@@ -1309,15 +1313,36 @@ cc.Class({
...
@@ -1309,15 +1313,36 @@ cc.Class({
id
=
1
;
id
=
1
;
}
}
const
data
=
{
teethDataArr
:
this
.
teethDataArr
,
uuid
:
this
.
playerId
,
rank
:
rank
};
console
.
log
(
'
send data:
'
,
JSON
.
stringify
(
data
));
playDragonBoneAnimation
(
this
.
coolcat
,
'
begin
'
,
-
1
);
playDragonBoneAnimation
(
this
.
coolcat
,
'
begin
'
,
-
1
);
this
.
playAudioByName
(
'
result_
'
+
id
,
()
=>
{
this
.
playAudioByName
(
'
result_
'
+
id
,
()
=>
{
playDragonBoneAnimation
(
this
.
coolcat
,
'
normal
'
);
playDragonBoneAnimation
(
this
.
coolcat
,
'
normal
'
);
onHomeworkFinish
(
null
,
null
,
false
);
onHomeworkFinish
(
data
);
});
});
},
},
getRank
()
{
let
maxScore
=
0
;
for
(
let
i
=
0
;
i
<
this
.
resultItemArr
.
length
;
i
++
)
{
const
item
=
this
.
resultItemArr
[
i
];
const
score
=
Number
(
item
.
scoreLabel
.
string
);
// item.score = score;
if
(
maxScore
<
score
)
{
maxScore
=
score
;
}
}
const
rank
=
maxScore
-
this
.
selfScore
+
1
;
return
rank
;
},
getCountDownLabel
()
{
getCountDownLabel
()
{
const
label
=
this
.
getScoreLabel
();
const
label
=
this
.
getScoreLabel
();
return
label
;
return
label
;
...
@@ -1369,6 +1394,9 @@ cc.Class({
...
@@ -1369,6 +1394,9 @@ cc.Class({
this
.
log
(
teethDataArr
.
length
+
"
_endData:
"
+
JSON
.
stringify
(
teethDataArr
));
this
.
log
(
teethDataArr
.
length
+
"
_endData:
"
+
JSON
.
stringify
(
teethDataArr
));
console
.
log
(
'
key:
'
,
id
);
console
.
log
(
"
itemData:
"
,
JSON
.
stringify
(
itemData
));
const
item
=
await
this
.
getOneItem
(
teethDataArr
,
id
);
const
item
=
await
this
.
getOneItem
(
teethDataArr
,
id
);
item
.
x
=
(
item
.
width
+
50
)
*
a
[
s
][
0
];
item
.
x
=
(
item
.
width
+
50
)
*
a
[
s
][
0
];
item
.
y
=
(
item
.
height
+
50
)
*
a
[
s
][
1
];
item
.
y
=
(
item
.
height
+
50
)
*
a
[
s
][
1
];
...
@@ -1969,6 +1997,16 @@ cc.Class({
...
@@ -1969,6 +1997,16 @@ cc.Class({
// }
// }
},
},
log
(
str
)
{
const
node
=
cc
.
find
(
'
middleLayer
'
);
if
(
node
){
node
.
getComponent
(
'
middleLayer
'
).
log
(
str
);
}
else
{
cc
.
log
(
str
);
}
},
update
(
dt
)
{
update
(
dt
)
{
this
.
updateTimer
(
dt
)
this
.
updateTimer
(
dt
)
},
},
...
...
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