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
4406b156
Commit
4406b156
authored
May 31, 2022
by
李帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+1
parent
f1eb499d
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
423 additions
and
67 deletions
+423
-67
AsapCondensed-Bold.ttf
assets/ls_gramophone/fonts/AsapCondensed-Bold.ttf
+0
-0
AsapCondensed-Bold.ttf.meta
assets/ls_gramophone/fonts/AsapCondensed-Bold.ttf.meta
+5
-0
ls_gramophone.fire
assets/ls_gramophone/scene/ls_gramophone.fire
+284
-63
ls_gramophone.ts
assets/ls_gramophone/scene/ls_gramophone.ts
+39
-1
Item.ts
assets/ls_gramophone/script/Item.ts
+3
-2
simpleLabel.ts
assets/ls_gramophone/script/simpleLabel.ts
+56
-1
icon_tip.png
assets/ls_gramophone/textures/0/right/icon_tip.png
+0
-0
bg_countdown.png
assets/ls_gramophone/textures/bg_countdown.png
+0
-0
bg_countdown.png.meta
assets/ls_gramophone/textures/bg_countdown.png.meta
+36
-0
No files found.
assets/ls_gramophone/fonts/AsapCondensed-Bold.ttf
0 → 100644
View file @
4406b156
File added
assets/ls_gramophone/fonts/AsapCondensed-Bold.ttf.meta
0 → 100644
View file @
4406b156
{
"ver": "1.1.0",
"uuid": "10d7986f-e45e-477c-a36c-013d0f2f6aa5",
"subMetas": {}
}
\ No newline at end of file
assets/ls_gramophone/scene/ls_gramophone.fire
View file @
4406b156
This diff is collapsed.
Click to expand it.
assets/ls_gramophone/scene/ls_gramophone.ts
View file @
4406b156
/*
/*
* @Author: ls
* @Author: ls
* @Date: 2022-05-15 18:22:18
* @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-05-
23 15:25:56
* @LastEditTime: 2022-05-
31 21:56:35
* @LastEditors: ls
* @LastEditors: ls
* @Description:
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
...
@@ -27,6 +27,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -27,6 +27,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
_recording
=
false
;
_recording
=
false
;
// 录音音频
// 录音音频
_records
=
[];
_records
=
[];
// 倒计时
_countdown
=
30
;
addPreloadImage
()
{
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
// TODO 根据自己的配置预加载图片资源
...
@@ -176,8 +178,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -176,8 +178,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
record_start
=
cc
.
find
(
'
Canvas/btn_record_start
'
);
let
record_start
=
cc
.
find
(
'
Canvas/btn_record_start
'
);
let
record_stop
=
cc
.
find
(
'
Canvas/btn_record_stop
'
);
let
record_stop
=
cc
.
find
(
'
Canvas/btn_record_stop
'
);
let
countdown
=
cc
.
find
(
'
Canvas/bg_countdown
'
);
record_start
.
active
=
false
;
record_start
.
active
=
false
;
record_stop
.
active
=
false
;
record_stop
.
active
=
false
;
countdown
.
active
=
false
;
record_start
.
off
(
'
click
'
);
record_start
.
off
(
'
click
'
);
record_stop
.
off
(
'
click
'
);
record_stop
.
off
(
'
click
'
);
record_start
.
on
(
'
click
'
,
()
=>
{
record_start
.
on
(
'
click
'
,
()
=>
{
...
@@ -188,6 +192,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -188,6 +192,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
record_start
.
active
=
false
;
record_start
.
active
=
false
;
record_stop
.
active
=
true
;
record_stop
.
active
=
true
;
countdown
.
active
=
true
;
this
.
unschedule
(
this
.
onCountdown
);
this
.
_countdown
=
30
+
1
;
this
.
onCountdown
();
this
.
schedule
(
this
.
onCountdown
,
1
);
this
.
_recording
=
true
;
this
.
_recording
=
true
;
...
@@ -203,6 +213,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -203,6 +213,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
record_start
.
active
=
false
;
record_start
.
active
=
false
;
record_stop
.
active
=
false
;
record_stop
.
active
=
false
;
countdown
.
active
=
false
;
this
.
unschedule
(
this
.
onCountdown
);
this
.
_recording
=
false
;
this
.
_recording
=
false
;
...
@@ -302,6 +315,31 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -302,6 +315,31 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
tip
.
active
=
false
;
this
.
tip
.
active
=
false
;
}
}
/**
* 倒计时回调
*/
onCountdown
()
{
this
.
_countdown
--
;
if
(
this
.
_countdown
<=
0
)
{
let
record_stop
=
cc
.
find
(
'
Canvas/btn_record_stop
'
);
record_stop
.
emit
(
'
click
'
);
this
.
unschedule
(
this
.
onCountdown
);
}
else
{
let
bg_countdown_label
=
cc
.
find
(
'
Canvas/bg_countdown/label
'
);
bg_countdown_label
.
getComponent
(
cc
.
Label
).
string
=
this
.
_countdown
+
''
;
if
(
this
.
_countdown
>
9
)
{
bg_countdown_label
.
color
=
cc
.
color
(
83
,
102
,
138
);
bg_countdown_label
.
getComponent
(
cc
.
Label
).
fontSize
=
50
;
bg_countdown_label
.
getComponent
(
cc
.
LabelOutline
).
enabled
=
false
;
}
else
{
bg_countdown_label
.
color
=
cc
.
color
(
255
,
132
,
132
);
bg_countdown_label
.
getComponent
(
cc
.
Label
).
fontSize
=
64
;
bg_countdown_label
.
getComponent
(
cc
.
LabelOutline
).
enabled
=
true
;
}
}
}
onCallBack
(
event
:
cc
.
Event
.
EventTouch
,
str
:
string
)
{
onCallBack
(
event
:
cc
.
Event
.
EventTouch
,
str
:
string
)
{
this
.
playLocalAudio
(
'
btn
'
);
this
.
playLocalAudio
(
'
btn
'
);
if
(
str
===
'
start
'
||
str
===
'
restart
'
)
{
if
(
str
===
'
start
'
||
str
===
'
restart
'
)
{
...
...
assets/ls_gramophone/script/Item.ts
View file @
4406b156
/*
/*
* @Author: ls
* @Author: ls
* @Date: 2022-05-21 21:59:51
* @Date: 2022-05-21 21:59:51
* @LastEditTime: 2022-05-
22 17:32:48
* @LastEditTime: 2022-05-
31 21:15:17
* @LastEditors: ls
* @LastEditors: ls
* @Description:
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\Item.ts
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\Item.ts
...
@@ -142,7 +142,8 @@ export default class Item extends cc.Component {
...
@@ -142,7 +142,8 @@ export default class Item extends cc.Component {
*/
*/
playing
()
{
playing
()
{
this
.
tip
.
active
=
true
;
this
.
tip
.
active
=
true
;
this
.
label
.
node
.
color
=
cc
.
color
(
255
,
96
,
0
);
// this.label.node.color = cc.color(255, 96, 0);
this
.
label
.
node
.
color
=
cc
.
color
(
108
,
185
,
0
);
}
}
/**
/**
...
...
assets/ls_gramophone/script/simpleLabel.ts
View file @
4406b156
/*
/*
* @Author: ls
* @Author: ls
* @Date: 2022-05-21 18:06:20
* @Date: 2022-05-21 18:06:20
* @LastEditTime: 2022-05-
21 22:00
:56
* @LastEditTime: 2022-05-
31 22:45
:56
* @LastEditors: ls
* @LastEditors: ls
* @Description:
* @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\simpleLabel.ts
* @FilePath: \ls_gramophone\assets\ls_gramophone\script\simpleLabel.ts
...
@@ -26,6 +26,9 @@ export default class simpleLabel extends cc.Component {
...
@@ -26,6 +26,9 @@ export default class simpleLabel extends cc.Component {
// 目标字符串行数
// 目标字符串行数
private
_rows
=
0
;
private
_rows
=
0
;
// 目标宽度
private
_targetWidget
=
0
;
// TODO 字符数组(后期处理标点符号)
// TODO 字符数组(后期处理标点符号)
private
_characters
=
[
'
,
'
,
'
.
'
];
private
_characters
=
[
'
,
'
,
'
.
'
];
...
@@ -48,6 +51,7 @@ export default class simpleLabel extends cc.Component {
...
@@ -48,6 +51,7 @@ export default class simpleLabel extends cc.Component {
}
}
}
}
this
.
_targetWidget
=
targetWidget
;
// 保存源字符串
// 保存源字符串
this
.
_sourceString
=
sourceString
;
this
.
_sourceString
=
sourceString
;
// 保存源字符串数组(根据空格分割)
// 保存源字符串数组(根据空格分割)
...
@@ -129,4 +133,55 @@ export default class simpleLabel extends cc.Component {
...
@@ -129,4 +133,55 @@ export default class simpleLabel extends cc.Component {
let
width
=
(
metric
&&
metric
.
width
)
||
0
;
let
width
=
(
metric
&&
metric
.
width
)
||
0
;
return
width
;
return
width
;
}
}
/**
* 获取所有字符串的位置
* @param str
* @returns
*/
getTargetStringPos
(
str
:
string
)
{
let
poss
=
[];
let
rows
=
0
;
let
lastString
=
''
;
if
(
this
.
_sourceArray
&&
this
.
_sourceArray
.
length
)
{
for
(
let
index
=
0
;
index
<
this
.
_sourceArray
.
length
;
index
++
)
{
let
element
=
this
.
_sourceArray
[
index
];
// 临时字符串
let
tempString
=
lastString
;
if
(
lastString
===
''
)
{
lastString
=
element
;
// 设置字符串
}
else
{
lastString
=
lastString
+
'
'
+
element
;
// 添加字符串
}
// 如果字符串长度 >= 设计字符串长度
if
(
this
.
getLetterWidth
(
this
.
label
,
lastString
)
>=
this
.
_targetWidget
)
{
// 增加行数
lastString
=
element
;
tempString
=
''
;
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
(
temp
===
str
)
{
poss
.
push
(
rows
,
this
.
getLetterWidth
(
this
.
label
,
tempString
),
this
.
getLetterWidth
(
this
.
label
,
str
));
}
}
}
return
poss
;
}
}
}
assets/ls_gramophone/textures/0/right/icon_tip.png
View replaced file @
f1eb499d
View file @
4406b156
1.24 KB
|
W:
|
H:
1.24 KB
|
W:
|
H:
2-up
Swipe
Onion skin
assets/ls_gramophone/textures/bg_countdown.png
0 → 100644
View file @
4406b156
4.45 KB
assets/ls_gramophone/textures/bg_countdown.png.meta
0 → 100644
View file @
4406b156
{
"ver": "2.3.5",
"uuid": "9e70c229-d350-46dc-9f44-ac254d4352e9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 88,
"platformSettings": {},
"subMetas": {
"bg_countdown": {
"ver": "1.0.4",
"uuid": "8eda48c8-60ae-420e-b20a-734f2f05467a",
"rawTextureUuid": "9e70c229-d350-46dc-9f44-ac254d4352e9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 88,
"rawWidth": 106,
"rawHeight": 88,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"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