Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sbox_FT_08
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
Sbox_FT_08
Commits
67230368
Commit
67230368
authored
Nov 26, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev test
parent
30c8eefc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
Cartoon.js
play/assets/tmpGame/script/Cartoon.js
+24
-23
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+6
-5
No files found.
play/assets/tmpGame/script/Cartoon.js
View file @
67230368
...
@@ -140,7 +140,9 @@ export default class Cartoon {
...
@@ -140,7 +140,9 @@ export default class Cartoon {
// Audio
// Audio
playAudio
(
audio_url
,
cb
=
null
)
{
playAudio
(
audio_url
,
cb
=
null
)
{
return
new
Promise
((
res
,
rej
)
=>
{
// return new Promise((res, rej) => {
// })
if
(
audio_url
)
{
if
(
audio_url
)
{
var
urlreg
=
/^
(?=
^.
{3,255}
$
)(
http
(
s
)?
:
\/\/)?(
www
\.)?[
a-zA-Z0-9
][
-a-zA-Z0-9
]{0,62}(\.[
a-zA-Z0-9
][
-a-zA-Z0-9
]{0,62})
+
(
:
\d
+
)
*
(\/\w
+
\.\w
+
)
*
([\?
&
]\w
+=
\w
*
)
*$/
var
urlreg
=
/^
(?=
^.
{3,255}
$
)(
http
(
s
)?
:
\/\/)?(
www
\.)?[
a-zA-Z0-9
][
-a-zA-Z0-9
]{0,62}(\.[
a-zA-Z0-9
][
-a-zA-Z0-9
]{0,62})
+
(
:
\d
+
)
*
(\/\w
+
\.\w
+
)
*
([\?
&
]\w
+=
\w
*
)
*$/
if
(
urlreg
.
test
(
audio_url
))
{
if
(
urlreg
.
test
(
audio_url
))
{
...
@@ -155,7 +157,7 @@ export default class Cartoon {
...
@@ -155,7 +157,7 @@ export default class Cartoon {
cb
();
cb
();
});
});
}
}
res
(
audio
)
//
res(audio)
});
});
}
else
{
}
else
{
const
audioNode
=
cc
.
find
(
'
Canvas/res/audio
'
).
getChildByName
(
audio_url
).
getComponent
(
cc
.
AudioSource
);
const
audioNode
=
cc
.
find
(
'
Canvas/res/audio
'
).
getChildByName
(
audio_url
).
getComponent
(
cc
.
AudioSource
);
...
@@ -167,10 +169,9 @@ export default class Cartoon {
...
@@ -167,10 +169,9 @@ export default class Cartoon {
cb
();
cb
();
});
});
}
}
res
(
audio
)
//
res(audio)
}
}
}
}
})
}
}
stopAllAudio
(
exceptUrls
=
[])
{
stopAllAudio
(
exceptUrls
=
[])
{
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
67230368
...
@@ -110,11 +110,12 @@ export default class GameLogic {
...
@@ -110,11 +110,12 @@ export default class GameLogic {
initBGMusic
()
{
initBGMusic
()
{
if
(
this
.
g_formData
.
bgMusic
)
{
if
(
this
.
g_formData
.
bgMusic
)
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
bgMusic
).
then
(
bgMusic
=>
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
bgMusic
)
console
.
log
(
bgMusic
)
// .then(bgMusic => {
bgMusic
.
isLoop
=
true
;
// console.log(bgMusic)
bgMusic
.
setVolume
(
0.3
)
// bgMusic.isLoop = true;
})
// bgMusic.setVolume(0.3)
// })
}
}
}
}
...
...
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