加上音效和BGM
This commit is contained in:
parent
5ac8cd27de
commit
c915e76352
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a03bb7c4004e74d35a349c60e8216507
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 31cea82df675641a1acb62fea506dd5b
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides:
|
||||
4:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
7:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
forceToMono: 1
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2fe24cf0c6467410abbe6a0400b26c78
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides:
|
||||
4:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
7:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
forceToMono: 1
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 502c80f0b8bc144c5bcd00f7a5b996b5
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides:
|
||||
4:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
7:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
forceToMono: 1
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c964589478e574c59a509b7c3b555823
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides:
|
||||
4:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
7:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
forceToMono: 1
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5ca3534a3bc1c485ab46b719d77c0ff0
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides:
|
||||
4:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
7:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 3
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
forceToMono: 1
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -12,4 +12,49 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4d4c1d4ac76fb492e9badc39ba99288c, type: 3}
|
||||
m_Name: AudioConfig
|
||||
m_EditorClassIdentifier:
|
||||
AudioPacks: []
|
||||
AudioPacks:
|
||||
- myType: 0
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 47c17744484df471789b35506acb6247, type: 3}
|
||||
- myType: 101
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 158f2f6b832054362b6ed4a0672acea0, type: 3}
|
||||
- myType: 102
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: cef8d55b1bc954d15a9dd8351005fdef, type: 3}
|
||||
- myType: 103
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 3d067c6f5cb66480ebadea306998e7ed, type: 3}
|
||||
- myType: 104
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 8a1349168556c40cbbe33988990b702a, type: 3}
|
||||
- myType: 105
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 9db658cc186d6412da483738cee75232, type: 3}
|
||||
- myType: 106
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 3c6b0269fb9624c519e809e65a912630, type: 3}
|
||||
- myType: 201
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 4b08699866dfe4b79a29c91ba2c658ce, type: 3}
|
||||
- myType: 202
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 1b53e9ae5e38f464a94d34dde19d7646, type: 3}
|
||||
- myType: 203
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 01e380bf3bb804b25a7b50d204172e63, type: 3}
|
||||
- myType: 204
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: c964589478e574c59a509b7c3b555823, type: 3}
|
||||
- myType: 205
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 5ca3534a3bc1c485ab46b719d77c0ff0, type: 3}
|
||||
- myType: 206
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 502c80f0b8bc144c5bcd00f7a5b996b5, type: 3}
|
||||
- myType: 207
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 4529820553b6043cfb28ea8a474e645d, type: 3}
|
||||
- myType: 208
|
||||
myClips:
|
||||
- {fileID: 8300000, guid: 5ca3534a3bc1c485ab46b719d77c0ff0, type: 3}
|
||||
|
|
|
@ -1087,6 +1087,11 @@ MonoBehaviour:
|
|||
mCvsOpenPart: {fileID: 3358427266420662963}
|
||||
mBtnOpen: {fileID: 2617655800311524037}
|
||||
mGobLogo: {fileID: 2462780529621831198}
|
||||
mLogoSounds:
|
||||
- {fileID: 8300000, guid: 2fe24cf0c6467410abbe6a0400b26c78, type: 3}
|
||||
- {fileID: 8300000, guid: 31cea82df675641a1acb62fea506dd5b, type: 3}
|
||||
- {fileID: 8300000, guid: 95210ea5d59b94937bf9090a9c16733d, type: 3}
|
||||
- {fileID: 8300000, guid: 2b37b0d87cba54cab936589f9e1e21c7, type: 3}
|
||||
mIconPosX:
|
||||
- -900
|
||||
- -450
|
||||
|
|
|
@ -564,6 +564,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
mSignOn: {fileID: 1753321238473391198}
|
||||
mSignOff: {fileID: 7169702685638789580}
|
||||
mClickSound: 204
|
||||
--- !u!1 &7169702685638789580
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -773,6 +774,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
mSignOn: {fileID: 1397343710898404738}
|
||||
mSignOff: {fileID: 2280471745191183687}
|
||||
mClickSound: 204
|
||||
--- !u!1 &9049642900839062096
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -20,5 +20,23 @@ public enum AudioType
|
|||
{
|
||||
None = -1,
|
||||
|
||||
BGM
|
||||
BGM = 0,
|
||||
|
||||
StartGame = 101,
|
||||
Action = 102,
|
||||
Win = 103,
|
||||
Lose = 104,
|
||||
Complete = 105,
|
||||
New = 106,
|
||||
|
||||
TurnPage = 201,
|
||||
ReachEdge = 202,
|
||||
|
||||
Click_Normal = 203,
|
||||
Click_Tip = 204,
|
||||
Click_Last = 205,
|
||||
Click_Next = 206,
|
||||
Click_Play = 207,
|
||||
|
||||
UIClose = 208
|
||||
}
|
||||
|
|
|
@ -81,18 +81,24 @@ public class AudioManager : D_MonoSingleton<AudioManager>
|
|||
if (tClip == null)
|
||||
return;
|
||||
|
||||
mMusicPlayer.clip = tClip;
|
||||
mMusicPlayer.loop = true;
|
||||
mMusicPlayer.volume *= pVolumeScale;
|
||||
mMusicPlayer.Play();
|
||||
if (mMusicPlayer.enabled)
|
||||
{
|
||||
mMusicPlayer.clip = tClip;
|
||||
mMusicPlayer.loop = true;
|
||||
mMusicPlayer.volume *= pVolumeScale;
|
||||
mMusicPlayer.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopBGMusic()
|
||||
{
|
||||
CheckMusicPlayer();
|
||||
|
||||
mMusicPlayer.Stop();
|
||||
mMusicPlayer.clip = null;
|
||||
if (mMusicPlayer.enabled)
|
||||
{
|
||||
mMusicPlayer.Stop();
|
||||
mMusicPlayer.clip = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(AudioType pType, float pVolumeScale = 1)
|
||||
|
@ -103,7 +109,10 @@ public class AudioManager : D_MonoSingleton<AudioManager>
|
|||
if (tClip == null)
|
||||
return;
|
||||
|
||||
mSoundPlayer.PlayOneShot(tClip, pVolumeScale);
|
||||
if (mSoundPlayer.enabled)
|
||||
{
|
||||
mSoundPlayer.PlayOneShot(tClip, pVolumeScale);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(AudioClip pClip, float pVolumeScale = 1)
|
||||
|
@ -114,7 +123,10 @@ public class AudioManager : D_MonoSingleton<AudioManager>
|
|||
if (tClip == null)
|
||||
return;
|
||||
|
||||
mSoundPlayer.PlayOneShot(tClip, pVolumeScale);
|
||||
if (mSoundPlayer.enabled)
|
||||
{
|
||||
mSoundPlayer.PlayOneShot(tClip, pVolumeScale);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound3D(AudioSource pAudioSrc, AudioType pType)
|
||||
|
@ -123,7 +135,10 @@ public class AudioManager : D_MonoSingleton<AudioManager>
|
|||
if (tClip == null)
|
||||
return;
|
||||
|
||||
pAudioSrc.PlayOneShot(tClip);
|
||||
if (pAudioSrc.enabled)
|
||||
{
|
||||
pAudioSrc.PlayOneShot(tClip);
|
||||
}
|
||||
}
|
||||
|
||||
public AudioSource PlaySoundLoop(AudioType pType, float pVolumeScale = 1)
|
||||
|
|
|
@ -67,22 +67,7 @@ public class UIManager : S_MonoSingleton<UIManager>
|
|||
public T CloseUI<T>() where T : BasePanel
|
||||
{
|
||||
T tUI = GetUI<T>();
|
||||
tUI.gameObject.SetActive(false);
|
||||
tUI.OnClose();
|
||||
|
||||
int tIndex = mUIList.IndexOf(tUI);
|
||||
if (tIndex == mUIList.Count - 1)
|
||||
{
|
||||
mUIList.Remove(tUI);
|
||||
if (mUIList.Count > 0)
|
||||
{
|
||||
mUIList[mUIList.Count - 1].OnFocus(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mUIList.Remove(tUI);
|
||||
}
|
||||
CloseUI(tUI);
|
||||
|
||||
return tUI;
|
||||
}
|
||||
|
@ -90,6 +75,7 @@ public class UIManager : S_MonoSingleton<UIManager>
|
|||
public void CloseUI(BasePanel pBasePanel)
|
||||
{
|
||||
pBasePanel.gameObject.SetActive(false);
|
||||
pBasePanel.OnClose();
|
||||
|
||||
int tIndex = mUIList.IndexOf(pBasePanel);
|
||||
if (tIndex == mUIList.Count - 1)
|
||||
|
|
|
@ -69,11 +69,17 @@ public class GameLogic : MonoBehaviour
|
|||
if (tEdData.IsGoodEnding)
|
||||
{
|
||||
PlayerData.Instance.UnlockNewLevel();
|
||||
AudioManager.Instance.PlaySound(AudioType.Win);
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioManager.Instance.PlaySound(AudioType.Lose);
|
||||
}
|
||||
tUIResult.Init(PlayerData.Instance.CurrentLevelID, tEdData.EndingName, tEdData.IsGoodEnding, tHasNew, PlayerData.Instance.IsNextLevelPassed());
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioManager.Instance.PlaySound(AudioType.Lose);
|
||||
tUIResult.Init(PlayerData.Instance.CurrentLevelID, "", false, false, PlayerData.Instance.IsNextLevelPassed());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ButtonEndings : MonoBehaviour
|
|||
private void Awake()
|
||||
{
|
||||
Button tBtn = GetComponent<Button>();
|
||||
UIUtils.BindBtn(tBtn, OnClick);
|
||||
UIUtils.BindBtn(tBtn, OnClick, AudioType.Click_Tip);
|
||||
}
|
||||
|
||||
public void Init(int pLevelID, int pUnlockCount, int pTotalCount)
|
||||
|
|
|
@ -7,6 +7,12 @@ public class LevelPage : PageView
|
|||
{
|
||||
public Action<int> DelClickLevel;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
OnScrollPage = PlayScrollPage;
|
||||
OnReachEdge = PlayReachEdge;
|
||||
}
|
||||
|
||||
public override int Count
|
||||
{
|
||||
get
|
||||
|
@ -45,4 +51,14 @@ public class LevelPage : PageView
|
|||
{
|
||||
DelClickLevel?.Invoke(pLevelIndex);
|
||||
}
|
||||
|
||||
private void PlayScrollPage()
|
||||
{
|
||||
AudioManager.Instance.PlaySound(AudioType.TurnPage);
|
||||
}
|
||||
|
||||
private void PlayReachEdge()
|
||||
{
|
||||
AudioManager.Instance.PlaySound(AudioType.ReachEdge);
|
||||
}
|
||||
}
|
|
@ -7,6 +7,11 @@ using System;
|
|||
|
||||
public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandler
|
||||
{
|
||||
public Action<int> OnPageChanged;
|
||||
|
||||
protected Action OnScrollPage;
|
||||
protected Action OnReachEdge;
|
||||
|
||||
public int CountPerPage;
|
||||
|
||||
public float SlideSpeed = 4; //滑动速度
|
||||
|
@ -17,8 +22,6 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl
|
|||
[SerializeField] GameObject mTplPage;
|
||||
[SerializeField] GameObject mTplCell;
|
||||
|
||||
public Action<int> OnPageChanged;
|
||||
|
||||
ScrollRect rect; //滑动组件
|
||||
private float targethorizontal = 0; //滑动的起始坐标
|
||||
private bool isDrag = false; //是否拖拽结束
|
||||
|
@ -69,6 +72,8 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl
|
|||
isDrag = false;
|
||||
startTime = 0;
|
||||
stopMove = false;
|
||||
|
||||
OnReachEdge?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -79,6 +84,7 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl
|
|||
}
|
||||
else
|
||||
{
|
||||
OnReachEdge?.Invoke();
|
||||
//Debug.LogError("页码不存在");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,13 @@ public class PanelEndings : BasePanel
|
|||
UIUtils.BindBtn(mBtnMask, OnClickMask);
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
|
||||
AudioManager.Instance.PlaySound(AudioType.UIClose);
|
||||
}
|
||||
|
||||
public void Init(int pLevelID)
|
||||
{
|
||||
mLevelID = pLevelID;
|
||||
|
|
|
@ -39,9 +39,9 @@ public class PanelGame : BasePanel
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
UIUtils.BindBtn(mBtnLevel, OnClickLevel);
|
||||
UIUtils.BindBtn(mBtnMenu, OnClickMenu);
|
||||
UIUtils.BindBtn(mBtnPlay, OnClickPlay);
|
||||
UIUtils.BindBtn(mBtnLevel, OnClickLevel, AudioType.Click_Normal);
|
||||
UIUtils.BindBtn(mBtnMenu, OnClickMenu, AudioType.Click_Tip);
|
||||
UIUtils.BindBtn(mBtnPlay, OnClickPlay, AudioType.Click_Play);
|
||||
|
||||
mBtnEndings.DelClick = OnClickEndings;
|
||||
|
||||
|
@ -127,6 +127,7 @@ public class PanelGame : BasePanel
|
|||
|
||||
private void OnClickPlay()
|
||||
{
|
||||
mGobChooseTip.SetActive(false);
|
||||
mGobTapTip.SetActive(false);
|
||||
mGobPlay.SetActive(false);
|
||||
mGobOpMask.SetActive(true);
|
||||
|
@ -144,7 +145,14 @@ public class PanelGame : BasePanel
|
|||
mAtrAction.gameObject.SetActive(true);
|
||||
mAtrAction.Play("Action");
|
||||
|
||||
TimerManager.Instance.Schedule(StartPlay, 2f);
|
||||
AudioManager.Instance.PlaySound(AudioType.Click_Play);
|
||||
TimerManager.Instance.Schedule(PlayActionSound, 1f);
|
||||
}
|
||||
|
||||
private void PlayActionSound()
|
||||
{
|
||||
AudioManager.Instance.PlaySound(AudioType.Action);
|
||||
TimerManager.Instance.Schedule(StartPlay, 1f);
|
||||
}
|
||||
|
||||
private void StartPlay()
|
||||
|
|
|
@ -14,7 +14,7 @@ public class PanelLevel : BasePanel
|
|||
private void Awake()
|
||||
{
|
||||
UIUtils.BindBtn(mBtnBack, Close);
|
||||
UIUtils.BindBtn(mBtnBackToMain, OnClickBackToMain);
|
||||
UIUtils.BindBtn(mBtnBackToMain, OnClickBackToMain, AudioType.Click_Normal);
|
||||
|
||||
mLvPage.DelClickLevel = OnClickLevel;
|
||||
}
|
||||
|
@ -26,6 +26,13 @@ public class PanelLevel : BasePanel
|
|||
mLvPage.LoadData();
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
|
||||
AudioManager.Instance.PlaySound(AudioType.UIClose);
|
||||
}
|
||||
|
||||
public void Init(bool pOpenInLevel)
|
||||
{
|
||||
mOpenInLevel = pOpenInLevel;
|
||||
|
@ -42,6 +49,8 @@ public class PanelLevel : BasePanel
|
|||
{
|
||||
PlayerData.Instance.CurrentLevel = pLevelIndex + 1;
|
||||
GameManager.Instance.LoadGame();
|
||||
|
||||
AudioManager.Instance.PlaySound(AudioType.StartGame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ public class PanelMain : BasePanel
|
|||
[SerializeField] Button mBtnOpen;
|
||||
|
||||
[SerializeField] GameObject mGobLogo;
|
||||
[SerializeField] AudioClip[] mLogoSounds;
|
||||
|
||||
[SerializeField] float[] mIconPosX;
|
||||
[SerializeField] Image[] mImgLevelIcons;
|
||||
[SerializeField] RectTransform mRctBottom;
|
||||
|
@ -34,8 +36,11 @@ public class PanelMain : BasePanel
|
|||
|
||||
private int mWaftDir = 1;
|
||||
private bool mIsWafting = false;
|
||||
|
||||
|
||||
private int mSoundIndex = -1;
|
||||
|
||||
private bool mIsRolling = false;
|
||||
private TimerUnit mLogoSoundTimer;
|
||||
private TimerUnit mRollTimer;
|
||||
|
||||
private SoundBubble mCurrentBubble;
|
||||
|
@ -51,17 +56,18 @@ public class PanelMain : BasePanel
|
|||
private void Awake()
|
||||
{
|
||||
UIUtils.BindBtn(mBtnOpen, OnClickOpen);
|
||||
UIUtils.BindBtn(mBtnLast, OnClickLast);
|
||||
UIUtils.BindBtn(mBtnNext, OnClickNext);
|
||||
UIUtils.BindBtn(mBtnStartSingle, OnClickStartSingle);
|
||||
UIUtils.BindBtn(mBtnStart, OnClickStart);
|
||||
UIUtils.BindBtn(mBtnLevel, OnClickLevel);
|
||||
UIUtils.BindBtn(mBtnLast, OnClickLast, AudioType.Click_Last);
|
||||
UIUtils.BindBtn(mBtnNext, OnClickNext, AudioType.Click_Next);
|
||||
UIUtils.BindBtn(mBtnStartSingle, OnClickStartSingle, AudioType.StartGame);
|
||||
UIUtils.BindBtn(mBtnStart, OnClickStart, AudioType.StartGame);
|
||||
UIUtils.BindBtn(mBtnLevel, OnClickLevel, AudioType.Click_Normal);
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
base.OnOpen();
|
||||
|
||||
mLogoSoundTimer = TimerManager.Instance.CreateTimerUnit();
|
||||
mRollTimer = TimerManager.Instance.CreateTimerUnit();
|
||||
|
||||
if (sFirstIn)
|
||||
|
@ -84,6 +90,12 @@ public class PanelMain : BasePanel
|
|||
{
|
||||
base.OnClose();
|
||||
|
||||
if (mLogoSoundTimer != null)
|
||||
{
|
||||
mLogoSoundTimer.Destroy();
|
||||
mLogoSoundTimer = null;
|
||||
}
|
||||
|
||||
if (mRollTimer != null)
|
||||
{
|
||||
mRollTimer.Destroy();
|
||||
|
@ -93,6 +105,12 @@ public class PanelMain : BasePanel
|
|||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (mLogoSoundTimer != null)
|
||||
{
|
||||
mLogoSoundTimer.Destroy();
|
||||
mLogoSoundTimer = null;
|
||||
}
|
||||
|
||||
if (mRollTimer != null)
|
||||
{
|
||||
mRollTimer.Destroy();
|
||||
|
@ -106,11 +124,30 @@ public class PanelMain : BasePanel
|
|||
mCvsOpenPart.DOFade(0, 0.5f).SetEase(Ease.Linear).onComplete = ShowMainPart;
|
||||
}
|
||||
|
||||
private void PlayLogoSound()
|
||||
{
|
||||
mSoundIndex++;
|
||||
|
||||
if (mSoundIndex < mLogoSounds.Length)
|
||||
{
|
||||
AudioManager.Instance.PlaySound(mLogoSounds[mSoundIndex]);
|
||||
mLogoSoundTimer.StartTimer(PlayLogoSound, 0.8f);
|
||||
}
|
||||
else
|
||||
{
|
||||
mLogoSoundTimer.CancelTimer();
|
||||
mLogoSoundTimer.Destroy();
|
||||
mLogoSoundTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowMainPart()
|
||||
{
|
||||
mCvsOpenPart.gameObject.SetActive(false);
|
||||
|
||||
mGobLogo.SetActive(true);
|
||||
mSoundIndex = -1;
|
||||
mLogoSoundTimer.StartTimer(PlayLogoSound, 0.5f);
|
||||
|
||||
mBtnStartSingle.gameObject.SetActive(false);
|
||||
mRctBottom.anchoredPosition = Vector2.zero;
|
||||
|
@ -129,6 +166,8 @@ public class PanelMain : BasePanel
|
|||
private void ShowStartSingle()
|
||||
{
|
||||
mBtnStartSingle.gameObject.SetActive(true);
|
||||
|
||||
AudioManager.Instance.PlayBGMusic(AudioType.BGM, 0.8f);
|
||||
}
|
||||
|
||||
private void ShowFilm()
|
||||
|
@ -141,6 +180,8 @@ public class PanelMain : BasePanel
|
|||
Waft();
|
||||
ShowBubble();
|
||||
};
|
||||
|
||||
AudioManager.Instance.PlayBGMusic(AudioType.BGM, 0.8f);
|
||||
}
|
||||
|
||||
private void InitLevelIcons()
|
||||
|
|
|
@ -30,10 +30,10 @@ public class PanelResult : BasePanel
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
UIUtils.BindBtn(mBtnAgain1, OnClickAgain);
|
||||
UIUtils.BindBtn(mBtnAgain2, OnClickAgain);
|
||||
UIUtils.BindBtn(mBtnNext, OnClickNext);
|
||||
UIUtils.BindBtn(mBtnChoose, OnClickChoose);
|
||||
UIUtils.BindBtn(mBtnAgain1, OnClickAgain, AudioType.Click_Normal);
|
||||
UIUtils.BindBtn(mBtnAgain2, OnClickAgain, AudioType.Click_Normal);
|
||||
UIUtils.BindBtn(mBtnNext, OnClickNext, AudioType.Click_Normal);
|
||||
UIUtils.BindBtn(mBtnChoose, OnClickChoose, AudioType.Click_Normal);
|
||||
|
||||
mBtnEndings.DelClick = OnClickEndings;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ public class PanelSettings : BasePanel
|
|||
{
|
||||
base.OnClose();
|
||||
|
||||
AudioManager.Instance.PlaySound(AudioType.UIClose);
|
||||
|
||||
mTglBGM.OnSwitch -= SwitchBGM;
|
||||
mTglSound.OnSwitch -= SwitchSound;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public class UIToggleSwap : MonoBehaviour
|
|||
|
||||
[SerializeField] GameObject mSignOn;
|
||||
[SerializeField] GameObject mSignOff;
|
||||
[SerializeField] AudioType mClickSound = AudioType.None;
|
||||
|
||||
private Button mBtnClick;
|
||||
private bool mIsOn;
|
||||
|
@ -39,5 +40,7 @@ public class UIToggleSwap : MonoBehaviour
|
|||
private void OnClick()
|
||||
{
|
||||
IsOn = !IsOn;
|
||||
|
||||
AudioManager.Instance.PlaySound(mClickSound);
|
||||
}
|
||||
}
|
|
@ -9,5 +9,7 @@ public static class UIUtils
|
|||
public static void BindBtn(Button pBtn, UnityAction pDel, AudioType pSound = AudioType.None)
|
||||
{
|
||||
pBtn.onClick.AddListener(pDel);
|
||||
|
||||
pBtn.onClick.AddListener(() => { AudioManager.Instance.PlaySound(pSound); });
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue