Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
et_22
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
et_22
Commits
f152a1f5
Commit
f152a1f5
authored
Mar 01, 2021
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: ccc 2.4.0 bug
parent
99758a88
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
473 additions
and
126 deletions
+473
-126
adapter.js
.../assets/ljx_karaoke/components/karaoke/scripts/adapter.js
+1
-1
karaoke.js
.../assets/ljx_karaoke/components/karaoke/scripts/karaoke.js
+32
-9
scene.fire
play/assets/ljx_karaoke/scene/scene.fire
+428
-114
scene.js
play/assets/ljx_karaoke/script/scene.js
+12
-2
No files found.
play/assets/ljx_karaoke/components/karaoke/scripts/adapter.js
View file @
f152a1f5
...
@@ -156,7 +156,7 @@ cc.Class({
...
@@ -156,7 +156,7 @@ cc.Class({
cc
.
director
.
on
(
'
GAME_RESOURCE_LOADED
'
,
(
preloadedData
)
=>
{
cc
.
director
.
on
(
'
GAME_RESOURCE_LOADED
'
,
(
preloadedData
)
=>
{
this
.
lrc
.
initialize
();
this
.
lrc
.
initialize
(
preloadedData
);
this
.
showImageNode
.
active
=
false
;
this
.
showImageNode
.
active
=
false
;
if
(
this
.
pic_url
)
{
if
(
this
.
pic_url
)
{
cc
.
assetManager
.
loadRemote
(
this
.
pic_url
,
(
err
,
spriteFrame
)
=>
{
cc
.
assetManager
.
loadRemote
(
this
.
pic_url
,
(
err
,
spriteFrame
)
=>
{
...
...
play/assets/ljx_karaoke/components/karaoke/scripts/karaoke.js
View file @
f152a1f5
...
@@ -98,10 +98,15 @@ cc.Class({
...
@@ -98,10 +98,15 @@ cc.Class({
initialize
()
{
initialize
(
preloadedData
)
{
console
.
log
(
'
initialize
'
);
console
.
log
(
'
initialize
'
);
const
t1
=
Date
.
now
()
// const aitem = preloadedData.find(item => {
// return item.url == this.audio_url
// });
if
(
this
.
audio_url
)
{
if
(
this
.
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
this
.
audio_url
,
(
err
,
audioClip
)
=>
{
cc
.
assetManager
.
loadRemote
(
this
.
audio_url
,
(
err
,
audioClip
)
=>
{
console
.
log
(
Date
.
now
()
-
t1
);
if
(
err
)
{
if
(
err
)
{
// TODO handle error
// TODO handle error
return
;
return
;
...
@@ -122,8 +127,8 @@ cc.Class({
...
@@ -122,8 +127,8 @@ cc.Class({
// audioEngine.setVolume(this.currentAudioId, 1);
// audioEngine.setVolume(this.currentAudioId, 1);
this
.
resetLRC
();
//
this.resetLRC();
this
.
renderHighlight
();
//
this.renderHighlight();
// this.currentAudioId = audioEngine.play(audioClip, false, 1);
// this.currentAudioId = audioEngine.play(audioClip, false, 1);
...
@@ -194,6 +199,18 @@ cc.Class({
...
@@ -194,6 +199,18 @@ cc.Class({
// this.node.height = area.rect.width;
// this.node.height = area.rect.width;
// this.node.parent.zIndex = 99999
// this.node.parent.zIndex = 99999
this
.
richText
.
node
=
new
Proxy
(
this
.
richText
.
node
,
{
set
:
function
(
obj
,
key
,
val
){
obj
[
key
]
=
val
;
return
true
;
},
get
:
function
(
obj
,
key
){
return
obj
[
key
]
}
})
const
karaokeConf
=
gameData
.
lrcData
const
karaokeConf
=
gameData
.
lrcData
this
.
_lrcData
=
karaokeConf
.
lyrics
;
this
.
_lrcData
=
karaokeConf
.
lyrics
;
...
@@ -559,7 +576,7 @@ cc.Class({
...
@@ -559,7 +576,7 @@ cc.Class({
justifyContentPosition
(){
justifyContentPosition
(){
let
{
height
:
h
}
=
this
.
calcHighlightRichText
.
node
.
getContentSize
();
let
{
height
:
h
}
=
this
.
calcHighlightRichText
.
node
.
getContentSize
();
if
(
this
.
magicHeight
===
null
)
{
if
(
this
.
magicHeight
===
null
)
{
this
.
magicHeight
=
h
-
this
.
richText
.
lineHeight
;
this
.
magicHeight
=
h
-
this
.
richText
.
lineHeight
;
// this.richText._labelHeight
}
}
// let sw = 0;
// let sw = 0;
// let sh = 0;
// let sh = 0;
...
@@ -570,13 +587,17 @@ cc.Class({
...
@@ -570,13 +587,17 @@ cc.Class({
// this.calcSentenceRichText.string = '';
// this.calcSentenceRichText.string = '';
// h = Math.min(h, h - sh + this.node.h)
// h = Math.min(h, h - sh + this.node.h)
// }
// }
if
(
this
.
richText
.
node
.
h
eight
>
this
.
node
.
height
)
{
if
(
this
.
richText
.
_labelH
eight
>
this
.
node
.
height
)
{
let
posY
=
(
this
.
node
.
height
-
this
.
richText
.
node
.
h
eight
)
/
2
;
let
posY
=
(
this
.
node
.
height
-
this
.
richText
.
_labelH
eight
)
/
2
;
if
(
h
>
this
.
node
.
height
){
if
(
h
>
this
.
node
.
height
){
posY
=
posY
+
(
h
-
this
.
node
.
height
);
posY
=
posY
+
(
h
-
this
.
node
.
height
);
}
}
const
b4
=
this
.
richText
.
node
.
y
;
// setTimeout(() => {
this
.
richText
.
node
.
y
=
posY
;
// + this.magicHeight;
this
.
richText
.
node
.
y
=
posY
;
// + this.magicHeight;
// }, 0)
// console.log('this.richText.node.y',b4 , this.richText.node.y, posY)
}
}
},
},
findSentenceIndexByWords
(
s
,
sentenceIndexObj
)
{
findSentenceIndexByWords
(
s
,
sentenceIndexObj
)
{
...
@@ -761,7 +782,9 @@ cc.Class({
...
@@ -761,7 +782,9 @@ cc.Class({
this
.
calcHighlightRichText
.
string
=
textForCalc
;
this
.
calcHighlightRichText
.
string
=
textForCalc
;
this
.
richText
.
string
=
`
${
textForCalc
}${
remained
}
`
;
this
.
richText
.
string
=
`
${
textForCalc
}${
remained
}
`
;
// console.log(this.richText.node.getContentSize());
// console.log(this.richText.node.getContentSize());
// setTimeout(() => {
this
.
justifyContentPosition
();
this
.
justifyContentPosition
();
// }, 0)
// }
// }
},
},
...
@@ -969,7 +992,7 @@ cc.Class({
...
@@ -969,7 +992,7 @@ cc.Class({
},
},
resume
()
{
resume
()
{
const
adSrc
=
this
.
getCurrentPlayingSource
();
const
adSrc
=
this
.
getCurrentPlayingSource
();
const
ct
=
adSrc
.
getCurrentTime
();
const
ct
=
adSrc
&&
adSrc
.
getCurrentTime
();
if
(
this
.
__currentInteractivateMode
==
this
.
PLAY_MODE
.
MODE2
)
{
if
(
this
.
__currentInteractivateMode
==
this
.
PLAY_MODE
.
MODE2
)
{
if
(
!
this
.
playByTimePhaseStep
)
{
if
(
!
this
.
playByTimePhaseStep
)
{
this
.
playByTimePhaseStep
=
this
.
MODE2_STEP
.
ONE
;
this
.
playByTimePhaseStep
=
this
.
MODE2_STEP
.
ONE
;
...
...
play/assets/ljx_karaoke/scene/scene.fire
View file @
f152a1f5
This diff is collapsed.
Click to expand it.
play/assets/ljx_karaoke/script/scene.js
View file @
f152a1f5
...
@@ -88,7 +88,17 @@ cc.Class({
...
@@ -88,7 +88,17 @@ cc.Class({
getDefaultData
()
{
getDefaultData
()
{
const
data
=
{
"
title
"
:
"
aaaaa
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/7324245447e15cca42e0d4c88a32f88a.jpg
"
,
"
accompany_audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/4a59032f9b5f726cb2cde2178a7f51fc.mp3
"
,
"
lrcData
"
:{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/1d1184717ebff259c72fedcb6b249431.mp3
"
,
"
fontSize
"
:
50
,
"
lineHeight
"
:
100
,
"
lyrics
"
:[{
"
time
"
:
11.09
,
"
data
"
:
"
yi shan yi shan liang jing jing
"
,
"
newLine
"
:
true
},{
"
time
"
:
14.9
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
19.31
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},{
"
time
"
:
23.62
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},{
"
time
"
:
27.93
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
32.32
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
41.1
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
45.45
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
49.74
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},{
"
time
"
:
54.16
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},{
"
time
"
:
58.39
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
62.9
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
76.36
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
80.28
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
84.65
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},{
"
time
"
:
88.92
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},{
"
time
"
:
93.41
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
97.72
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
}]},
"
title_audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/39065c5f63a31bd1433c1a046e407a98.mp3
"
}
const
data
=
{
"
title
"
:
"
aaaaa
"
,
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/7324245447e15cca42e0d4c88a32f88a.jpg
"
,
"
accompany_audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/4a59032f9b5f726cb2cde2178a7f51fc.mp3
"
,
"
lrcData
"
:{
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/1d1184717ebff259c72fedcb6b249431.mp3
"
,
"
fontSize
"
:
50
,
"
lineHeight
"
:
100
,
"
lyrics
"
:[
{
"
time
"
:
11.09
,
"
data
"
:
"
yi shan yi shan liang jing jing
"
,
"
newLine
"
:
true
},
{
"
time
"
:
14.9
,
"
data
"
:
"
1111满天都是小星星
"
,
"
newLine
"
:
true
},
{
"
time
"
:
19.31
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},
{
"
time
"
:
23.62
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},
{
"
time
"
:
27.93
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},
{
"
time
"
:
32.32
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
41.1
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
45.45
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
49.74
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},{
"
time
"
:
54.16
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},{
"
time
"
:
58.39
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
62.9
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
76.36
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
80.28
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
},{
"
time
"
:
84.65
,
"
data
"
:
"
挂在天上放光明
"
,
"
newLine
"
:
true
},{
"
time
"
:
88.92
,
"
data
"
:
"
好像许多小眼睛
"
,
"
newLine
"
:
true
},{
"
time
"
:
93.41
,
"
data
"
:
"
一闪一闪亮晶晶
"
,
"
newLine
"
:
true
},{
"
time
"
:
97.72
,
"
data
"
:
"
满天都是小星星
"
,
"
newLine
"
:
true
}]},
"
title_audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/39065c5f63a31bd1433c1a046e407a98.mp3
"
}
// if (data.picArr) {
// if (data.picArr) {
...
@@ -108,7 +118,7 @@ cc.Class({
...
@@ -108,7 +118,7 @@ cc.Class({
console
.
log
(
'
preload data,
'
,
data
);
console
.
log
(
'
preload data,
'
,
data
);
// typeof
// typeof
this
.
loadEnd
();
this
.
loadEnd
(
data
);
if
(
window
&&
window
[
"
air
"
])
{
if
(
window
&&
window
[
"
air
"
])
{
window
[
"
air
"
].
hideAirClassLoading
();
window
[
"
air
"
].
hideAirClassLoading
();
}
}
...
...
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