Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sb_karaoke_cocos
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
sb_karaoke_cocos
Commits
fc6d1edf
Commit
fc6d1edf
authored
Dec 14, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 调整兼容问题
parent
5a06d2f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
51 deletions
+11
-51
adapter.js
...ts/sb_karaoke_cocos/components/karaoke/scripts/adapter.js
+0
-32
karaoke.js
...ts/sb_karaoke_cocos/components/karaoke/scripts/karaoke.js
+11
-19
No files found.
assets/sb_karaoke_cocos/components/karaoke/scripts/adapter.js
View file @
fc6d1edf
...
...
@@ -224,38 +224,6 @@ cc.Class({
this
.
lrc
.
initialize
();
this
.
setCurrentMode
(
this
.
lrc
.
PLAY_MODE
.
MODE1
);
this
.
buttonGroupChange
(
this
.
modeNameMap
[
this
.
getCurrentMode
()])
setTimeout
(()
=>
{
return
const
{
x
,
y
,
width
,
height
}
=
window
.
bbbbb
;
console
.
log
(
999
,
{
x
,
y
,
width
,
height
});
// this.convertBoundingCoordinate(_curShowItem, window.bbbbb)
// return
const
targetNode
=
window
.
bbbbb
;
const
_curShowItem
=
this
.
btnGroup
;
// _curShowItem.anchorX = 1;
// _curShowItem.anchorY = 1;
console
.
log
(
targetNode
.
parent
);
const
baseOn
=
targetNode
.
parent
;
// cc.find('Canvas');
const
worldPos
=
baseOn
.
convertToWorldSpaceAR
(
cc
.
v2
(
targetNode
.
x
,
targetNode
.
y
));
const
localPos
=
_curShowItem
.
_parent
.
convertToNodeSpaceAR
(
cc
.
v2
(
worldPos
.
x
,
worldPos
.
y
));
const
worldPos2
=
baseOn
.
convertToWorldSpaceAR
(
cc
.
v2
(
targetNode
.
x
+
targetNode
.
width
,
targetNode
.
y
+
targetNode
.
height
));
const
localPos2
=
_curShowItem
.
_parent
.
convertToNodeSpaceAR
(
cc
.
v2
(
worldPos2
.
x
,
worldPos2
.
y
));
// this.actionButton.node.x = localPos.x;
// localPos.x + targetNode.width
_curShowItem
.
width
=
targetNode
.
width
_curShowItem
.
height
=
targetNode
.
height
_curShowItem
.
scale
=
(
localPos2
.
x
-
localPos
.
x
)
/
_curShowItem
.
width
// _curShowItem.width = (localPos2.x - localPos.x)
// _curShowItem.height = (localPos2.y - localPos.y)
_curShowItem
.
y
=
(
localPos2
.
y
+
localPos
.
y
)
/
2
;
_curShowItem
.
x
=
(
localPos2
.
x
+
localPos
.
x
)
/
2
;
const
{
x
:
x1
,
y
:
y1
,
width
:
w1
,
height
:
h1
}
=
_curShowItem
;
console
.
log
(
101010
,
{
x1
,
y1
,
w1
,
h1
})
},
1000
)
// this.lrc.node.zIndex = 99999
});
cc
.
director
.
on
(
'
GAME_DATA_FETCHED
'
,
(
data
)
=>
{
...
...
assets/sb_karaoke_cocos/components/karaoke/scripts/karaoke.js
View file @
fc6d1edf
...
...
@@ -96,8 +96,6 @@ cc.Class({
}
},
initialize
()
{
if
(
this
.
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
this
.
audio_url
,
null
,
(
err
,
audioClip
)
=>
{
...
...
@@ -108,13 +106,10 @@ cc.Class({
this
.
_audioClip
=
audioClip
;
this
.
_audioSource
=
new
cc
.
AudioSource
();
this
.
_audioSource
.
clip
=
this
.
_audioClip
;
this
.
_audioSource
.
audio
.
on
(
'
ended
'
,
()
=>
{
console
.
log
(
'
_audioClip ended
'
);
this
.
_audioSource
.
setCurrentTime
(
0
)
});
this
.
_audioSource
.
audio
.
on
(
'
stop
'
,
()
=>
{
console
.
log
(
'
_audioClip stop
'
);
});
// this._audioSource.audio.on('ended', () => {
// console.log('_audioClip ended');
// this._audioSource.setCurrentTime(0)
// });
// this.currentAudioId = audioEngine.play(this._audioClip, false, 0);
// audioEngine.pause(this.currentAudioId);
// audioEngine.setCurrentTime(this.currentAudioId, 0);
...
...
@@ -135,14 +130,10 @@ cc.Class({
this
.
_audioAcClip
=
audioClip
;
this
.
_audioACSource
=
new
cc
.
AudioSource
();
this
.
_audioACSource
.
clip
=
this
.
_audioAcClip
;
this
.
_audioACSource
.
audio
.
on
(
'
ended
'
,
()
=>
{
console
.
log
(
'
_audioACSource ended
'
);
this
.
_audioACSource
.
setCurrentTime
(
0
)
});
this
.
_audioACSource
.
audio
.
on
(
'
stop
'
,
()
=>
{
console
.
log
(
'
_audioACSource stop
'
);
});
// this._audioACSource.audio.on('ended', () => {
// console.log('_audioACSource ended');
// this._audioACSource.setCurrentTime(0)
// });
// this.currentAcAudioId = audioEngine.play(this._audioAcClip, false, 0);
// audioEngine.pause(this.currentAcAudioId);
...
...
@@ -791,10 +782,8 @@ cc.Class({
}
if
(
this
.
playByTimePhaseStep
&
1
)
{
return
this
.
_audioSource
;
console
.
log
(
'
change 3 step 1
'
);
}
else
{
return
this
.
_audioACSource
;
console
.
log
(
'
change 2 step 1
'
);
}
}
if
(
this
.
__currentInteractivateMode
==
this
.
PLAY_MODE
.
MODE3
)
{
...
...
@@ -1007,5 +996,8 @@ cc.Class({
onDestroy
()
{
// audioEngine.uncache(this.audioUrl);
audioEngine
.
stop
(
this
.
_currentAudioId
);
this
.
_audioSource
.
destroy
();
this
.
_audioACSource
.
destroy
();
}
});
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