Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TNGD_CaveCruiser
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
TNGD_CaveCruiser
Commits
b3f4910c
Commit
b3f4910c
authored
Sep 13, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传
parent
36b06aff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
17 deletions
+31
-17
MusicBtn.ts
assets/Component/MusicBtn/MusicBtn.ts
+13
-1
HomeScene.ts
assets/Scripts/Scenes/HomeScene.ts
+2
-1
AudioMgr.ts
assets/core_tgx/base/AudioMgr.ts
+2
-2
BackPanel.prefab
assets/resources/BackPanel/BackPanel.prefab
+14
-13
No files found.
assets/Component/MusicBtn/MusicBtn.ts
View file @
b3f4910c
import
{
_decorator
,
Component
,
Node
,
Sprite
,
SpriteFrame
}
from
'cc'
;
import
{
_decorator
,
Button
,
Component
,
Node
,
Sprite
,
SpriteFrame
}
from
'cc'
;
import
{
AudioMgr
}
from
"../../core_tgx/base/AudioMgr"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -14,6 +15,12 @@ export class MusicBtn extends Component {
...
@@ -14,6 +15,12 @@ export class MusicBtn extends Component {
set
open
(
open
:
boolean
)
{
set
open
(
open
:
boolean
)
{
this
.
_open
=
open
;
this
.
_open
=
open
;
this
.
sp
.
spriteFrame
=
open
?
this
.
openSf
:
this
.
closeSf
;
this
.
sp
.
spriteFrame
=
open
?
this
.
openSf
:
this
.
closeSf
;
if
(
open
)
{
AudioMgr
.
ins
.
resume
();
}
else
{
AudioMgr
.
ins
.
pause
();
}
}
}
get
open
()
{
get
open
()
{
...
@@ -22,11 +29,16 @@ export class MusicBtn extends Component {
...
@@ -22,11 +29,16 @@ export class MusicBtn extends Component {
onLoad
()
{
onLoad
()
{
this
.
sp
=
this
.
getComponent
(
Sprite
);
this
.
sp
=
this
.
getComponent
(
Sprite
);
this
.
node
.
on
(
Button
.
EventType
.
CLICK
,
this
.
clickNode
,
this
);
}
}
start
()
{
start
()
{
this
.
open
=
true
;
this
.
open
=
true
;
}
}
clickNode
()
{
this
.
open
=
!
this
.
open
;
}
}
}
assets/Scripts/Scenes/HomeScene.ts
View file @
b3f4910c
...
@@ -10,6 +10,7 @@ import GameMgr from "../GameMgr";
...
@@ -10,6 +10,7 @@ import GameMgr from "../GameMgr";
import
RankPanel
from
"../Panels/RankPanel"
;
import
RankPanel
from
"../Panels/RankPanel"
;
import
{
UIMgr
}
from
"../../Module/UIMgr"
;
import
{
UIMgr
}
from
"../../Module/UIMgr"
;
import
{
AudioMgr
}
from
"../../core_tgx/base/AudioMgr"
;
import
{
AudioMgr
}
from
"../../core_tgx/base/AudioMgr"
;
import
BackPanel
from
"../Panels/BackPanel"
;
const
{
ccclass
,
property
}
=
_decorator
;
const
{
ccclass
,
property
}
=
_decorator
;
...
@@ -78,7 +79,7 @@ export class HomeScene extends Scene {
...
@@ -78,7 +79,7 @@ export class HomeScene extends Scene {
});
});
clickBack
=
_asyncThrottle
(()
=>
{
clickBack
=
_asyncThrottle
(()
=>
{
// popWindow(
);
showPanel
(
BackPanel
);
});
});
}
}
...
...
assets/core_tgx/base/AudioMgr.ts
View file @
b3f4910c
...
@@ -62,7 +62,7 @@ export class AudioMgr {
...
@@ -62,7 +62,7 @@ export class AudioMgr {
* @param sound clip or url for the audio
* @param sound clip or url for the audio
* @param volume
* @param volume
*/
*/
playOneShot
(
sound
:
AudioClip
|
string
,
volume
:
number
=
1
.0
,
bundleName
:
string
=
'resources'
)
{
playOneShot
(
sound
:
AudioClip
|
string
,
volume
:
number
=
1
,
bundleName
:
string
=
'resources'
)
{
if
(
sound
instanceof
AudioClip
)
{
if
(
sound
instanceof
AudioClip
)
{
this
.
_audioSource
.
volume
=
1.0
;
this
.
_audioSource
.
volume
=
1.0
;
this
.
_audioSource
.
playOneShot
(
sound
,
volume
*
this
.
_soundVolume
);
this
.
_audioSource
.
playOneShot
(
sound
,
volume
*
this
.
_soundVolume
);
...
@@ -89,7 +89,7 @@ export class AudioMgr {
...
@@ -89,7 +89,7 @@ export class AudioMgr {
* @param volume
* @param volume
* @param bundleName
* @param bundleName
*/
*/
play
(
sound
:
AudioClip
|
string
,
loop
:
boolean
=
false
,
volume
:
number
=
1
.0
,
bundleName
:
string
=
'resources'
)
{
play
(
sound
:
AudioClip
|
string
,
loop
:
boolean
=
false
,
volume
:
number
=
1
,
bundleName
:
string
=
'resources'
)
{
this
.
_musicVolumeScale
=
volume
;
this
.
_musicVolumeScale
=
volume
;
if
(
sound
instanceof
AudioClip
)
{
if
(
sound
instanceof
AudioClip
)
{
this
.
_audioSource
.
clip
=
sound
;
this
.
_audioSource
.
clip
=
sound
;
...
...
assets/resources/BackPanel/BackPanel.prefab
View file @
b3f4910c
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y":
98
,
"y":
165.149
,
"z": 0
"z": 0
},
},
"_lrot": {
"_lrot": {
...
@@ -217,7 +217,7 @@
...
@@ -217,7 +217,7 @@
"_target": null,
"_target": null,
"_left": 108,
"_left": 108,
"_right": 0,
"_right": 0,
"_top": 4
70
,
"_top": 4
02.851
,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_verticalCenter": 0,
...
@@ -279,8 +279,8 @@
...
@@ -279,8 +279,8 @@
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": -153.5
0000000000006
,
"x": -153.5,
"y":
-2.5
,
"y":
64.649
,
"z": 0
"z": 0
},
},
"_lrot": {
"_lrot": {
...
@@ -393,9 +393,9 @@
...
@@ -393,9 +393,9 @@
},
},
"_alignFlags": 9,
"_alignFlags": 9,
"_target": null,
"_target": null,
"_left": 115,
"_left": 115
.00000000000006
,
"_right": 0,
"_right": 0,
"_top": 7
79
,
"_top": 7
11.851
,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_verticalCenter": 0,
...
@@ -513,8 +513,8 @@
...
@@ -513,8 +513,8 @@
},
},
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 114.
49999999999994
,
"x": 114.
5
,
"y":
-2.5
,
"y":
64.649
,
"z": 0
"z": 0
},
},
"_lrot": {
"_lrot": {
...
@@ -627,9 +627,9 @@
...
@@ -627,9 +627,9 @@
},
},
"_alignFlags": 9,
"_alignFlags": 9,
"_target": null,
"_target": null,
"_left": 383,
"_left": 383
.00000000000006
,
"_right": 0,
"_right": 0,
"_top": 7
79
,
"_top": 7
11.851
,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_verticalCenter": 0,
...
@@ -748,7 +748,7 @@
...
@@ -748,7 +748,7 @@
"_lpos": {
"_lpos": {
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": -2
70
,
"y": -2
02.851
,
"z": 0
"z": 0
},
},
"_lrot": {
"_lrot": {
...
@@ -919,7 +919,7 @@
...
@@ -919,7 +919,7 @@
"_target": null,
"_target": null,
"_left": 335,
"_left": 335,
"_right": 0,
"_right": 0,
"_top":
1042
,
"_top":
974.851
,
"_bottom": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_verticalCenter": 0,
...
@@ -1029,7 +1029,8 @@
...
@@ -1029,7 +1029,8 @@
"__id__": 45
"__id__": 45
},
},
"closeBtn": null,
"closeBtn": null,
"spNode": null,
"yes": null,
"no": null,
"_id": ""
"_id": ""
},
},
{
{
...
...
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