Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FastMail
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
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
wanqing
FastMail
Commits
8b1786ea
Commit
8b1786ea
authored
Dec 24, 2020
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加音效背景音乐开关设置
parent
2d758015
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
6119 additions
and
5215 deletions
+6119
-5215
DemoScenes.unity
FastMail/Assets/0A1_Scenes/DemoScenes.unity
+32
-485
SettingPanel.cs
FastMail/Assets/0A2_Scripts/Battle/UI/SettingPanel.cs
+84
-0
SettingPanel.cs.meta
FastMail/Assets/0A2_Scripts/Battle/UI/SettingPanel.cs.meta
+11
-0
ChainRopeView.cs
FastMail/Assets/0A2_Scripts/Battle/View/ChainRopeView.cs
+3
-8
AudioServices.cs
FastMail/Assets/0A2_Scripts/Services/AudioServices.cs
+25
-0
GlobalConfig.cs
FastMail/Assets/0A2_Scripts/Services/GlobalConfig.cs
+3
-0
BattleUI.prefab
FastMail/Assets/0A3_Prefabs/BattleUI.prefab
+5955
-4711
BattleConfig.asset
FastMail/Assets/Resources/BattleConfig.asset
+6
-11
No files found.
FastMail/Assets/0A1_Scenes/DemoScenes.unity
View file @
8b1786ea
This diff is collapsed.
Click to expand it.
FastMail/Assets/0A2_Scripts/Battle/UI/SettingPanel.cs
0 → 100644
View file @
8b1786ea
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
SettingPanel
:
MonoBehaviour
{
public
Button
m_vibrationBtn
;
//震动按钮
public
Button
m_soundBtn
;
//音效按钮
public
Button
m_bgmBtn
;
//背景音乐按钮
public
GameObject
m_vibrationImageObj
;
//震动✔
public
GameObject
m_soundImageObj
;
//音效✔
public
GameObject
m_bgmImageObj
;
//背景音乐✔
private
void
Awake
()
{
m_vibrationBtn
.
onClick
.
AddListener
(
OnVibrationClick
);
m_soundBtn
.
onClick
.
AddListener
(
OnSoundClick
);
m_bgmBtn
.
onClick
.
AddListener
(
OnBgmClick
);
}
private
void
Start
()
{
string
varStr1
=
GlobalConfig
.
VibrationKey
;
if
(
LocalRecord
.
HasKey
(
varStr1
))
{
m_vibrationImageObj
.
SetActive
(
LocalRecord
.
GetIntRecord
(
varStr1
)
>
0
?
true
:
false
);
}
else
{
m_vibrationImageObj
.
SetActive
(
true
);
}
string
varStr2
=
GlobalConfig
.
SoundKey
;
if
(
LocalRecord
.
HasKey
(
varStr2
))
{
m_soundImageObj
.
SetActive
(
LocalRecord
.
GetIntRecord
(
varStr2
)
>
0
?
true
:
false
);
}
else
{
m_soundImageObj
.
SetActive
(
true
);
}
string
varStr3
=
GlobalConfig
.
BgmKey
;
if
(
LocalRecord
.
HasKey
(
varStr3
))
{
m_bgmImageObj
.
SetActive
(
LocalRecord
.
GetIntRecord
(
varStr3
)
>
0
?
true
:
false
);
}
else
{
m_bgmImageObj
.
SetActive
(
true
);
}
}
//震动
void
OnVibrationClick
()
{
bool
varBool
=
m_vibrationImageObj
.
activeSelf
;
m_vibrationImageObj
.
SetActive
(!
varBool
);
LocalRecord
.
SetIntRecord
(
GlobalConfig
.
VibrationKey
,
varBool
?
0
:
1
);
}
//音效
void
OnSoundClick
()
{
bool
varBool
=
m_soundImageObj
.
activeSelf
;
m_soundImageObj
.
SetActive
(!
varBool
);
LocalRecord
.
SetIntRecord
(
GlobalConfig
.
SoundKey
,
varBool
?
0
:
1
);
}
//背景音乐
void
OnBgmClick
()
{
bool
varBool
=
m_bgmImageObj
.
activeSelf
;
m_bgmImageObj
.
SetActive
(!
varBool
);
LocalRecord
.
SetIntRecord
(
GlobalConfig
.
BgmKey
,
varBool
?
0
:
1
);
if
(
varBool
)
{
GameServices
.
audioServices
.
RecycleBgm
();
}
else
{
GameServices
.
audioServices
.
PlayBgm
(
GameServices
.
configService
.
audioConfig
.
GameBgm
);
}
}
public
void
OnCloseClick
()
{
gameObject
.
SetActive
(
false
);
BattleCtrl
.
instance
.
battleUI
.
SetBattleObjState
(
true
);
}
}
FastMail/Assets/0A2_Scripts/Battle/UI/SettingPanel.cs.meta
0 → 100644
View file @
8b1786ea
fileFormatVersion: 2
guid: 86d1c03e5362d0d44ab2d6e6ca6418f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
FastMail/Assets/0A2_Scripts/Battle/View/ChainRopeView.cs
View file @
8b1786ea
...
@@ -71,7 +71,6 @@ public class ChainRopeView : MonoBehaviour
...
@@ -71,7 +71,6 @@ public class ChainRopeView : MonoBehaviour
private
Outlinable
m_outlinable
;
//插件脚本
private
Outlinable
m_outlinable
;
//插件脚本
private
bool
m_bIsClawUp
=
false
;
//是否爪子在上升
private
bool
m_bIsClawUp
=
false
;
//是否爪子在上升
private
AudioSource
m_clawDownOrUpAudioSource
;
//下降上升音乐,需要循环播放
private
AudioSource
m_clawDownOrUpAudioSource
;
//下降上升音乐,需要循环播放
private
bool
m_bControlClawDownOrUpAudio
=
true
;
//控制音效
void
Awake
()
void
Awake
()
{
{
...
@@ -228,7 +227,6 @@ public class ChainRopeView : MonoBehaviour
...
@@ -228,7 +227,6 @@ public class ChainRopeView : MonoBehaviour
{
{
return
;
return
;
}
}
m_bControlClawDownOrUpAudio
=
true
;
m_clawDownOrUpAudioSource
=
GameServices
.
audioServices
.
GetPlayAudioSource
(
GameServices
.
configService
.
audioConfig
.
clawDownOrUp
);
m_clawDownOrUpAudioSource
=
GameServices
.
audioServices
.
GetPlayAudioSource
(
GameServices
.
configService
.
audioConfig
.
clawDownOrUp
);
//第五关特殊处理
//第五关特殊处理
//if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFiveIndex)
//if (BattleCtrl.instance.levelManager.CurLevelIndex == LevelEnum.levelFiveIndex)
...
@@ -560,9 +558,8 @@ public class ChainRopeView : MonoBehaviour
...
@@ -560,9 +558,8 @@ public class ChainRopeView : MonoBehaviour
}
}
else
else
{
{
if
(
m_
bControlClawDownOrUpAudio
)
if
(
m_
clawDownOrUpAudioSource
)
{
{
m_bControlClawDownOrUpAudio
=
false
;
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
m_clawDownOrUpAudioSource
=
null
;
m_clawDownOrUpAudioSource
=
null
;
}
}
...
@@ -590,9 +587,8 @@ public class ChainRopeView : MonoBehaviour
...
@@ -590,9 +587,8 @@ public class ChainRopeView : MonoBehaviour
else
else
{
{
SetJoyStickDirectTrans
(
m_topCollider
.
transform
);
SetJoyStickDirectTrans
(
m_topCollider
.
transform
);
if
(
m_
bControlClawDownOrUpAudio
)
if
(
m_
clawDownOrUpAudioSource
)
{
{
m_bControlClawDownOrUpAudio
=
false
;
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
m_clawDownOrUpAudioSource
=
null
;
m_clawDownOrUpAudioSource
=
null
;
}
}
...
@@ -634,9 +630,8 @@ public class ChainRopeView : MonoBehaviour
...
@@ -634,9 +630,8 @@ public class ChainRopeView : MonoBehaviour
}
}
else
else
{
{
if
(
m_
bControlClawDownOrUpAudio
)
if
(
m_
clawDownOrUpAudioSource
)
{
{
m_bControlClawDownOrUpAudio
=
false
;
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
GameServices
.
audioServices
.
AudioPlayFinished
(
m_clawDownOrUpAudioSource
);
m_clawDownOrUpAudioSource
=
null
;
m_clawDownOrUpAudioSource
=
null
;
}
}
...
...
FastMail/Assets/0A2_Scripts/Services/AudioServices.cs
View file @
8b1786ea
...
@@ -63,6 +63,10 @@ public class AudioServices : MonoBehaviour
...
@@ -63,6 +63,10 @@ public class AudioServices : MonoBehaviour
public
void
PlayBgm
(
AudioClip
clip
)
public
void
PlayBgm
(
AudioClip
clip
)
{
{
if
(
LocalRecord
.
HasKey
(
GlobalConfig
.
BgmKey
)
&&
LocalRecord
.
GetIntRecord
(
GlobalConfig
.
BgmKey
)
==
0
)
{
return
;
}
if
(
bgmSource
==
null
)
if
(
bgmSource
==
null
)
{
{
bgmSource
=
GetSource
();
bgmSource
=
GetSource
();
...
@@ -75,9 +79,22 @@ public class AudioServices : MonoBehaviour
...
@@ -75,9 +79,22 @@ public class AudioServices : MonoBehaviour
bgmSource
.
Play
();
bgmSource
.
Play
();
}
}
//释放背景音乐
public
void
RecycleBgm
()
{
if
(
bgmSource
)
{
RecycleSource
(
bgmSource
);
bgmSource
=
null
;
}
}
public
void
PlayAudio
(
AudioClip
clip
,
bool
isLoop
=
false
,
Action
onPlayEnd
=
null
)
public
void
PlayAudio
(
AudioClip
clip
,
bool
isLoop
=
false
,
Action
onPlayEnd
=
null
)
{
{
if
(
LocalRecord
.
HasKey
(
GlobalConfig
.
SoundKey
)
&&
LocalRecord
.
GetIntRecord
(
GlobalConfig
.
SoundKey
)
==
0
)
{
return
;
}
AudioSource
source
=
GetSource
();
AudioSource
source
=
GetSource
();
source
.
clip
=
clip
;
source
.
clip
=
clip
;
source
.
loop
=
isLoop
;
source
.
loop
=
isLoop
;
...
@@ -91,6 +108,10 @@ public class AudioServices : MonoBehaviour
...
@@ -91,6 +108,10 @@ public class AudioServices : MonoBehaviour
}
}
public
AudioSource
GetPlayAudioSource
(
AudioClip
clip
)
public
AudioSource
GetPlayAudioSource
(
AudioClip
clip
)
{
{
if
(
LocalRecord
.
HasKey
(
GlobalConfig
.
SoundKey
)
&&
LocalRecord
.
GetIntRecord
(
GlobalConfig
.
SoundKey
)
==
0
)
{
return
null
;
}
AudioSource
source
=
GetSource
();
AudioSource
source
=
GetSource
();
source
.
clip
=
clip
;
source
.
clip
=
clip
;
source
.
loop
=
true
;
source
.
loop
=
true
;
...
@@ -101,6 +122,10 @@ public class AudioServices : MonoBehaviour
...
@@ -101,6 +122,10 @@ public class AudioServices : MonoBehaviour
public
void
AudioPlayFinished
(
AudioSource
source
)
public
void
AudioPlayFinished
(
AudioSource
source
)
{
{
if
(
LocalRecord
.
HasKey
(
GlobalConfig
.
SoundKey
)
&&
LocalRecord
.
GetIntRecord
(
GlobalConfig
.
SoundKey
)
==
0
)
{
return
;
}
RecycleSource
(
source
);
RecycleSource
(
source
);
}
}
...
...
FastMail/Assets/0A2_Scripts/Services/GlobalConfig.cs
View file @
8b1786ea
...
@@ -22,6 +22,9 @@ public class GlobalConfig
...
@@ -22,6 +22,9 @@ public class GlobalConfig
/// 语言类型
/// 语言类型
/// </summary>
/// </summary>
public
static
LangeType
langType
;
public
static
LangeType
langType
;
public
static
string
VibrationKey
=
"VibrationKey"
;
//震动Key
public
static
string
SoundKey
=
"SoundKey"
;
//音效Key
public
static
string
BgmKey
=
"BgmKey"
;
//音乐Key
}
}
public
enum
LangeType
public
enum
LangeType
...
...
FastMail/Assets/0A3_Prefabs/BattleUI.prefab
View file @
8b1786ea
This diff is collapsed.
Click to expand it.
FastMail/Assets/Resources/BattleConfig.asset
View file @
8b1786ea
...
@@ -36,14 +36,9 @@ MonoBehaviour:
...
@@ -36,14 +36,9 @@ MonoBehaviour:
fifthLevelGoalName3
:
SM_Primitive_Sphere_02
fifthLevelGoalName3
:
SM_Primitive_Sphere_02
sixthLevelGoalName
:
SM_Primitive_Pyramid_01
sixthLevelGoalName
:
SM_Primitive_Pyramid_01
audioConfig
:
audioConfig
:
pienDeads
:
[]
failList
:
win
:
{
fileID
:
0
}
-
{
fileID
:
8300000
,
guid
:
03522ac8d99167f45ac598927093c79e
,
type
:
3
}
fail
:
{
fileID
:
0
}
-
{
fileID
:
8300000
,
guid
:
18755c9489da3654db451b917f8ecd81
,
type
:
3
}
shoot
:
{
fileID
:
0
}
GameBgm
:
{
fileID
:
8300000
,
guid
:
75b73601c36cb92418c2f0e6a18de5e2
,
type
:
3
}
ElevatorOpen
:
{
fileID
:
0
}
Success
:
{
fileID
:
8300000
,
guid
:
a4fa2dc9fd619ef4a965de465f1586dc
,
type
:
3
}
keyPick
:
{
fileID
:
0
}
clawDownOrUp
:
{
fileID
:
8300000
,
guid
:
f582290ca8df575409f8f5868dbeb6c6
,
type
:
3
}
GameBgm
:
{
fileID
:
0
}
npcRescue
:
{
fileID
:
0
}
npc2pien
:
{
fileID
:
0
}
gunPick
:
{
fileID
:
0
}
girlScream
:
{
fileID
:
0
}
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