Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn04_classify
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
sn04_classify
Commits
be749228
Commit
be749228
authored
Sep 13, 2023
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
4804c9ff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
11 deletions
+68
-11
sn04_classify.ts
assets/sn04_classify/scene/sn04_classify.ts
+45
-10
pg_sn04_classify.ts
assets/sn04_classify/scene/tool/pg_sn04_classify.ts
+8
-1
form.component.html
form/src/app/form/form.component.html
+9
-0
form.component.ts
form/src/app/form/form.component.ts
+6
-0
No files found.
assets/sn04_classify/scene/sn04_classify.ts
View file @
be749228
...
...
@@ -144,16 +144,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private
gameOver
()
{
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
let
data
:
any
=
{};
data
.
total
=
Game
.
getIns
().
total
;
data
.
right
=
Game
.
getIns
().
player
.
right
;
data
.
scores
=
Game
.
getIns
().
player
.
voices
;
data
.
stone
=
Math
.
floor
(
10
*
data
.
right
/
data
.
total
);
this
.
log
(
"
total:
"
+
data
.
total
+
"
right:
"
+
data
.
right
+
"
stone:
"
+
data
.
stone
);
onHomeworkFinish
(
data
)
}
gameStart
()
{
Game
.
getIns
().
state
=
GAME_STATE
.
RUNNING
;
...
...
@@ -276,12 +266,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
ice_img
.
active
=
false
;
ice_melt
.
active
=
true
;
img_dian
.
active
=
true
;
target
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
target
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
target
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
this
.
playLocalAudio
(
"
right
"
);
cc
.
tween
(
target
).
delay
(
1.5
).
to
(
0.2
,
{
opacity
:
0
}).
call
(()
=>
{
target
.
parent
=
null
;
target
.
destroy
();
bg_bar_font
.
active
=
true
;
bg_bar_img
.
active
=
false
;
if
(
this
.
layout_card
.
children
.
length
<=
0
)
{
this
.
gameOver
();
}
}).
start
();
...
...
@@ -351,12 +349,49 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
private
sendData
(
score
)
{
return
new
Promise
(
res
=>
{
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
,
};
let
recordList
=
pg
.
hw
.
getRecord
();
if
(
recordList
&&
recordList
.
length
>
0
)
{
upData
.
recordList
=
recordList
}
let
mid
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
mid
)
return
;
const
middleLayer
=
mid
.
getComponent
(
'
middleLayer
'
);
console
.
log
(
'
upload->
'
+
JSON
.
stringify
(
upData
))
middleLayer
.
onHomeworkFinish
(
upData
,
()
=>
{
res
(
''
);
})
})
}
private
gameOver
()
{
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
this
.
sendData
(
this
.
data
.
questions
.
length
*
3
).
then
(()
=>
{
let
mid
=
cc
.
find
(
'
middleLayer
'
);
if
(
!
mid
)
return
;
const
middleLayer
=
mid
.
getComponent
(
'
middleLayer
'
);
middleLayer
.
saveGolds
(
this
.
data
.
questions
.
length
*
3
);
// 保存金币数量; num 是获得金币的数量,数字类
middleLayer
.
goNextPage
();
//跳转到下一页
})
this
.
log
(
"
over~~~~~
"
)
}
private
gameCount
;
private
playCount
=
true
;
update
(
dt
)
{
if
(
Game
.
getIns
().
state
!=
GAME_STATE
.
RUNNING
)
return
;
if
(
!
this
.
gameCount
||
this
.
gameCount
<=
0
)
{
this
.
isFinish
=
true
;
this
.
gameOver
();
return
;
}
if
(
this
.
gameCount
<
9
&&
this
.
playCount
)
{
...
...
assets/sn04_classify/scene/tool/pg_sn04_classify.ts
View file @
be749228
...
...
@@ -612,7 +612,14 @@ let pg = {
const
id
=
cc
.
audioEngine
.
playEffect
(
audio
.
clip
,
loop
);
resolve
(
id
);
})
}
},
records
:
[],
addRecord
(
data
)
{
pg
.
hw
.
records
.
push
(
data
)
},
getRecord
()
{
return
pg
.
hw
.
records
.
concat
();
},
},
event
:
Emitter
.
getInstance
()
};
...
...
form/src/app/form/form.component.html
View file @
be749228
...
...
@@ -79,6 +79,15 @@
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
时间:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
time
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
掌握单词数:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
word_count
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
掌握短语数:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
sentence_count
"
(
blur
)="
save
()"
>
<span
style=
"font-size: 20px;"
>
掌握字数:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
zi_count
"
(
blur
)="
save
()"
>
</div>
<div
style=
"margin: 20px;width: 1000px;"
>
<div
*
ngFor=
"let question of item.questions; let i = index"
>
...
...
form/src/app/form/form.component.ts
View file @
be749228
...
...
@@ -30,6 +30,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
title
:
"
sn04-分类
"
,
time
:
60
,
opleng
:
0
,
word_count
:
'
0
'
,
sentence_count
:
'
0
'
,
zi_count
:
'
0
'
,
};
isVisible
=
false
;
...
...
@@ -48,6 +51,9 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this
.
handleCancel
();
}
init
():
void
{
if
(
!
this
.
item
.
word_count
)
this
.
item
.
word_count
=
'
0
'
;
if
(
!
this
.
item
.
sentence_count
)
this
.
item
.
sentence_count
=
'
0
'
;
if
(
!
this
.
item
.
zi_count
)
this
.
item
.
zi_count
=
'
0
'
;
console
.
log
(
new
MetaFormCreator
().
create
());
}
updateOpleng
()
{
...
...
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