Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn14_dds
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
sn14_dds
Commits
4a2beb41
Commit
4a2beb41
authored
Nov 04, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码注入
parent
ed67cc90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
23 deletions
+40
-23
sn14_dds.ts
assets/sn14_dds/scene/sn14_dds.ts
+40
-11
hy11.meta
assets/sn14_dds/textures/hy11.meta
+0
-12
No files found.
assets/sn14_dds/scene/sn14_dds.ts
View file @
4a2beb41
...
...
@@ -53,6 +53,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
.
sort
((
A
,
B
)
=>
Math
.
random
()
-
0.5
)
.
sort
((
A
,
B
)
=>
Math
.
random
()
-
0.5
)
})
this
.
setTotalCount
(
this
.
data
.
questions
.
length
)
}
initView
()
{
}
initEvent
()
{
...
...
@@ -70,20 +71,42 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initGame
();
}
sendData
(
score
)
{
private
rightCount
:
number
;
private
errorCount
:
number
;
private
totalCount
:
number
;
addRightCount
()
{
if
(
!
this
.
rightCount
)
this
.
rightCount
=
0
;
this
.
rightCount
++
;
}
addErrorCount
()
{
if
(
!
this
.
errorCount
)
this
.
errorCount
=
0
;
this
.
errorCount
++
;
}
setTotalCount
(
val
)
{
this
.
totalCount
=
val
;
}
sendData
()
{
return
new
Promise
(
res
=>
{
if
(
!
this
.
totalCount
)
this
.
totalCount
=
this
.
rightCount
+
this
.
errorCount
;
if
(
!
this
.
totalCount
)
console
.
error
(
'
未设置总计数
'
);
if
(
this
.
totalCount
&&
!
this
.
rightCount
&&
!
this
.
errorCount
)
{
this
.
rightCount
=
this
.
totalCount
;
this
.
errorCount
=
0
;
}
let
upData
:
any
=
{
word_count
:
this
.
data
.
word_count
||
0
,
sentence_count
:
this
.
data
.
sentence_count
||
0
,
zi_count
:
this
.
data
.
zi_count
||
0
,
score
:
score
||
0
,
right_count
:
this
.
rightCount
||
0
,
wrong_count
:
this
.
errorCount
||
0
,
total_count
:
this
.
totalCount
||
0
,
};
upData
.
score
=
upData
.
right_count
||
0
;
let
recordList
=
pg
.
hw
.
getRecord
();
if
(
recordList
&&
recordList
.
length
>
0
)
{
upData
.
re
cordLis
t
=
recordList
upData
.
re
sul
t
=
recordList
}
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
console
.
log
(
'
upload->
'
+
JSON
.
stringify
(
upData
))
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
middleLayer
.
onHomeworkFinish
(
upData
,
()
=>
{
res
(
''
);
})
...
...
@@ -91,10 +114,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
gameOver
()
{
this
.
sendData
(
this
.
data
.
questions
.
length
*
3
).
then
(()
=>
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
).
getComponent
(
'
middleLayer
'
);
middleLayer
.
saveGolds
(
this
.
data
.
questions
.
length
*
3
);
// 保存金币数量;num 是获得金币的数量,数字类型;
middleLayer
.
goNextPage
();
// 跳转到下一页
this
.
sendData
().
then
(()
=>
{
if
(
!
cc
.
find
(
'
middleLayer
'
))
return
;
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
goNextPage
();
return
;
}
else
{
console
.
log
(
"
[onFinish] middleLayer not found
"
)
}
})
}
private
rightList
:
Array
<
any
>
;
...
...
assets/sn14_dds/textures/hy11.meta
deleted
100644 → 0
View file @
ed67cc90
{
"ver": "1.1.2",
"uuid": "93731c49-28d4-4208-9880-d1c9fb139190",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ 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