Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
ls_gramophone
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
ls_gramophone
Commits
225ebf93
Commit
225ebf93
authored
Jun 08, 2022
by
李帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+1
parent
c5834d39
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
250 additions
and
237 deletions
+250
-237
ls_gramophone.fire
assets/ls_gramophone/scene/ls_gramophone.fire
+172
-204
ls_gramophone.ts
assets/ls_gramophone/scene/ls_gramophone.ts
+29
-2
Item.ts
assets/ls_gramophone/script/Item.ts
+37
-1
defaultData.ts
assets/ls_gramophone/script/defaultData.ts
+2
-18
simpleLabel.ts
assets/ls_gramophone/script/simpleLabel.ts
+10
-12
No files found.
assets/ls_gramophone/scene/ls_gramophone.fire
View file @
225ebf93
...
...
@@ -93,37 +93,37 @@
"__id__": 19
},
{
"__id__": 7
1
"__id__": 7
0
},
{
"__id__": 7
6
"__id__": 7
5
},
{
"__id__": 7
9
"__id__": 7
8
},
{
"__id__": 8
4
"__id__": 8
3
},
{
"__id__": 8
7
"__id__": 8
6
},
{
"__id__": 9
2
"__id__": 9
1
},
{
"__id__": 11
1
"__id__": 11
0
}
],
"_active": true,
"_components": [
{
"__id__": 11
5
"__id__": 11
4
},
{
"__id__": 11
6
"__id__": 11
5
},
{
"__id__": 11
7
"__id__": 11
6
}
],
"_prefab": null,
...
...
@@ -991,7 +991,7 @@
"_active": true,
"_components": [
{
"__id__":
70
"__id__":
69
}
],
"_prefab": null,
...
...
@@ -1057,16 +1057,16 @@
"__id__": 24
},
{
"__id__": 6
3
"__id__": 6
2
}
],
"_active": true,
"_components": [
{
"__id__": 6
8
"__id__": 6
7
},
{
"__id__": 6
9
"__id__": 6
8
}
],
"_prefab": null,
...
...
@@ -1277,7 +1277,7 @@
"__id__": 61
},
{
"__id__": 6
2
"__id__": 6
6
}
],
"_prefab": null,
...
...
@@ -2963,95 +2963,27 @@
"myrecord_play": {
"__id__": 49
},
"_id": "78sbViiXNOl5SgddmNDgr+"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
"low": {
"__id__": 62
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "31+SyJRYdAhZKwR2tVF9rC"
"_id": "78sbViiXNOl5SgddmNDgr+"
},
{
"__type__": "cc.Node",
"_name": "
word
",
"_name": "
low
",
"_objFlags": 0,
"_parent": {
"__id__": 20
},
"_children": [
{
"__id__": 6
4
"__id__": 6
3
}
],
"_active": false,
"_components": [
{
"__id__": 66
},
{
"__id__": 67
"__id__": 65
}
],
"_prefab": null,
...
...
@@ -3100,35 +3032,35 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
87Rk7XYX1OPKWhI8Zycmb0
"
"_id": "
c6zMoLHHVNmqIN9si2WDqQ
"
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 6
3
"__id__": 6
2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
5
"__id__": 6
4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 2
54
,
"g":
243
,
"b":
213
,
"r": 2
15
,
"g":
105
,
"b":
32
,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 48
"height":
60.
48
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -3162,14 +3094,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
7fXYYORb9Aoa54n00Dr8ic
"
"_id": "
adu9FKGgRDRr9Pj196zPSv
"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
4
"__id__": 6
3
},
"_enabled": true,
"_materials": [
...
...
@@ -3179,8 +3111,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_string": "
what
",
"_N$string": "
what
",
"_fontSize": 36,
"_lineHeight": 48,
"_enableWrapText": true,
...
...
@@ -3195,16 +3127,16 @@
"_N$horizontalAlign": 0,
"_N$verticalAlign": 2,
"_N$fontFamily": "Arial",
"_N$overflow":
3
,
"_N$overflow":
0
,
"_N$cacheMode": 0,
"_id": "
b7RdGIuPtB1ZEZubFHRgO+
"
"_id": "
1aBrXz93VN75xgvLVjuYVZ
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
3
"__id__": 6
2
},
"_enabled": true,
"_materials": [
...
...
@@ -3215,7 +3147,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "
87170b12-fd1d-4b10-b17b-262c0403f815
"
"__uuid__": "
a23235d1-15db-4b95-8439-a2e005bfff91
"
},
"_type": 0,
"_sizeMode": 0,
...
...
@@ -3229,39 +3161,75 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
95zLBYciVFxYr7DO0Fm+V1
"
"_id": "
35OA3ebdRPII8YwoGtPtdY
"
},
{
"__type__": "cc.
Layout
",
"__type__": "cc.
Button
",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
63
"__id__":
24
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 0,
"height": 48
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_
resize": 1,
"_N$layoutType": 1
,
"_N$cellSize": {
"
__type__": "cc.Size"
,
"
width": 40
,
"
height": 40
"_
N$pressedColor": {
"__type__": "cc.Color"
,
"r": 211,
"
g": 211
,
"
b": 211
,
"
a": 255
},
"_N$startAxis": 0,
"_N$paddingLeft": 0,
"_N$paddingRight": 0,
"_N$paddingTop": 0,
"_N$paddingBottom": 0,
"_N$spacingX": 0,
"_N$spacingY": 0,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": "d8cvZPUFNEAJCt6YEL0MYQ"
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "31+SyJRYdAhZKwR2tVF9rC"
},
{
"__type__": "cc.Mask",
...
...
@@ -3345,16 +3313,16 @@
},
"_children": [
{
"__id__": 7
2
"__id__": 7
1
}
],
"_active": false,
"_components": [
{
"__id__": 7
4
"__id__": 7
3
},
{
"__id__": 7
5
"__id__": 7
4
}
],
"_prefab": null,
...
...
@@ -3410,13 +3378,13 @@
"_name": "icon_record",
"_objFlags": 0,
"_parent": {
"__id__": 7
1
"__id__": 7
0
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 7
3
"__id__": 7
2
}
],
"_prefab": null,
...
...
@@ -3472,7 +3440,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
2
"__id__": 7
1
},
"_enabled": true,
"_materials": [
...
...
@@ -3512,7 +3480,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
1
"__id__": 7
0
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -3539,7 +3507,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
1
"__id__": 7
0
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3613,10 +3581,10 @@
"_active": false,
"_components": [
{
"__id__": 7
7
"__id__": 7
6
},
{
"__id__": 7
8
"__id__": 7
7
}
],
"_prefab": null,
...
...
@@ -3672,7 +3640,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
6
"__id__": 7
5
},
"_enabled": true,
"_materials": [
...
...
@@ -3704,7 +3672,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
6
"__id__": 7
5
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3776,13 +3744,13 @@
},
"_children": [
{
"__id__":
80
"__id__":
79
}
],
"_active": false,
"_components": [
{
"__id__": 8
3
"__id__": 8
2
}
],
"_prefab": null,
...
...
@@ -3838,16 +3806,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 7
9
"__id__": 7
8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
1
"__id__": 8
0
},
{
"__id__": 8
2
"__id__": 8
1
}
],
"_prefab": null,
...
...
@@ -3903,7 +3871,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
80
"__id__":
79
},
"_enabled": true,
"_materials": [
...
...
@@ -3938,7 +3906,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
80
"__id__":
79
},
"_enabled": false,
"_color": {
...
...
@@ -3956,7 +3924,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
9
"__id__": 7
8
},
"_enabled": true,
"_materials": [
...
...
@@ -3994,10 +3962,10 @@
"_active": false,
"_components": [
{
"__id__": 8
5
"__id__": 8
4
},
{
"__id__": 8
6
"__id__": 8
5
}
],
"_prefab": null,
...
...
@@ -4053,7 +4021,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
4
"__id__": 8
3
},
"_enabled": true,
"_materials": [
...
...
@@ -4085,7 +4053,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
4
"__id__": 8
3
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -4157,16 +4125,16 @@
},
"_children": [
{
"__id__": 8
8
"__id__": 8
7
}
],
"_active": true,
"_components": [
{
"__id__":
90
"__id__":
89
},
{
"__id__": 9
1
"__id__": 9
0
}
],
"_prefab": null,
...
...
@@ -4222,13 +4190,13 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 8
7
"__id__": 8
6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
9
"__id__": 8
8
}
],
"_prefab": null,
...
...
@@ -4284,7 +4252,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
8
"__id__": 8
7
},
"_enabled": true,
"_materials": [
...
...
@@ -4317,7 +4285,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
7
"__id__": 8
6
},
"_enabled": true,
"_materials": [
...
...
@@ -4349,7 +4317,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
7
"__id__": 8
6
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -4380,25 +4348,25 @@
},
"_children": [
{
"__id__": 9
3
"__id__": 9
2
},
{
"__id__": 9
7
"__id__": 9
6
},
{
"__id__":
100
"__id__":
99
},
{
"__id__": 10
2
"__id__": 10
1
},
{
"__id__": 10
6
"__id__": 10
5
}
],
"_active": false,
"_components": [
{
"__id__": 1
10
"__id__": 1
09
}
],
"_prefab": null,
...
...
@@ -4454,19 +4422,19 @@
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 9
2
"__id__": 9
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
4
"__id__": 9
3
},
{
"__id__": 9
5
"__id__": 9
4
},
{
"__id__": 9
6
"__id__": 9
5
}
],
"_prefab": null,
...
...
@@ -4522,7 +4490,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
3
"__id__": 9
2
},
"_enabled": true,
"_materials": [
...
...
@@ -4554,7 +4522,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
3
"__id__": 9
2
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -4581,7 +4549,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
3
"__id__": 9
2
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -4649,16 +4617,16 @@
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 9
2
"__id__": 9
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
8
"__id__": 9
7
},
{
"__id__": 9
9
"__id__": 9
8
}
],
"_prefab": null,
...
...
@@ -4714,7 +4682,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
7
"__id__": 9
6
},
"_enabled": true,
"_materials": [
...
...
@@ -4746,7 +4714,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
7
"__id__": 9
6
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -4807,7 +4775,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 9
7
"__id__": 9
6
},
"_id": "dbf6SlfeFJtqujsCK52/CR"
},
...
...
@@ -4816,13 +4784,13 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 9
2
"__id__": 9
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
1
"__id__": 10
0
}
],
"_prefab": null,
...
...
@@ -4837,7 +4805,7 @@
"_contentSize": {
"__type__": "cc.Size",
"width": 800,
"height":
0
"height":
60.480000000000004
},
"_anchorPoint": {
"__type__": "cc.Vec2",
...
...
@@ -4878,7 +4846,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
100
"__id__":
99
},
"_enabled": true,
"_materials": [
...
...
@@ -4913,16 +4881,16 @@
"_name": "start",
"_objFlags": 0,
"_parent": {
"__id__": 9
2
"__id__": 9
1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 10
3
"__id__": 10
2
},
{
"__id__": 10
4
"__id__": 10
3
}
],
"_prefab": null,
...
...
@@ -4978,7 +4946,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
2
"__id__": 10
1
},
"_enabled": true,
"_materials": [
...
...
@@ -5010,7 +4978,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
2
"__id__": 10
1
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -5019,7 +4987,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 10
5
"__id__": 10
4
}
],
"_N$interactable": true,
...
...
@@ -5075,7 +5043,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 10
2
"__id__": 10
1
},
"_id": "f86X4c6OtP4K2F2ODiAK9B"
},
...
...
@@ -5094,16 +5062,16 @@
"_name": "restart",
"_objFlags": 0,
"_parent": {
"__id__": 9
2
"__id__": 9
1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 10
7
"__id__": 10
6
},
{
"__id__": 10
8
"__id__": 10
7
}
],
"_prefab": null,
...
...
@@ -5159,7 +5127,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
6
"__id__": 10
5
},
"_enabled": true,
"_materials": [
...
...
@@ -5191,7 +5159,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
6
"__id__": 10
5
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -5200,7 +5168,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 10
9
"__id__": 10
8
}
],
"_N$interactable": true,
...
...
@@ -5275,7 +5243,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
2
"__id__": 9
1
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -5306,7 +5274,7 @@
},
"_children": [
{
"__id__": 11
2
"__id__": 11
1
}
],
"_active": true,
...
...
@@ -5364,11 +5332,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 11
1
"__id__": 11
0
},
"_children": [
{
"__id__": 11
3
"__id__": 11
2
}
],
"_active": true,
...
...
@@ -5426,13 +5394,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 11
2
"__id__": 11
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
4
"__id__": 11
3
}
],
"_prefab": null,
...
...
@@ -5488,7 +5456,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
3
"__id__": 11
2
},
"_enabled": true,
"_clip": {
...
...
@@ -5561,7 +5529,7 @@
"__id__": 21
},
"tip": {
"__id__": 9
2
"__id__": 9
1
},
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
...
...
assets/ls_gramophone/scene/ls_gramophone.ts
View file @
225ebf93
/*
* @Author: ls
* @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-0
5-31 21:56:35
* @LastEditTime: 2022-0
6-08 23:00:12
* @LastEditors: ls
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
...
...
@@ -236,7 +236,34 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
log
(
`录音的音频URL是
${
JSON
.
parse
(
res
).
audioUrl
}
`
);
if
(
idx
!==
-
1
)
{
this
.
content
.
children
[
idx
].
getComponent
(
Item
).
recorded
();
let
it
=
this
.
content
.
children
[
idx
].
getComponent
(
Item
);
it
.
recorded
();
let
arr
=
JSON
.
parse
(
res
).
result
.
sentences
[
0
].
details
;
let
arrOne
=
[];
for
(
let
index
=
0
;
index
<
arr
.
length
;
index
++
)
{
let
e
=
arr
[
index
];
arrOne
.
push
({
key
:
e
.
word
,
value
:
1
});
let
result
=
{};
arrOne
.
forEach
((
item
)
=>
{
if
(
result
[
item
.
key
])
{
result
[
item
.
key
]
+=
item
.
value
;
}
else
{
result
[
item
.
key
]
=
item
.
value
;
}
});
for
(
let
k
in
result
)
{
if
(
k
===
e
.
word
)
{
if
(
e
.
overall
<
40
)
{
it
.
setLow
(
e
.
word
,
result
[
k
]);
}
}
}
}
}
this
.
resetRecord
();
...
...
assets/ls_gramophone/script/Item.ts
View file @
225ebf93
/*
* @Author: ls
* @Date: 2022-05-21 21:59:51
* @LastEditTime: 2022-0
5-31 21:15:1
7
* @LastEditTime: 2022-0
6-08 22:57:2
7
* @LastEditors: ls
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\Item.ts
...
...
@@ -31,6 +31,9 @@ export default class Item extends cc.Component {
@
property
(
cc
.
Node
)
myrecord_play
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
low
:
cc
.
Node
=
null
;
// 录制中
_recording
=
false
;
// 已录音
...
...
@@ -144,6 +147,7 @@ export default class Item extends cc.Component {
this
.
tip
.
active
=
true
;
// this.label.node.color = cc.color(255, 96, 0);
this
.
label
.
node
.
color
=
cc
.
color
(
108
,
185
,
0
);
this
.
hideLow
();
}
/**
...
...
@@ -152,5 +156,37 @@ export default class Item extends cc.Component {
stop
()
{
this
.
tip
.
active
=
false
;
this
.
label
.
node
.
color
=
cc
.
color
(
44
,
77
,
140
);
this
.
showLow
();
}
hideLow
()
{
this
.
label
.
node
.
children
.
forEach
((
e
)
=>
{
e
.
active
=
false
;
});
}
showLow
()
{
this
.
label
.
node
.
children
.
forEach
((
e
)
=>
{
e
.
active
=
true
;
});
}
clearLow
()
{
this
.
label
.
node
.
removeAllChildren
();
}
setLow
(
str
:
string
,
index
:
number
=
1
)
{
let
ps
=
this
.
label
.
getTargetStringPos
(
str
);
if
(
index
>
ps
.
length
)
{
return
;
}
let
p
=
ps
[
index
-
1
];
let
low
=
cc
.
instantiate
(
this
.
low
);
low
.
parent
=
this
.
label
.
node
;
low
.
active
=
true
;
low
.
width
=
p
.
z
;
low
.
getComponentInChildren
(
cc
.
Label
).
string
=
str
;
low
.
setPosition
(
p
.
y
,
(
p
.
x
-
1
)
*
48
);
}
}
assets/ls_gramophone/script/defaultData.ts
View file @
225ebf93
/*
* @Author: ls
* @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-0
5-22 00:13:54
* @LastEditTime: 2022-0
6-08 21:16:09
* @LastEditors: ls
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\defaultData.ts
...
...
@@ -19,7 +19,7 @@ export const defaultData = {
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
text
:
'
Good morning
'
,
text
:
'
what can i do for you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
...
...
@@ -34,21 +34,5 @@ export const defaultData = {
text
:
'
Hello, how dare you, Hello, how dare you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
text
:
'
Hello, how dare you, Hello, how dare you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
text
:
'
Hello, how dare you, Hello, how dare you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
text
:
'
Hello, how dare you, Hello, how dare you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
{
text
:
'
Hello, how dare you, Hello, how dare you
'
,
audio
:
'
http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3
'
,
},
],
};
assets/ls_gramophone/script/simpleLabel.ts
View file @
225ebf93
/*
* @Author: ls
* @Date: 2022-05-21 18:06:20
* @LastEditTime: 2022-0
5-31 22:45:56
* @LastEditTime: 2022-0
6-08 21:39:12
* @LastEditors: ls
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\simpleLabel.ts
...
...
@@ -142,7 +142,7 @@ export default class simpleLabel extends cc.Component {
getTargetStringPos
(
str
:
string
)
{
let
poss
=
[];
let
rows
=
0
;
let
rows
=
this
.
_rows
;
let
lastString
=
''
;
if
(
this
.
_sourceArray
&&
this
.
_sourceArray
.
length
)
{
for
(
let
index
=
0
;
index
<
this
.
_sourceArray
.
length
;
index
++
)
{
...
...
@@ -162,22 +162,20 @@ export default class simpleLabel extends cc.Component {
// 增加行数
lastString
=
element
;
tempString
=
''
;
rows
++
;
rows
--
;
}
let
temp
=
element
;
if
(
element
.
indexOf
(
'
,
'
)
!==
-
1
)
{
temp
.
substring
(
element
.
indexOf
(
'
,
'
),
1
);
}
else
if
(
element
.
indexOf
(
'
.
'
)
!==
-
1
)
{
temp
.
substring
(
element
.
indexOf
(
'
.
'
),
1
);
}
else
if
(
element
.
indexOf
(
'
!
'
)
!==
-
1
)
{
temp
.
substring
(
element
.
indexOf
(
'
!
'
),
1
);
}
else
if
(
element
.
indexOf
(
'
?
'
)
!==
-
1
)
{
temp
.
substring
(
element
.
indexOf
(
'
?
'
),
1
);
if
(
element
.
indexOf
(
'
,
'
)
!==
-
1
||
element
.
indexOf
(
'
.
'
)
!==
-
1
||
element
.
indexOf
(
'
!
'
)
!==
-
1
||
element
.
indexOf
(
'
?
'
)
!==
-
1
)
{
temp
=
temp
.
substring
(
0
,
temp
.
length
-
1
);
}
if
(
temp
===
str
)
{
poss
.
push
(
rows
,
this
.
getLetterWidth
(
this
.
label
,
tempString
),
this
.
getLetterWidth
(
this
.
label
,
str
));
let
x
=
this
.
getLetterWidth
(
this
.
label
,
tempString
);
if
(
x
!==
0
)
{
x
+=
this
.
getLetterWidth
(
this
.
label
,
'
'
);
}
poss
.
push
(
cc
.
v3
(
rows
,
x
,
this
.
getLetterWidth
(
this
.
label
,
str
)));
}
}
}
...
...
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