diff --git a/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset b/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset deleted file mode 100644 index 873cd174b..000000000 --- a/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset +++ /dev/null @@ -1,21 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d32cf7c32a3ed8347bac48ef5ed56d82, type: 3} - m_Name: FMODStudioCache - m_EditorClassIdentifier: - EditorBanks: [] - EditorEvents: [] - EditorParameters: [] - MasterBanks: [] - StringsBanks: [] - cacheTime: 0 - cacheVersion: 131621 diff --git a/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset.meta b/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset.meta deleted file mode 100644 index 8fb49368d..000000000 --- a/Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dc785d76b756ae54d82be029f021f0e0 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset index 7020a9856..e499990e9 100644 --- a/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset +++ b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset @@ -405,11 +405,7 @@ MonoBehaviour: MasterBanks: - Master Banks: - - Amb - - Amb.assets - - Amb.streams - - Master.assets - - Master.streams + - Interactions BanksToLoad: [] LiveUpdatePort: 9264 EnableMemoryTracking: 0 diff --git a/Assets/Scenes/FmodTest.unity b/Assets/Scenes/FmodTest.unity index 3128aae1c..38e920379 100644 --- a/Assets/Scenes/FmodTest.unity +++ b/Assets/Scenes/FmodTest.unity @@ -266,8 +266,60 @@ MonoBehaviour: m_EditorClassIdentifier: nonRigidbodyVelocity: 0 attenuationObject: {fileID: 0} +--- !u!1 &782394916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 782394918} + - component: {fileID: 782394917} + m_Layer: 0 + m_Name: FMod Manager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &782394917 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782394916} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9003b24afc35da54a98df0001480fcee, type: 3} + m_Name: + m_EditorClassIdentifier: + ambEvent: + Guid: + Data1: -322206580 + Data2: 1135064971 + Data3: 832623510 + Data4: 499556537 + Path: event:/plugin +--- !u!4 &782394918 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782394916} + serializedVersion: 2 + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 450055141} + - {fileID: 782394918} diff --git a/Assets/Scripts/FixSystemNew/FixStateMachine.cs b/Assets/Scripts/FixSystemNew/FixStateMachine.cs index 4c9e83540..af864fcce 100644 --- a/Assets/Scripts/FixSystemNew/FixStateMachine.cs +++ b/Assets/Scripts/FixSystemNew/FixStateMachine.cs @@ -34,16 +34,11 @@ namespace AibisDream.FixSystem _curArgs = args; yield return _curState?.Exit(); - - // 检查当前状态和下一个状态 - // if (_curState.GetState == FixState.Clinic && nextState == FixState.BodyModule) - // { - // // 仅在从 Clinic 到 BodyModule 时执行这两行 - // - // } - + GameLoopManager.Instance?.UpdateFixState(nextState, _curArgs); _curState = CreateState(nextState, _curArgs); + + EnumEventSystem.Global.Send(EventEnum.FixStateSwitch, nextState); yield return _curState.Enter(); } diff --git a/Assets/Scripts/Framework/AudioKit/AudioEnum.cs b/Assets/Scripts/Framework/AudioKit/AudioEnum.cs new file mode 100644 index 000000000..1acf74b46 --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/AudioEnum.cs @@ -0,0 +1,18 @@ +namespace AibisDream.Kit +{ + public enum AmbState + { + Main, + Clinic, + Outside, + Footbridge, + Subway, + Head, + Memory, + Eye, + UF, + Body, + Engine, + GearBox + } +} \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/AudioEnum.cs.meta b/Assets/Scripts/Framework/AudioKit/AudioEnum.cs.meta new file mode 100644 index 000000000..56c4c18ea --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/AudioEnum.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2cec528d61b846fc9d9791fca8d917ed +timeCreated: 1741259362 \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/AudioKit.cs b/Assets/Scripts/Framework/AudioKit/AudioKit.cs deleted file mode 100644 index 10906e26e..000000000 --- a/Assets/Scripts/Framework/AudioKit/AudioKit.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace AibisDream.Kit -{ - public class AudioKit : Singleton - { - public AudioPlayer MusicPlayer { get; private set; } - public AudioPlayer VoicePlayer { get; private set; } - - public override void OnSingletonInit() - { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/AudioKit.cs.meta b/Assets/Scripts/Framework/AudioKit/AudioKit.cs.meta deleted file mode 100644 index 16935de4f..000000000 --- a/Assets/Scripts/Framework/AudioKit/AudioKit.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ff78cd5fd6a74902945f20346bc2036d -timeCreated: 1726662840 \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/AudioManager.cs b/Assets/Scripts/Framework/AudioKit/AudioManager.cs index 2624309c2..a3c339c95 100644 --- a/Assets/Scripts/Framework/AudioKit/AudioManager.cs +++ b/Assets/Scripts/Framework/AudioKit/AudioManager.cs @@ -90,17 +90,6 @@ namespace AibisDream #endregion - #region 播放唱歌 - - public void PlayVoice(string actorName, string voiceName) - { - AudioClip clip = RandomLoadAudioClip(3, $"Audio/{actorName}"); - _voiceSource.clip = clip; - _voiceSource.Play(); - } - - #endregion - #region 循环播放 [YarnCommand("play_loop_audio")] diff --git a/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs b/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs deleted file mode 100644 index 40448a1a6..000000000 --- a/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace AibisDream.Kit -{ - public class AudioPlayer : IPoolable, IPoolType - { - #region 对象池功能 - - public void OnRecycled() - { - throw new System.NotImplementedException(); - } - - public bool IsRecycled { get; set; } - - public void Recycle2Cache() - { - throw new System.NotImplementedException(); - } - - #endregion - } -} - diff --git a/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs.meta b/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs.meta deleted file mode 100644 index 10b0f5b21..000000000 --- a/Assets/Scripts/Framework/AudioKit/AudioPlayer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5c877314dfb3460d91eef3edfe2786c6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs b/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs new file mode 100644 index 000000000..829cb86fa --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs @@ -0,0 +1,74 @@ +using System; +using FMOD.Studio; +using Yarn.Unity; + +namespace AibisDream.Kit +{ + public static class AudioYarnCommand + { + private static IAudioManager AudioManager => FmodManager.Instance; + + [YarnCommand("play_music")] + public static void PlayMusic(string eventName) + { + AudioManager.PlayMusic(eventName); + } + + [YarnCommand("stop_music")] + public static void StopMusic(string eventName, string type = null) + { + // 处理停止类型 + var mode = type switch + { + "fade" => STOP_MODE.ALLOWFADEOUT, + _ => STOP_MODE.IMMEDIATE + }; + + AudioManager.StopMusic(eventName, mode); + } + + [YarnCommand("set_music_param")] + public static void SetMusicParam(string eventName, string paramName, float paramValue) + { + AudioManager.SetMusicParam(eventName, paramName, paramValue); + } + + [YarnCommand("play_sfx")] + public static void PlaySfx(string eventName) + { + AudioManager.PlaySfx(eventName); + } + + [YarnCommand("stop_sfx")] + public static void StopSfx(string eventName, string type = null) + { + // 处理停止类型 + var mode = type switch + { + "fade" => STOP_MODE.ALLOWFADEOUT, + _ => STOP_MODE.IMMEDIATE + }; + + AudioManager.StopSfx(eventName, mode); + } + + [YarnCommand("set_sfx_param")] + public static void SetSfxParam(string eventName, string paramName, float paramValue) + { + AudioManager.SetSfxParam(eventName, paramName, paramValue); + } + + [YarnCommand("change_amb")] + public static void ChangeAmb(string ambState) + { + var realState = Enum.Parse(ambState); + AudioManager.ChangeAmb(realState); + } + + [YarnCommand("set_amb_param")] + public static void SetAmbParam(string paramName, float value) + { + AudioManager.SetAmbParam(paramName, value); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs.meta b/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs.meta new file mode 100644 index 000000000..3658e9258 --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/AudioYarnCommand.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0c2c66883a8f4acda0263f7453bd4cd2 +timeCreated: 1741257321 \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/FModEx.cs b/Assets/Scripts/Framework/AudioKit/FModEx.cs new file mode 100644 index 000000000..464d87773 --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/FModEx.cs @@ -0,0 +1,35 @@ +using FMOD.Studio; +using FMODUnity; + +namespace AibisDream.Kit +{ + public static class FModEx + { + public static bool IsPlaying(this EventInstance instance) + { + if (!instance.isValid()) return false; + + instance.getPlaybackState(out var playbackState); + return playbackState == PLAYBACK_STATE.PLAYING; + } + + public static PLAYBACK_STATE GetPlayBackState(this EventInstance instance) + { + instance.getPlaybackState(out var playbackState); + return playbackState; + } + + public static EventDescription GetDescription(this EventInstance instance) + { + instance.getDescription(out var description); + return description; + } + + public static bool IsEventExist(string eventPath) + { + var result = RuntimeManager.StudioSystem.getEvent(eventPath, out _); + + return result == FMOD.RESULT.OK; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/FModEx.cs.meta b/Assets/Scripts/Framework/AudioKit/FModEx.cs.meta new file mode 100644 index 000000000..38a5fbd7a --- /dev/null +++ b/Assets/Scripts/Framework/AudioKit/FModEx.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cf7b32b854524cf9bb65c552e7050830 +timeCreated: 1741319049 \ No newline at end of file diff --git a/Assets/Scripts/Framework/AudioKit/FmodManager.cs b/Assets/Scripts/Framework/AudioKit/FmodManager.cs index d1569d15e..88488f5d2 100644 --- a/Assets/Scripts/Framework/AudioKit/FmodManager.cs +++ b/Assets/Scripts/Framework/AudioKit/FmodManager.cs @@ -1,13 +1,267 @@ -using System.Collections; using System.Collections.Generic; +using AibisDream.FixSystem; +using AibisDream.Framework; +using FMOD; +using FMOD.Studio; using FMODUnity; -using UnityEngine; +using STOP_MODE = FMOD.Studio.STOP_MODE; namespace AibisDream.Kit { - public class FmodManager : Singleton + public class FmodManager : Singleton, IAudioManager { - public EventReference sound; + private const string AmbStateName = "scene"; + + public string ambPath; + + #region Event实例 + + private EventInstance _ambInstance; + private EventInstance _voiceInstance; + private readonly Dictionary _musicDict = new(); + private readonly Dictionary _sfxDict = new(); + + #endregion + + #region 事件索引 + + private List _removeTrigger; + + #endregion + + private void Start() + { + // 注册事件 + RegisterEvent(); + // 启动AMB + InitAmb(); + } + + private void RegisterEvent() + { + // 语音相关 + EnumEventSystem.Global.Register(DialogEventEnum.LineStart, OnLineStart); + EnumEventSystem.Global.Register(DialogEventEnum.LineShown, OnLineShown); + // 场景切换相关 + EnumEventSystem.Global.Register(EventEnum.SceneLoad, OnSceneLoad); + EnumEventSystem.Global.Register(EventEnum.FixStateSwitch, OnFixStateChange); + EnumEventSystem.Global.Register(EventEnum.SceneUnload, OnSceneUnload); + } + + #region AMB相关 + + private void InitAmb() + { + _ambInstance = RuntimeManager.CreateInstance(FormatEventPath(ambPath)); + _ambInstance.start(); + } + + public void ChangeAmb(AmbState state) + { + _ambInstance.setParameterByName(AmbStateName, (float)state); + } + + public void SetAmbParam(string paramName, float value) + { + _ambInstance.setParameterByName(paramName, value); + } + + private void OnSceneLoad(string loadingScene) + { + // 场景加载时切换AMB + var state = MatchAmbState(loadingScene); + ChangeAmb(state); + } + + private void OnSceneUnload() + { + ChangeAmb(AmbState.Main); + } + + private void OnFixStateChange(FixState nextState) + { + // 状态切换时加载 + var state = MatchAmbState(nextState); + ChangeAmb(state); + } + + #endregion + + #region 音乐相关 + + public void PlayMusic(string eventName) + { + var eventPath = FormatEventPath(eventName); + if (_musicDict.TryGetValue(eventPath, out var oldMusic)) + { + oldMusic.start(); + } + else + { + var newMusic = RuntimeManager.CreateInstance(eventPath); + _musicDict[eventPath] = newMusic; + newMusic.start(); + } + } + + public void StopMusic(string eventName, STOP_MODE stopMode) + { + var eventPath = FormatEventPath(eventName); + if (_musicDict.TryGetValue(eventPath, out var oldMusic)) + { + oldMusic.stop(stopMode); + oldMusic.release(); + _musicDict.Remove(eventPath); + } + } + + public void SetMusicParam(string eventName, string param, float paramValue) + { + var eventPath = FormatEventPath(eventName); + if (_musicDict.TryGetValue(eventPath, out var music)) + { + music.setParameterByName(param, paramValue); + } + } + + #endregion + + public void OnLineStart(DialogText dialogText) + { + if (_voiceInstance.IsPlaying()) + { + _voiceInstance.stop(STOP_MODE.IMMEDIATE); + _voiceInstance.release(); + } + + if (string.IsNullOrEmpty(dialogText.actor.voicePath) || FModEx.IsEventExist(dialogText.actor.VoicePath)) + { + return; + } + + _voiceInstance = RuntimeManager.CreateInstance(dialogText.actor.VoicePath); + _voiceInstance.start(); + } + + public void OnLineShown() + { + if (_voiceInstance.isValid()) + { + _voiceInstance.stop(STOP_MODE.IMMEDIATE); + _voiceInstance.release(); + } + } + + public void PlaySfx(string eventName) + { + var eventPath = FormatEventPath(eventName); + if (_sfxDict.TryGetValue(eventPath, out var oldSfx)) + { + oldSfx.start(); + } + else + { + var newSfx = RuntimeManager.CreateInstance(eventPath); + if (newSfx.GetDescription().isOneshot(out var isOneshot) != RESULT.OK || !isOneshot) + { + _sfxDict[eventPath] = newSfx; + } + + newSfx.start(); + } + } + + public void StopSfx(string eventName, STOP_MODE stopMode) + { + var eventPath = FormatEventPath(eventName); + if (_sfxDict.TryGetValue(eventPath, out var oldSfx)) + { + oldSfx.stop(stopMode); + oldSfx.release(); + _musicDict.Remove(eventPath); + } + } + + public void SetSfxParam(string eventName, string paramName, float paramValue) + { + var eventPath = FormatEventPath(eventName); + if (_sfxDict.TryGetValue(eventPath, out var sfx)) + { + sfx.setParameterByName(paramName, paramValue); + } + } + + #region 一些静态方法 + + private static string FormatEventPath(string eventName) + { + return $"event:/{eventName}"; + } + + private static AmbState MatchAmbState(string key) + { + return key switch + { + "ExpressFixScene" => AmbState.Clinic, + "ShitouHeadiFixScene" => AmbState.Clinic, + "PeipeiFixScene" => AmbState.Clinic, + "Bridge" => AmbState.Footbridge, + "SkyBridge" => AmbState.Footbridge, + "SubWay" => AmbState.Subway, + "ClinicOut" => AmbState.Outside, + _ => AmbState.Main + }; + } + + private static AmbState MatchAmbState(FixState fixState) + { + return fixState switch + { + FixState.Clinic => AmbState.Clinic, + FixState.Engine => AmbState.Engine, + FixState.BodyModule => AmbState.Body, + FixState.Gear => AmbState.GearBox, + FixState.UF => AmbState.UF, + FixState.Eye => AmbState.Eye, + FixState.Memory => AmbState.Memory, + _ => AmbState.Main + }; + } + + #endregion + } + + public interface IAudioManager + { + // Yarn音频接口 + public void PlayMusic(string eventName); + public void StopMusic(string eventName, STOP_MODE stopMode); + public void SetMusicParam(string eventName, string paramName, float paramValue); + + // AMB参数变化 + public void ChangeAmb(AmbState state); + public void SetAmbParam(string paramName, float value); + + // 语音相关 + public void OnLineStart(DialogText dialogText); + public void OnLineShown(); + + // 交互相关 + public void PlaySfx(string eventName); + public void StopSfx(string eventName, STOP_MODE stopMode); + public void SetSfxParam(string eventName, string paramName, float paramValue); + } + + public class AudioData : IData + { + public string ambState; + public List sfxNames = new(); + public List musicNames = new(); + + public void Load() + { + throw new System.NotImplementedException(); + } } } diff --git a/Assets/Scripts/Framework/Config/Character.cs b/Assets/Scripts/Framework/Config/Character.cs index ff24c0224..afe9b9cb5 100644 --- a/Assets/Scripts/Framework/Config/Character.cs +++ b/Assets/Scripts/Framework/Config/Character.cs @@ -46,6 +46,19 @@ namespace AibisDream.Kit { return string.IsNullOrEmpty(nameColor) ? cn : $"{cn}"; } + + public string VoicePath + { + get + { + if (!voicePath.StartsWith("event:/")) + { + return "event:/" + voicePath; + } + + return voicePath; + } + } } public enum ActorRole diff --git a/Assets/Scripts/Game Loop/EventEnums.cs b/Assets/Scripts/Game Loop/EventEnums.cs index 400c77b55..29adc34c3 100644 --- a/Assets/Scripts/Game Loop/EventEnums.cs +++ b/Assets/Scripts/Game Loop/EventEnums.cs @@ -11,13 +11,16 @@ namespace AibisDream PlugOut, OpenScreen, CloseScreen, + SceneLoad, + SceneUnload, + FixStateSwitch, Menu } public enum DialogEventEnum { LineStart, - LineShowed, + LineShown, LineEnd, OptionShow, OptionSelected diff --git a/Assets/Scripts/Game Loop/SceneLoader.cs b/Assets/Scripts/Game Loop/SceneLoader.cs index 2807705fb..16f63c4ef 100644 --- a/Assets/Scripts/Game Loop/SceneLoader.cs +++ b/Assets/Scripts/Game Loop/SceneLoader.cs @@ -66,6 +66,7 @@ namespace AibisDream _loadHandle = Addressables.LoadSceneAsync(_sceneToLoad, LoadSceneMode.Additive); yield return _loadHandle; + EnumEventSystem.Global.Send(EventEnum.SceneLoad, _sceneToLoad); _currentScene.Value = _sceneToLoad; _isLoading = false; } diff --git a/Assets/Scripts/MiniGame/Peipei/CutLine/LineInteraction.cs b/Assets/Scripts/MiniGame/Peipei/CutLine/LineInteraction.cs index 54905965d..4b65af320 100644 --- a/Assets/Scripts/MiniGame/Peipei/CutLine/LineInteraction.cs +++ b/Assets/Scripts/MiniGame/Peipei/CutLine/LineInteraction.cs @@ -26,7 +26,8 @@ public class LineInteraction : MonoBehaviour { // 初始状态不激活 actorGroup.SetActive(false); - scissorSpriteRenderer.transform.localPosition = new Vector3(12f, openYMin - 3, scissorSpriteRenderer.transform.position.z); + scissorSpriteRenderer.transform.localPosition = + new Vector3(12f, openYMin - 3, scissorSpriteRenderer.transform.position.z); cutLineSpriteRenderer.enabled = false; } @@ -36,10 +37,12 @@ public class LineInteraction : MonoBehaviour if (!isActive) return; // 获取鼠标在世界坐标中的位置 - Vector3 mousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane)); + Vector3 mousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, + Camera.main.nearClipPlane)); // 更新剪刀的Y轴位置以跟随鼠标 - scissorSpriteRenderer.transform.localPosition = new Vector3(scissorSpriteRenderer.transform.localPosition.x, mousePosition.y, scissorSpriteRenderer.transform.localPosition.z); + scissorSpriteRenderer.transform.localPosition = new Vector3(scissorSpriteRenderer.transform.localPosition.x, + mousePosition.y, scissorSpriteRenderer.transform.localPosition.z); // 检查Y轴位置并更换Sprite if (mousePosition.y >= openYMin && mousePosition.y <= openYMax) @@ -76,12 +79,13 @@ public class LineInteraction : MonoBehaviour // 淡出剪刀和切割线 scissorSpriteRenderer.DOFade(0f, fadeDuration); cutLineSpriteRenderer.DOFade(0f, fadeDuration); - yield return new WaitForSeconds(fadeDuration*4); - foreach (SpriteRenderer child in actorGroup.GetComponentsInChildren()) + yield return new WaitForSeconds(fadeDuration * 4); + foreach (SpriteRenderer child in actorGroup.GetComponentsInChildren()) { - child.DOFade(0f, fadeDuration*2); + child.DOFade(0f, fadeDuration * 2); } - yield return new WaitForSeconds(fadeDuration*2); + + yield return new WaitForSeconds(fadeDuration * 2); // 销毁GameObject Destroy(gameObject); @@ -111,7 +115,7 @@ public class LineInteraction : MonoBehaviour void ContinueTimeline() { - AudioManager.RandomPlayInteraction("wire_cut"); - timelineDirector.Play(); + AudioManager.RandomPlayInteraction("wire_cut"); + timelineDirector.Play(); } -} +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Cursor/CursorManager.cs b/Assets/Scripts/UI/Cursor/CursorManager.cs index 6205d7c09..5d7b91f08 100644 --- a/Assets/Scripts/UI/Cursor/CursorManager.cs +++ b/Assets/Scripts/UI/Cursor/CursorManager.cs @@ -74,7 +74,7 @@ namespace AibisDream // 对话相关 _unRegisters.Add(EnumEventSystem.Global.Register(DialogEventEnum.LineStart, OnLineStart)); - _unRegisters.Add(EnumEventSystem.Global.Register(DialogEventEnum.LineShowed, () => SwitchCursor(nextTalk))); + _unRegisters.Add(EnumEventSystem.Global.Register(DialogEventEnum.LineShown, () => SwitchCursor(nextTalk))); _unRegisters.Add(EnumEventSystem.Global.Register(DialogEventEnum.LineEnd, OnLineEnd)); _unRegisters.Add(EnumEventSystem.Global.Register(DialogEventEnum.OptionShow, OnOptionShow)); _unRegisters.Add( diff --git a/Assets/Scripts/UI/DialogUI/CenterText.cs b/Assets/Scripts/UI/DialogUI/CenterText.cs index d28418c20..2a4eb18c6 100644 --- a/Assets/Scripts/UI/DialogUI/CenterText.cs +++ b/Assets/Scripts/UI/DialogUI/CenterText.cs @@ -57,7 +57,7 @@ namespace AibisDream // 自动跳过的回调很难独立Remove,只能全部清空再注册,下策 _dialogText.onTextShowed.RemoveAllListeners(); _dialogText.onTextShowed.AddListener(() => onTextShowed?.Invoke()); - _dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShowed)); + _dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShown)); _nextStep = nextStep; diff --git a/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs b/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs index b0e657b93..270e0b169 100644 --- a/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs +++ b/Assets/Scripts/UI/DialogUI/DialogBoxBase.cs @@ -105,7 +105,7 @@ namespace AibisDream _dialogText.onTextShowed.RemoveAllListeners(); _dialogText.onTextShowed.AddListener(() => _nextArray.gameObject.SetActive(true)); _dialogText.onTextShowed.AddListener(() => onTextShowed?.Invoke()); - _dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShowed)); + _dialogText.onTextShowed.AddListener(() => EnumEventSystem.Global.Send(DialogEventEnum.LineShown)); _nextStep = nextStep; diff --git a/Assets/Scripts/UI/DialogUI/TextBubbleGroup.cs b/Assets/Scripts/UI/DialogUI/TextBubbleGroup.cs index 567ec98ea..e43416c44 100644 --- a/Assets/Scripts/UI/DialogUI/TextBubbleGroup.cs +++ b/Assets/Scripts/UI/DialogUI/TextBubbleGroup.cs @@ -130,7 +130,7 @@ namespace AibisDream private void OnTextShowed() { // 触发事件 - EnumEventSystem.Global.Send(DialogEventEnum.LineShowed); + EnumEventSystem.Global.Send(DialogEventEnum.LineShown); // 停止语音 _onTextShowed?.Invoke(); diff --git a/fmod_editor.log b/fmod_editor.log deleted file mode 100644 index 118559400..000000000 --- a/fmod_editor.log +++ /dev/null @@ -1,76 +0,0 @@ -[LOG] System::create : Header version = 2.02.25. Current version = 2.02.25. -[LOG] Manager::init : maxchannels = 256 studioflags = 00000006 flags 00000000 extradriverdata 0000000000000000. -[LOG] SystemI::init : Initialize version=20225 (147536), maxchannels=256, flags=0x00020000 -[LOG] SystemI::setOutputInternal : Setting output to 'FMOD WASAPI Output' -[LOG] OutputWASAPI::init : Mix Format (WAVEFORMATEX): wFormatTag=0xFFFE, nChannels=2, nSamplesPerSec=44100, nAvgBytesPerSec=352800, nBlockAlign=8, wBitsPerSample=32, cbSize=22. -[LOG] OutputWASAPI::init : Mix Format (WAVEFORMATEXTENSIBLE): wValidBitsPerSample=32, dwChannelMask=0x00000003, SubFormat=00000003-0000-0010-8000-00AA00389B71. -[LOG] OutputWASAPI::init : Output buffer size: 3760 samples, latency: 0.00ms, period: 10.00ms, DSP buffer: 1024 * 4 -[LOG] SystemI::init : Output requires a sample rate of 44100Hz, resampling will occur. -[LOG] Thread::initThread : Init FMOD stream thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes. -[LOG] Thread::initThread : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: No, Sleep Time: 0, Looping: Yes. -[LOG] AsyncManager::init : manager 00000247F69E89A8 isAsync 0 updatePeriod 0.02 -[LOG] AsyncManager::init : done -[LOG] PlaybackSystem::init : -[LOG] Thread::initThread : Init FMOD Studio sample load thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFD, Stack Size: 98304, Semaphore: No, Sleep Time: 1, Looping: No. -[LOG] PlaybackSystem::init : done -[LOG] Thread::initThread : Init FMOD Studio bank load thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFD, Stack Size: 98304, Semaphore: No, Sleep Time: 1, Looping: No. -[LOG] Manager::init : done. -[LOG] Manager::readBank : fileversion = 146, compatVersion = 146 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] PlaybackSystem::acquireMasterBus : Setting master channel group format to 6 -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] PlaybackSystem::acquireMasterBus : Setting master channel group format to 6 -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[ERR] RuntimeBankModel::openFile : Failed to open file 'Assets/StreamingAssets/FMOD/Desktop/Amb.streams.bank' -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] PlaybackSystem::acquireMasterBus : Setting master channel group format to 6 -[ERR] RuntimeBankModel::openFile : Failed to open file 'Assets/StreamingAssets/FMOD/Desktop/Master.streams.bank' -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] PlaybackSystem::acquireMasterBus : Setting master channel group format to 6 -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] Manager::readBank : fileversion = 142, compatVersion = 140 (oldest = 44, newest = 142) -[LOG] PlaybackSystem::acquireMasterBus : Setting master channel group format to 6 -[LOG] SystemI::createSound : filename = Assets/StreamingAssets/FMOD/Desktop/Amb.assets.bank : mode 02010082 -[LOG] SystemI::createSound : FMOD_NONBLOCKING specified. Putting into queue to be opened asynchronously! -[LOG] Thread::initThread : Init FMOD nonblocking thread (0). Affinity: 0x4000000000000003, Priority: 0xFFFF7FFC, Stack Size: 114688, Semaphore: Yes, Sleep Time: 0, Looping: Yes. -[LOG] AsyncThread::add : add sound to async queue : soundi = 000002473BF6E918, queue head = 0000024739718348, queue count = 0 -[LOG] AsyncThread::threadFunc : Starting Asynchronous operation on sound 000002473BF6E918 -[LOG] SystemI::createSoundInternal : Create name='Assets/StreamingAssets/FMOD/Desktop/Amb.assets.bank', mode=0x02010082 -[LOG] SystemI::createSoundInternal : exinfo->cbsize = 224 -[LOG] SystemI::createSoundInternal : exinfo->length = 197920 -[LOG] SystemI::createSoundInternal : exinfo->fileoffset = 608 -[LOG] SystemI::createSoundInternal : exinfo->numsubsounds = 1 -[LOG] SystemI::createSoundInternal : exinfo->inclusionlist = 00000246ECF23170 -[LOG] SystemI::createSoundInternal : exinfo->inclusionlistnum = 1 -[LOG] SystemI::createSoundInternal : exinfo->suggestedsoundtype = 5 -[LOG] SystemI::createSoundInternal : exinfo->initialseekpostype = 1 -[LOG] SystemI::createSoundInternal : Stream 0/1: name='amb_main_yingli_3', format=5, channels=2, frequency=48000, lengthbytes=197664, lengthpcm=858620, pcmblocksize=0, loopstart=0, loopend=0, mode=0x00000000, channelmask=0x00000000, channelorder=0, peakvolume=0.012268. -[LOG] Thread::initThread : Init FMOD file thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFC, Stack Size: 65536, Semaphore: No, Sleep Time: 10, Looping: Yes. -[LOG] AsyncThread::threadFunc : Finished Asynchronous operation on sound 000002473BF6E918 -[LOG] SoundI::release : amb_main_yingli_3 (000002473BF6E918) -[LOG] SoundI::release : amb_main_yingli_3 (00000247E9FABF38) -[LOG] SoundI::release : amb_main_yingli_3 (0000024634C0B928)