From 2a8c5b90dd5b5533ecf1fd80d59a93dc8a521419 Mon Sep 17 00:00:00 2001 From: GL <2365963573@qq.com> Date: Mon, 9 Dec 2024 16:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=9C=97=E7=89=9B=E9=9F=B3=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Scenes/Scene_main.unity | 13 ++ TheStrongestSnail/Assets/Scenes/logo.unity | 152 +++++++++++++++++- .../Scripts/Battle_Royale/AllHouseContro.cs | 31 +++- .../Scripts/Battle_Royale/PlayerMove.cs | 10 +- .../Assets/Scripts/Login/UI/logoPanel.cs | 2 +- .../Assets/Scripts/Scene_main/main_BGM.cs | 22 +++ .../Scripts/Scene_main/main_BGM.cs.meta | 11 ++ .../Assets/Scripts/UIBtnMusic.cs | 70 ++++++++ .../Assets/Scripts/UIBtnMusic.cs.meta | 11 ++ 9 files changed, 313 insertions(+), 9 deletions(-) create mode 100644 TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs create mode 100644 TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs.meta create mode 100644 TheStrongestSnail/Assets/Scripts/UIBtnMusic.cs create mode 100644 TheStrongestSnail/Assets/Scripts/UIBtnMusic.cs.meta diff --git a/TheStrongestSnail/Assets/Scenes/Scene_main.unity b/TheStrongestSnail/Assets/Scenes/Scene_main.unity index d9d928b..9f8cf36 100644 --- a/TheStrongestSnail/Assets/Scenes/Scene_main.unity +++ b/TheStrongestSnail/Assets/Scenes/Scene_main.unity @@ -1974,6 +1974,7 @@ GameObject: - component: {fileID: 278122027} - component: {fileID: 278122026} - component: {fileID: 278122030} + - component: {fileID: 278122031} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -2093,6 +2094,18 @@ MonoBehaviour: SellOpen: 0 CreateTime: IsBuyGet: 0 +--- !u!114 &278122031 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 278122025} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c0828db7d2698a4793160e6324c81a9, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &278944241 GameObject: m_ObjectHideFlags: 0 diff --git a/TheStrongestSnail/Assets/Scenes/logo.unity b/TheStrongestSnail/Assets/Scenes/logo.unity index dc71f8c..803e620 100644 --- a/TheStrongestSnail/Assets/Scenes/logo.unity +++ b/TheStrongestSnail/Assets/Scenes/logo.unity @@ -3616,7 +3616,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 686, y: -1387.5} + m_AnchoredPosition: {x: 548.1, y: -1387.5} m_SizeDelta: {x: 1018, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1071890038 @@ -3780,6 +3780,156 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &1102437595 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1102437598} + - component: {fileID: 1102437597} + - component: {fileID: 1102437596} + m_Layer: 0 + m_Name: MusicManeger + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!82 &1102437596 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1102437595} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 +--- !u!114 &1102437597 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1102437595} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7ca9a1b6cc8a74c4a8f1cf7738bcda5c, type: 3} + m_Name: + m_EditorClassIdentifier: + audioSource: {fileID: 1102437596} + BGMaudioSource: {fileID: 0} + buttonClickClip: {fileID: 8300000, guid: b9a93b2211568a64d8a3484b0a15bb7a, type: 3} + BGMClickClip_main: {fileID: 8300000, guid: ae52ddaa7f7d2d347957dd569a285bb5, type: 3} + BGMClickClip_Time: {fileID: 8300000, guid: 7b710e9df51388b478209c3e8dffa8c3, type: 3} + ClickClip_fight: {fileID: 8300000, guid: c27de3f87311955479c8fbeefbe455ec, type: 3} + ClickClip_doorOpen: {fileID: 8300000, guid: 1acc9485c110cbb47bd93570e1109b98, type: 3} + ClickClip_attack: {fileID: 8300000, guid: bb82cb1edbf45b344bc556479bf0535f, type: 3} + ClickClip_Paoxiao: {fileID: 8300000, guid: cd23215095141fd4886ef4130a6344e3, type: 3} +--- !u!4 &1102437598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1102437595} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1166404693 GameObject: m_ObjectHideFlags: 0 diff --git a/TheStrongestSnail/Assets/Scripts/Battle_Royale/AllHouseContro.cs b/TheStrongestSnail/Assets/Scripts/Battle_Royale/AllHouseContro.cs index a214919..5ac4d2a 100644 --- a/TheStrongestSnail/Assets/Scripts/Battle_Royale/AllHouseContro.cs +++ b/TheStrongestSnail/Assets/Scripts/Battle_Royale/AllHouseContro.cs @@ -37,6 +37,7 @@ public class AllHouseContro : MonoBehaviour public bool IsLoadIn;//是否已经进入游戏 public bool IsHideLoadPanel;//是否关闭加载页面 + public bool IsPlayTimeMusic;//是否播放倒计时击杀3-2-1 public List KillNos;//击杀房间列表 @@ -44,6 +45,7 @@ public class AllHouseContro : MonoBehaviour // Start is called before the first frame update async void Start() { + UIBtnMusic.instance.PlayBGMClickSound(UIBtnMusic.instance.BGMClickClip_Time); battleRoyaleGameDetails(); GetInfo516(); GetInfo517(); @@ -267,6 +269,7 @@ public class AllHouseContro : MonoBehaviour ListPanel.instance.UpdatePanels(); PlayerInfo.instance.AllBetCoins = 0;//投注归0 + IsPlayTimeMusic = false; } else if (serverResponse.data.carrySeconds < 45){ @@ -279,16 +282,24 @@ public class AllHouseContro : MonoBehaviour //ClearBoosHouseId();//清空boos房间号 ControAllDoorOpen(); + if (serverResponse.data.carrySeconds >= 42) + { + if (!IsPlayTimeMusic && IsHideLoadPanel)//判断是否已经播放倒计时音乐,并且加载界面已经关闭 + { + UIBtnMusic.instance.PlayClickSound(UIBtnMusic.instance.ClickClip_fight); + IsPlayTimeMusic = true; + } + } text.GetComponentInChildren().text = (45 - serverResponse.data.carrySeconds).ToString(); detailsText.GetComponentInChildren().text = "秒后霸主出现"; await Task.Delay(1000); text.GetComponentInChildren().text = (45 - serverResponse.data.carrySeconds - 1).ToString(); - + allother.startIEmove();//生成其他蜗牛 //if (!HaveallotherMove) //{ - // //StartCoroutine(allother.IECreateWoniu()); + //StartCoroutine(allother.IECreateWoniu()); // HaveallotherMove = true; @@ -305,9 +316,13 @@ public class AllHouseContro : MonoBehaviour detailsText.GetComponentInChildren().text = "";//霸主出现 if (!is_jisha){ is_jisha = true; + if (IsHideLoadPanel) + { + UIBtnMusic.instance.PlayClickSound(UIBtnMusic.instance.ClickClip_Paoxiao); + } warnPanel.ShowPanel(); - await Task.Delay(3000); + await Task.Delay(2000); warnPanel.HidePanel(); response = await web.SendRequest(web.URL + "/snail/gameEscape/queryKill", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders()); @@ -361,7 +376,7 @@ public class AllHouseContro : MonoBehaviour else if (serverResponse.data.carrySeconds > 56) { - ClearBoosHouseId();//// + ClearBoosHouseId(); text.GetComponentInChildren().text = ""; detailsText.GetComponentInChildren().text = "";//结算 @@ -549,6 +564,11 @@ public class AllHouseContro : MonoBehaviour } public void ControOneDoorOpen(int id,System.Action onComplete = null) { + if (IsHideLoadPanel) + { + UIBtnMusic.instance.PlayClickSound(UIBtnMusic.instance.ClickClip_doorOpen); + } + Tools.MoveUpOrDwon(HouseBtnList[id-1].door, 270,onComplete); HouseBtnList[id-1].DoorIsOpen = true; } @@ -561,8 +581,9 @@ public class AllHouseContro : MonoBehaviour public void OpenBoosDoor(HouseBtn boosHouse) { - if (!boosHouse.DoorIsOpen) + if (!boosHouse.DoorIsOpen&&IsHideLoadPanel) { + UIBtnMusic.instance.PlayClickSound(UIBtnMusic.instance.ClickClip_doorOpen); Tools.MoveUpOrDwon(boosHouse.door, 270); boosHouse.DoorIsOpen = true; } diff --git a/TheStrongestSnail/Assets/Scripts/Battle_Royale/PlayerMove.cs b/TheStrongestSnail/Assets/Scripts/Battle_Royale/PlayerMove.cs index 2de27cf..d9fe1ff 100644 --- a/TheStrongestSnail/Assets/Scripts/Battle_Royale/PlayerMove.cs +++ b/TheStrongestSnail/Assets/Scripts/Battle_Royale/PlayerMove.cs @@ -238,7 +238,7 @@ public class PlayerMove : MonoBehaviour { if (IsBoos) { - duration = 2f; + duration = 3f; } else { @@ -370,7 +370,13 @@ public class PlayerMove : MonoBehaviour IEnumerator BoosAttack() { GetComponent().BossAni.SetInteger("State", 2); - yield return new WaitForSeconds(2.1f); + yield return new WaitForSeconds(1f); + if (allHouseContro.IsHideLoadPanel) + { + UIBtnMusic.instance.PlayClickSound(UIBtnMusic.instance.ClickClip_attack); + } + + yield return new WaitForSeconds(1.1f); GetComponent().BossAni.SetInteger("State", 0); if (allHouseContro.KillNos.Count>0) { diff --git a/TheStrongestSnail/Assets/Scripts/Login/UI/logoPanel.cs b/TheStrongestSnail/Assets/Scripts/Login/UI/logoPanel.cs index b20ed07..20963f5 100644 --- a/TheStrongestSnail/Assets/Scripts/Login/UI/logoPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/Login/UI/logoPanel.cs @@ -95,7 +95,7 @@ public class logoPanel : Base //} loginbody body = new loginbody { - userName = "541236987", + userName = "15151658596", //password = "123456", verifyCode = 111111 }; diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs new file mode 100644 index 0000000..6fa1e5c --- /dev/null +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class main_BGM : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + if (UIBtnMusic.instance.audioSource.clip!= UIBtnMusic.instance.BGMClickClip_main)//如果不是主界面音乐则改为主界面音乐 + { + UIBtnMusic.instance.PlayBGMClickSound(UIBtnMusic.instance.BGMClickClip_main); + } + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs.meta b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs.meta new file mode 100644 index 0000000..b10142c --- /dev/null +++ b/TheStrongestSnail/Assets/Scripts/Scene_main/main_BGM.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c0828db7d2698a4793160e6324c81a9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TheStrongestSnail/Assets/Scripts/UIBtnMusic.cs b/TheStrongestSnail/Assets/Scripts/UIBtnMusic.cs new file mode 100644 index 0000000..720b9f6 --- /dev/null +++ b/TheStrongestSnail/Assets/Scripts/UIBtnMusic.cs @@ -0,0 +1,70 @@ +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.SceneManagement; + +public class UIBtnMusic : MonoBehaviour +{ + public static UIBtnMusic instance; + public AudioSource audioSource; // 音效播放器 + public AudioSource BGMaudioSource;//背景音效 + public AudioClip buttonClickClip; // 按钮点击音效 + public AudioClip BGMClickClip_main;//主场景 + public AudioClip BGMClickClip_Time;//大逃杀倒计时 + public AudioClip ClickClip_fight;//大逃杀击杀倒计时 + public AudioClip ClickClip_doorOpen;//开门 + public AudioClip ClickClip_attack;//攻击 + public AudioClip ClickClip_Paoxiao;//攻击 + private void Start() + { + instance = this; + // 保持音效管理器不被销毁 + DontDestroyOnLoad(gameObject); + + // 给场景中所有按钮添加音效 + AddButtonSoundEffects(); + + // 监听场景加载事件 + SceneManager.sceneLoaded += OnSceneLoaded; + PlayBGMClickSound(BGMClickClip_main);//背景播放 + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + // 每次切换到新场景时,都为所有按钮添加音效 + AddButtonSoundEffects(); + } + + private void AddButtonSoundEffects() + { + Button[] buttons = FindObjectsOfType