Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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
middleLayer_for_kyxq
Commits
ce1a1fd0
Commit
ce1a1fd0
authored
Nov 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化学习报告数字显示
parent
77236077
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
130 deletions
+159
-130
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+51
-48
LessonReport.ts
assets/middleLayer_for_kyxq/script/LessonReport.ts
+88
-81
util.ts
assets/middleLayer_for_kyxq/script/util.ts
+20
-1
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ce1a1fd0
...
@@ -14801,7 +14801,7 @@
...
@@ -14801,7 +14801,7 @@
"horizontal": true,
"horizontal": true,
"vertical": false,
"vertical": false,
"inertia": true,
"inertia": true,
"brake": 0.
75
,
"brake": 0.
3
,
"elastic": true,
"elastic": true,
"bounceDuration": 0.23,
"bounceDuration": 0.23,
"scrollEvents": [],
"scrollEvents": [],
...
@@ -19608,7 +19608,7 @@
...
@@ -19608,7 +19608,7 @@
"horizontal": true,
"horizontal": true,
"vertical": false,
"vertical": false,
"inertia": true,
"inertia": true,
"brake": 0.
75
,
"brake": 0.
3
,
"elastic": true,
"elastic": true,
"bounceDuration": 0.23,
"bounceDuration": 0.23,
"scrollEvents": [],
"scrollEvents": [],
...
@@ -25396,7 +25396,7 @@
...
@@ -25396,7 +25396,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-570,
-570,
20
5
,
20
0
,
0,
0,
0,
0,
0,
0,
...
@@ -25759,19 +25759,19 @@
...
@@ -25759,19 +25759,19 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width":
84.2
,
"width":
263.16
,
"height": 50.4
"height": 50.4
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x":
0.5
,
"x":
1
,
"y": 0.5
"y": 0.5
},
},
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-
400
,
-
285.003
,
-302,
-302,
0,
0,
0,
0,
...
@@ -25811,8 +25811,8 @@
...
@@ -25811,8 +25811,8 @@
],
],
"_srcBlendFactor": 770,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_dstBlendFactor": 771,
"_string": "
Lable
",
"_string": "
2023.11.11 未学过
",
"_N$string": "
Lable
",
"_N$string": "
2023.11.11 未学过
",
"_fontSize": 36,
"_fontSize": 36,
"_lineHeight": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_enableWrapText": true,
...
@@ -27883,8 +27883,8 @@
...
@@ -27883,8 +27883,8 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 1
29.13
,
"width": 1
36.11
,
"height":
75.6
"height":
98.28
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -27937,8 +27937,8 @@
...
@@ -27937,8 +27937,8 @@
"_dstBlendFactor": 771,
"_dstBlendFactor": 771,
"_string": "93%",
"_string": "93%",
"_N$string": "93%",
"_N$string": "93%",
"_fontSize": 7
4
,
"_fontSize": 7
8
,
"_lineHeight":
60
,
"_lineHeight":
78
,
"_enableWrapText": true,
"_enableWrapText": true,
"_N$file": {
"_N$file": {
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
...
@@ -27948,8 +27948,8 @@
...
@@ -27948,8 +27948,8 @@
"_batchAsBitmap": false,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_styleFlags": 1,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign":
0
,
"_N$horizontalAlign":
1
,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 0,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -27981,7 +27981,7 @@
...
@@ -27981,7 +27981,7 @@
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 129.13,
"width": 129.13,
"height":
75.6
"height":
93.24
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -28035,7 +28035,7 @@
...
@@ -28035,7 +28035,7 @@
"_string": "93%",
"_string": "93%",
"_N$string": "93%",
"_N$string": "93%",
"_fontSize": 74,
"_fontSize": 74,
"_lineHeight":
60
,
"_lineHeight":
74
,
"_enableWrapText": true,
"_enableWrapText": true,
"_N$file": {
"_N$file": {
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
...
@@ -28045,8 +28045,8 @@
...
@@ -28045,8 +28045,8 @@
"_batchAsBitmap": false,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign":
0
,
"_N$horizontalAlign":
1
,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 0,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -28225,8 +28225,8 @@
...
@@ -28225,8 +28225,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-30
1
,
-30
0
,
-
79.662
,
-
80
,
0,
0,
0,
0,
0,
0,
...
@@ -28276,7 +28276,7 @@
...
@@ -28276,7 +28276,7 @@
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width": 120,
"width": 120,
"height":
75.6
"height":
93.24
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -28287,8 +28287,8 @@
...
@@ -28287,8 +28287,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
4.882
,
5
,
-8.622
,
0
,
0,
0,
0,
0,
0,
0,
...
@@ -28330,7 +28330,7 @@
...
@@ -28330,7 +28330,7 @@
"_string": "42",
"_string": "42",
"_N$string": "42",
"_N$string": "42",
"_fontSize": 74,
"_fontSize": 74,
"_lineHeight":
80
,
"_lineHeight":
74
,
"_enableWrapText": false,
"_enableWrapText": false,
"_N$file": {
"_N$file": {
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
...
@@ -28341,7 +28341,7 @@
...
@@ -28341,7 +28341,7 @@
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 2,
"_N$horizontalAlign": 2,
"_N$verticalAlign":
2
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 2,
"_N$overflow": 2,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -28377,15 +28377,15 @@
...
@@ -28377,15 +28377,15 @@
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x": 0
.5
,
"x": 0,
"y": 0.5
"y": 0.5
},
},
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
40.8
,
15
,
-1
8.8
,
-1
2
,
0,
0,
0,
0,
0,
0,
...
@@ -28438,7 +28438,7 @@
...
@@ -28438,7 +28438,7 @@
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 0,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -28617,8 +28617,8 @@
...
@@ -28617,8 +28617,8 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
-2
,
0
,
-
79.662
,
-
80
,
0,
0,
0,
0,
0,
0,
...
@@ -28679,7 +28679,7 @@
...
@@ -28679,7 +28679,7 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
18.92
5,
5,
0,
0,
0,
0,
0,
0,
...
@@ -28722,7 +28722,7 @@
...
@@ -28722,7 +28722,7 @@
"_string": "52",
"_string": "52",
"_N$string": "52",
"_N$string": "52",
"_fontSize": 74,
"_fontSize": 74,
"_lineHeight":
60
,
"_lineHeight":
74
,
"_enableWrapText": true,
"_enableWrapText": true,
"_N$file": {
"_N$file": {
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
...
@@ -28769,15 +28769,15 @@
...
@@ -28769,15 +28769,15 @@
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x": 0
.5
,
"x": 0,
"y": 0.5
"y": 0.5
},
},
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
43
,
15
,
-
20
,
-
12
,
0,
0,
0,
0,
0,
0,
...
@@ -28830,7 +28830,7 @@
...
@@ -28830,7 +28830,7 @@
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 0,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -29010,7 +29010,7 @@
...
@@ -29010,7 +29010,7 @@
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
300,
300,
-
79.662
,
-
80
,
0,
0,
0,
0,
0,
0,
...
@@ -29071,7 +29071,7 @@
...
@@ -29071,7 +29071,7 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
16.27
,
5
,
0,
0,
0,
0,
0,
0,
...
@@ -29114,7 +29114,7 @@
...
@@ -29114,7 +29114,7 @@
"_string": "20",
"_string": "20",
"_N$string": "20",
"_N$string": "20",
"_fontSize": 74,
"_fontSize": 74,
"_lineHeight":
60
,
"_lineHeight":
74
,
"_enableWrapText": true,
"_enableWrapText": true,
"_N$file": {
"_N$file": {
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
"__uuid__": "86a73b35-ea84-4acf-83dc-d18b68083b2e"
...
@@ -29125,7 +29125,7 @@
...
@@ -29125,7 +29125,7 @@
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 2,
"_N$horizontalAlign": 2,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 2,
"_N$overflow": 2,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -29161,15 +29161,15 @@
...
@@ -29161,15 +29161,15 @@
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x": 0
.5
,
"x": 0,
"y": 0.5
"y": 0.5
},
},
"_trs": {
"_trs": {
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
42
,
15
,
-
20
,
-
12
,
0,
0,
0,
0,
0,
0,
...
@@ -29222,7 +29222,7 @@
...
@@ -29222,7 +29222,7 @@
"_styleFlags": 0,
"_styleFlags": 0,
"_underlineHeight": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign":
0
,
"_N$verticalAlign":
1
,
"_N$fontFamily": "Arial",
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$overflow": 0,
"_N$cacheMode": 0,
"_N$cacheMode": 0,
...
@@ -32259,9 +32259,6 @@
...
@@ -32259,9 +32259,6 @@
"mask": {
"mask": {
"__id__": 580
"__id__": 580
},
},
"study_duration": {
"__id__": 633
},
"last_play": {
"last_play": {
"__id__": 584
"__id__": 584
},
},
...
@@ -32271,6 +32268,12 @@
...
@@ -32271,6 +32268,12 @@
"question_right_percent2": {
"question_right_percent2": {
"__id__": 627
"__id__": 627
},
},
"study_duration": {
"__id__": 633
},
"study_duration_unit": {
"__id__": 635
},
"record_times": {
"record_times": {
"__id__": 649
"__id__": 649
},
},
...
...
assets/middleLayer_for_kyxq/script/LessonReport.ts
View file @
ce1a1fd0
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
playAudioByUrl
,
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
asyncDelay
}
from
"
./util
"
;
import
{
playAudioByUrl
,
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
asyncDelay
,
dateFormate
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
export
default
class
NewClass
extends
cc
.
Component
{
...
@@ -17,14 +17,16 @@ export default class NewClass extends cc.Component {
...
@@ -17,14 +17,16 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
mask
:
cc
.
Node
=
null
;
mask
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
@
property
(
cc
.
Label
)
study_duration
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
last_play
:
cc
.
Label
=
null
;
last_play
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
@
property
(
cc
.
Label
)
question_right_percent1
:
cc
.
Label
=
null
;
question_right_percent1
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
@
property
(
cc
.
Label
)
question_right_percent2
:
cc
.
Label
=
null
;
question_right_percent2
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
@
property
(
cc
.
Label
)
study_duration
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
study_duration_unit
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
record_times
:
cc
.
Label
=
null
;
record_times
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
@
property
(
cc
.
Label
)
question_times
:
cc
.
Label
=
null
;
question_times
:
cc
.
Label
=
null
;
...
@@ -38,7 +40,7 @@ export default class NewClass extends cc.Component {
...
@@ -38,7 +40,7 @@ export default class NewClass extends cc.Component {
storyItem
:
cc
.
Node
=
null
;
storyItem
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
itemCnt
:
cc
.
Node
=
null
;
itemCnt
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
content
:
cc
.
Node
=
null
;
content
:
cc
.
Node
=
null
;
...
@@ -60,111 +62,116 @@ export default class NewClass extends cc.Component {
...
@@ -60,111 +62,116 @@ export default class NewClass extends cc.Component {
nd_storyStory
:
cc
.
Node
=
null
;
nd_storyStory
:
cc
.
Node
=
null
;
// LIFE-CYCLE CALLBACKS:
// LIFE-CYCLE CALLBACKS:
m_sentenceNodeList
=
[]
m_sentenceNodeList
=
[]
onLoad
()
{
onLoad
()
{
this
.
scentenceItem
.
active
=
false
this
.
scentenceItem
.
active
=
false
this
.
storyItem
.
zIndex
=
111
this
.
storyItem
.
zIndex
=
111
this
.
itemCnt
.
zIndex
=
-
1
this
.
itemCnt
.
zIndex
=
-
1
}
}
data
data
setData
(
data
){
setData
(
data
)
{
this
.
data
=
data
this
.
data
=
data
}
}
isAudioPlaying
=
false
isAudioPlaying
=
false
playAudioId
playAudioId
refreshUI
(){
refreshUI
()
{
this
.
stopAudio
()
this
.
stopAudio
()
for
(
let
v
of
this
.
m_sentenceNodeList
){
for
(
let
v
of
this
.
m_sentenceNodeList
)
{
v
.
removeFromParent
()
v
.
removeFromParent
()
}
}
if
(
!
this
.
data
)
return
if
(
!
this
.
data
)
return
let
_data
=
this
.
data
let
_data
=
this
.
data
getSprNodeByUrl
(
_data
.
cover
,
(
spr
)
=>
{
getSprNodeByUrl
(
_data
.
cover
,
(
spr
)
=>
{
this
.
mask
.
addChild
(
spr
.
node
);
this
.
mask
.
addChild
(
spr
.
node
);
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
setSprNodeMaxLen
(
spr
.
node
,
this
.
mask
.
width
,
this
.
mask
.
height
);
setSprNodeMaxLen
(
spr
.
node
,
this
.
mask
.
width
,
this
.
mask
.
height
,
true
);
});
});
const
lastDate
=
_data
.
last_play
?
new
Date
(
_data
.
last_play
)
:
null
;
this
.
title
.
string
=
_data
.
name
this
.
unit
.
string
=
_data
.
unitName
const
studyDuration
=
_data
.
study_duration
this
.
study_duration
.
string
=
_data
.
study_duration
this
.
last_play
.
string
=
_data
.
last_play
&&
new
Date
(
_data
.
last_play
).
toLocaleString
()
||
""
this
.
question_right_percent1
.
string
=
_data
.
question_right_percent
this
.
title
.
string
=
_data
.
name
this
.
question_right_percent2
.
string
=
_data
.
question_right_percent
this
.
unit
.
string
=
_data
.
unitName
this
.
record_times
.
string
=
_data
.
record_times
this
.
last_play
.
string
=
lastDate
?
`
${
dateFormate
(
"
yyyy.MM.dd
"
,
lastDate
)}
学习过`
:
"
未学过
"
this
.
question_times
.
string
=
_data
.
question_times
this
.
question_right_percent1
.
string
=
_data
.
question_right_percent
// 正确率 - 白色描边
this
.
question_right_percent2
.
string
=
_data
.
question_right_percent
// 正确率 - 主体红字
for
(
let
i
=
1
;
i
<=
5
;
i
++
){
this
.
study_duration
.
string
=
_data
.
study_duration
>
999
?
Math
.
floor
(
_data
.
study_duration
/
60
*
10
)
/
10
:
_data
.
study_duration
// 学习时长
let
_star
=
this
.
stars
.
getChildByName
(
`icon_star
${
i
}
`
)
this
.
study_duration_unit
.
string
=
_data
.
study_duration
>
999
?
"
小时
"
:
"
分钟
"
;
_star
.
active
=
_data
.
question_right_percent
>=
20
*
i
this
.
question_times
.
string
=
_data
.
question_times
// 练习次数
this
.
record_times
.
string
=
_data
.
record_times
// 开口次数
for
(
let
i
=
1
;
i
<=
5
;
i
++
)
{
let
_star
=
this
.
stars
.
getChildByName
(
`icon_star
${
i
}
`
)
_star
.
active
=
_data
.
question_right_percent
>=
20
*
i
}
}
this
.
m_sentenceNodeList
=
[]
this
.
m_sentenceNodeList
=
[]
for
(
let
v
of
_data
.
excellents
){
for
(
let
v
of
_data
.
excellents
)
{
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
优秀发音
"
))
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
优秀发音
"
))
}
}
for
(
let
v
of
_data
.
tryagains
){
for
(
let
v
of
_data
.
tryagains
)
{
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
薄弱跟读
"
))
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
薄弱跟读
"
))
}
}
// 句子
// 句子
if
(
_data
.
knowledge
){
if
(
_data
.
knowledge
)
{
if
(
_data
.
knowledge
.
word
){
if
(
_data
.
knowledge
.
word
)
{
this
.
storyWord
.
string
=
_data
.
knowledge
.
word
this
.
storyWord
.
string
=
_data
.
knowledge
.
word
this
.
nd_storyWord
.
active
=
true
this
.
nd_storyWord
.
active
=
true
}
else
{
}
else
{
this
.
nd_storyWord
.
active
=
false
this
.
nd_storyWord
.
active
=
false
}
}
if
(
_data
.
knowledge
.
sentence
){
if
(
_data
.
knowledge
.
sentence
)
{
this
.
storyScentence
.
string
=
_data
.
knowledge
.
sentence
this
.
storyScentence
.
string
=
_data
.
knowledge
.
sentence
this
.
nd_storySentence
.
active
=
true
this
.
nd_storySentence
.
active
=
true
}
else
{
}
else
{
this
.
nd_storySentence
.
active
=
false
this
.
nd_storySentence
.
active
=
false
}
}
if
(
_data
.
knowledge
.
story
){
if
(
_data
.
knowledge
.
story
)
{
this
.
storyStory
.
string
=
_data
.
knowledge
.
story
this
.
storyStory
.
string
=
_data
.
knowledge
.
story
this
.
nd_storyStory
.
active
=
true
this
.
nd_storyStory
.
active
=
true
}
else
{
}
else
{
this
.
nd_storyStory
.
active
=
false
this
.
nd_storyStory
.
active
=
false
}
}
if
(
!
_data
.
knowledge
.
word
&&
if
(
!
_data
.
knowledge
.
word
&&
!
_data
.
knowledge
.
sentence
&&
!
_data
.
knowledge
.
sentence
&&
!
_data
.
knowledge
.
story
)
!
_data
.
knowledge
.
story
)
{
{
this
.
storyItem
.
active
=
false
this
.
storyItem
.
active
=
false
}
else
{
}
else
{
this
.
storyItem
.
active
=
true
this
.
storyItem
.
active
=
true
}
}
}
else
{
}
else
{
this
.
storyItem
.
active
=
false
this
.
storyItem
.
active
=
false
}
}
this
.
reportSV
.
scrollToTop
()
this
.
reportSV
.
scrollToTop
()
}
}
createItem
(
v
,
titleStr
){
createItem
(
v
,
titleStr
)
{
let
_node
=
cc
.
instantiate
(
this
.
scentenceItem
)
let
_node
=
cc
.
instantiate
(
this
.
scentenceItem
)
_node
.
active
=
true
_node
.
active
=
true
this
.
content
.
addChild
(
_node
)
this
.
content
.
addChild
(
_node
)
// 星星的判定标准需要改
// 星星的判定标准需要改
for
(
let
i
=
1
;
i
<=
3
;
i
++
)
{
for
(
let
i
=
1
;
i
<=
3
;
i
++
)
{
_node
.
getChildByName
(
`star
${
i
}
`
).
active
=
v
.
overall
>=
i
*
33
_node
.
getChildByName
(
`star
${
i
}
`
).
active
=
v
.
overall
>=
i
*
33
}
}
_node
.
getChildByName
(
"
lbl
"
).
getComponent
(
cc
.
Label
).
string
=
v
.
test_text
_node
.
getChildByName
(
"
lbl
"
).
getComponent
(
cc
.
Label
).
string
=
v
.
test_text
_node
.
getChildByName
(
"
title
"
).
getComponent
(
cc
.
Label
).
string
=
titleStr
_node
.
getChildByName
(
"
title
"
).
getComponent
(
cc
.
Label
).
string
=
titleStr
let
btn_stop
=
_node
.
getChildByName
(
"
btn_stop
"
)
let
btn_stop
=
_node
.
getChildByName
(
"
btn_stop
"
)
let
btn_play
=
_node
.
getChildByName
(
"
btn_play
"
)
let
btn_play
=
_node
.
getChildByName
(
"
btn_play
"
)
let
btn_listen
=
_node
.
getChildByName
(
"
btn_listen
"
)
let
btn_listen
=
_node
.
getChildByName
(
"
btn_listen
"
)
btn_stop
.
active
=
false
btn_stop
.
active
=
false
btn_play
.
active
=
true
btn_play
.
active
=
true
btn_listen
.
active
=
true
btn_listen
.
active
=
true
btn_listen
.
on
(
"
click
"
,
()
=>
{
btn_listen
.
on
(
"
click
"
,
()
=>
{
if
(
!
v
.
example_url
)
return
if
(
!
v
.
example_url
)
return
...
@@ -173,7 +180,7 @@ export default class NewClass extends cc.Component {
...
@@ -173,7 +180,7 @@ export default class NewClass extends cc.Component {
cc
.
assetManager
.
loadRemote
(
v
.
example_url
,
(
err
,
audioClip
)
=>
{
cc
.
assetManager
.
loadRemote
(
v
.
example_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
;
this
.
isAudioPlaying
=
false
;
});
});
})
})
...
@@ -181,13 +188,13 @@ export default class NewClass extends cc.Component {
...
@@ -181,13 +188,13 @@ export default class NewClass extends cc.Component {
btn_play
.
on
(
"
click
"
,
()
=>
{
btn_play
.
on
(
"
click
"
,
()
=>
{
if
(
!
v
.
record_url
)
return
if
(
!
v
.
record_url
)
return
this
.
stopAudio
()
this
.
stopAudio
()
btn_play
.
active
=
false
btn_play
.
active
=
false
btn_stop
.
active
=
true
btn_stop
.
active
=
true
this
.
isAudioPlaying
=
true
;
this
.
isAudioPlaying
=
true
;
cc
.
assetManager
.
loadRemote
(
v
.
record_url
,
(
err
,
audioClip
)
=>
{
cc
.
assetManager
.
loadRemote
(
v
.
record_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
;
this
.
isAudioPlaying
=
false
;
});
});
})
})
...
@@ -195,26 +202,26 @@ export default class NewClass extends cc.Component {
...
@@ -195,26 +202,26 @@ export default class NewClass extends cc.Component {
btn_stop
.
on
(
"
click
"
,
()
=>
{
btn_stop
.
on
(
"
click
"
,
()
=>
{
this
.
stopAudio
()
this
.
stopAudio
()
})
})
_node
.
on
(
"
stop_audio
"
,
()
=>
{
_node
.
on
(
"
stop_audio
"
,
()
=>
{
btn_play
.
active
=
true
btn_play
.
active
=
true
btn_stop
.
active
=
false
btn_stop
.
active
=
false
})
})
return
_node
return
_node
}
}
stopAudio
(){
stopAudio
()
{
if
(
this
.
playAudioId
!=
null
)
cc
.
audioEngine
.
stop
(
this
.
playAudioId
)
if
(
this
.
playAudioId
!=
null
)
cc
.
audioEngine
.
stop
(
this
.
playAudioId
)
this
.
playAudioId
=
null
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
this
.
isAudioPlaying
=
false
for
(
let
v
of
this
.
m_sentenceNodeList
){
for
(
let
v
of
this
.
m_sentenceNodeList
)
{
v
.
emit
(
"
stop_audio
"
)
v
.
emit
(
"
stop_audio
"
)
}
}
}
}
onClickClose
(){
onClickClose
()
{
this
.
stopAudio
()
this
.
stopAudio
()
this
.
node
.
active
=
false
this
.
node
.
active
=
false
}
}
// update (dt) {}
// update (dt) {}
...
...
assets/middleLayer_for_kyxq/script/util.ts
View file @
ce1a1fd0
...
@@ -501,4 +501,23 @@ export function formatTime(time) {
...
@@ -501,4 +501,23 @@ export function formatTime(time) {
const
ss
=
Math
.
round
(
time
%
60
).
toString
().
padStart
(
2
,
'
0
'
);
const
ss
=
Math
.
round
(
time
%
60
).
toString
().
padStart
(
2
,
'
0
'
);
return
`
${
hh
}${
mm
}
:
${
ss
}
`
;
return
`
${
hh
}${
mm
}
:
${
ss
}
`
;
}
}
\ No newline at end of file
// "yyyy-MM-dd hh:mm:ss
export
function
dateFormate
(
fmt
,
date
)
{
var
o
=
{
"
M+
"
:
date
.
getMonth
()
+
1
,
//月份
"
d+
"
:
date
.
getDate
(),
//日
"
h+
"
:
date
.
getHours
(),
//小时
"
m+
"
:
date
.
getMinutes
(),
//分
"
s+
"
:
date
.
getSeconds
(),
//秒
"
q+
"
:
Math
.
floor
((
date
.
getMonth
()
+
3
)
/
3
),
//季度
"
S
"
:
date
.
getMilliseconds
()
//毫秒
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
for
(
var
k
in
o
)
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)));
return
fmt
;
}
\ 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