diff --git a/.idea/.idea.Infratest/.idea/projectSettingsUpdater.xml b/.idea/.idea.Infratest/.idea/projectSettingsUpdater.xml index 64af657..ef20cb0 100644 --- a/.idea/.idea.Infratest/.idea/projectSettingsUpdater.xml +++ b/.idea/.idea.Infratest/.idea/projectSettingsUpdater.xml @@ -2,6 +2,7 @@ \ No newline at end of file diff --git a/.idea/.idea.Infratest/.idea/workspace.xml b/.idea/.idea.Infratest/.idea/workspace.xml index 2038d42..6f00532 100644 --- a/.idea/.idea.Infratest/.idea/workspace.xml +++ b/.idea/.idea.Infratest/.idea/workspace.xml @@ -5,17 +5,35 @@ + + + + + + + + + + + + + + + + - - - - - - + + + + + + + - + + - + + + - - - - - - - - - + { "customColor": "", @@ -55,8 +68,9 @@ "keyToString": { "Attach to Unity Editor.Attach to Unity Editor.executor": "Debug", "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.git.unshallow": "true", "XThreadsFramesViewSplitterKey": "0.31173185", - "git-widget-placeholder": "NotLiminalOne", + "git-widget-placeholder": "NotLiminalPCG", "node.js.detected.package.eslint": "true", "node.js.detected.package.tslint": "true", "node.js.selected.package.eslint": "(autodetect)", @@ -67,19 +81,27 @@ } - - @@ -87,19 +109,32 @@ + - + + + @@ -146,6 +181,10 @@ + + + + @@ -168,55 +207,46 @@ file://$PROJECT_DIR$/Assets/Code/Example/Liminal/Character/LiminalCharacterController.cs 239 - - - - - - + file://$PROJECT_DIR$/Assets/Code/Example/Liminal/Character/LiminalCharacterController.cs 245 - - - - - - + - - file://$PROJECT_DIR$/Assets/Code/Infrastructure/Camera/CameraFactory.cs - 50 - - - - - - - file://$PROJECT_DIR$/Assets/Code/Infrastructure/Camera/CameraFactory.cs 35 - - - - - - + + + file://$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioService.cs + 40 + + + + + + + + + + + + + + + + diff --git a/.idea/indexLayout.xml b/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/projectSettingsUpdater.xml b/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..ef20cb0 --- /dev/null +++ b/.idea/projectSettingsUpdater.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..49afbe4 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1769437172471 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset b/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset new file mode 100644 index 0000000..63e86b3 --- /dev/null +++ b/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset @@ -0,0 +1,16 @@ +%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: dea69d41f90c6ea4fa55c27c1d60c145, type: 3} + m_Name: AddressableAssetGroupSortSettings + m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.GroupSchemas.AddressableAssetGroupSortSettings + sortOrder: + - d790534e015d692428ac5a9ce7d2ceb6 diff --git a/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset.meta b/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset.meta new file mode 100644 index 0000000..c054773 --- /dev/null +++ b/Assets/AddressableAssetsData/AddressableAssetGroupSortSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d4769b93af55e1195a9506acfa3d9c28 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Assets/AddressableAssetsData/AddressableAssetSettings.asset index c13ee38..96ad27a 100644 --- a/Assets/AddressableAssetsData/AddressableAssetSettings.asset +++ b/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -15,7 +15,7 @@ MonoBehaviour: m_DefaultGroup: d790534e015d692428ac5a9ce7d2ceb6 m_currentHash: serializedVersion: 2 - Hash: e468f985d563957211af2aa30c8022ce + Hash: 5c0b3de6b8f117471ad9b1bb8d9f282a m_OptimizeCatalogSize: 0 m_BuildRemoteCatalog: 0 m_CatalogRequestsTimeout: 0 @@ -104,6 +104,8 @@ MonoBehaviour: - CameraConfig - UIPanelConfig - PostProccessVolume + - AudioInfoConfig + - AudioSettingsConfig m_SchemaTemplates: [] m_GroupTemplateObjects: - {fileID: 11400000, guid: af0b5782a0090884db056705d7776701, type: 2} diff --git a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset index 916b83d..4ab6606 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset @@ -15,6 +15,11 @@ MonoBehaviour: m_GroupName: Default Local Group m_GUID: d790534e015d692428ac5a9ce7d2ceb6 m_SerializeEntries: + - m_GUID: 0f5388dd5b953e74281733a43c9bca5a + m_Address: Audio/UI/01. Wake Up, Get Up, Get Out There + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 13852bf3f3ccace4e9deefd844eebb23 m_Address: Assets/Resources_moved/UI/Panels/LoadingPanel.prefab m_ReadOnly: 0 @@ -25,6 +30,11 @@ MonoBehaviour: m_ReadOnly: 0 m_SerializedLabels: [] FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 2471ee3760db4ecfe8c313bb2c00daf0 + m_Address: Assets/Resources_moved/Configs/Audio/Audio Source.prefab + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 30778c5a4d5c3f74bac4e5340344cdad m_Address: Assets/Resources_moved/Configs/Volumes/MenuRetro.asset m_ReadOnly: 0 @@ -49,11 +59,24 @@ MonoBehaviour: m_SerializedLabels: - SceneConfig FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 4bf97e6c7f046f849912182e4ded6c9e + m_Address: Assets/Resources_moved/Configs/Audio/Settings/AudioSourceSettingsConfig + 1.asset + m_ReadOnly: 0 + m_SerializedLabels: + - AudioSettingsConfig + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 4fcdb7f979b60194db1fb5c03b81bf8c m_Address: UI/Panels/LoadingPanel m_ReadOnly: 0 m_SerializedLabels: [] FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: 62388720cc90ef87f9d8ed5328dbc6fe + m_Address: Assets/Resources_moved/Configs/Audio/AudioInfoConfig.asset + m_ReadOnly: 0 + m_SerializedLabels: + - AudioInfoConfig + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: 86d0b6ef35383e7409df5a352637fea7 m_Address: UI/Panels/SceneSelectPanel m_ReadOnly: 0 @@ -100,6 +123,11 @@ MonoBehaviour: m_ReadOnly: 0 m_SerializedLabels: [] FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: d7dd69cfadda3d6e18ec390724be0d80 + m_Address: Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset + m_ReadOnly: 0 + m_SerializedLabels: [] + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: d87857258eeea2345a3b926b3c671002 m_Address: Assets/Resources_moved/Configs/UI/Loading.asset m_ReadOnly: 0 @@ -127,6 +155,12 @@ MonoBehaviour: m_SerializedLabels: - UIPanelConfig FlaggedDuringContentUpdateRestriction: 0 + - m_GUID: ec0362c4c0d045cccbe89aee2231c3be + m_Address: Assets/Resources_moved/Configs/Audio/Settings/AudioSourceSettingsConfig.asset + m_ReadOnly: 0 + m_SerializedLabels: + - AudioSettingsConfig + FlaggedDuringContentUpdateRestriction: 0 - m_GUID: f146779bcd07c524097072c871162bff m_Address: Assets/Resources_moved/Configs/Camera/FPSConfig.asset m_ReadOnly: 0 diff --git a/Assets/AddressableAssetsData/Linux.meta b/Assets/AddressableAssetsData/Linux.meta new file mode 100644 index 0000000..3664078 --- /dev/null +++ b/Assets/AddressableAssetsData/Linux.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5313cc04f8ca14597b338b65bee3093d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Code/Infrastructure/App/AppStateMachine.cs b/Assets/Code/Infrastructure/App/AppStateMachine.cs index a71ead5..22435a5 100644 --- a/Assets/Code/Infrastructure/App/AppStateMachine.cs +++ b/Assets/Code/Infrastructure/App/AppStateMachine.cs @@ -1,3 +1,4 @@ +using Code.Infrastructure.Audio; using Code.Infrastructure.Camera; using Code.Infrastructure.UI; using Reflex.Attributes; @@ -16,6 +17,8 @@ namespace Code.Infrastructure.App [Inject] public SceneLoader.SceneLoader SceneLoader { get; set; } [Inject] public CameraStateMachine Camera { get; set; } [Inject] public IUIService UIService { get; set; } + [Inject] public IAudioFactory AudioFactory { get; set; } + [Inject] public IAudioService AudioService { get; set; } } [Generators.StateMachine(typeof(AppStateMachineContext),typeof(AppStates))] diff --git a/Assets/Code/Infrastructure/App/PapaInstaller.cs b/Assets/Code/Infrastructure/App/PapaInstaller.cs index 07ace72..66e2172 100644 --- a/Assets/Code/Infrastructure/App/PapaInstaller.cs +++ b/Assets/Code/Infrastructure/App/PapaInstaller.cs @@ -1,4 +1,5 @@ using System; +using Code.Infrastructure.Audio; using Code.Infrastructure.Camera; using Code.Infrastructure.Configs; using Code.Infrastructure.Input; @@ -21,7 +22,9 @@ namespace Code.Infrastructure.App IUIInitializedHandle, IUIPanelLoaded, IVolumesInitializedHandle, - IVolumeLoaded + IVolumeLoaded, + IAudioSourcePoolInitializedHandle, + IAudioConfigsLoadedHandle { public void InstallBindings(ContainerBuilder containerBuilder) { @@ -51,6 +54,13 @@ namespace Code.Infrastructure.App containerBuilder.RegisterType(typeof(VolumeFactory), new[] { typeof(IVolumeFactory) }, Lifetime.Singleton, Resolution.Eager); + containerBuilder.RegisterType(typeof(AudioFactory), new[] { typeof(IAudioFactory) }, Lifetime.Singleton, + Resolution.Eager); + containerBuilder.RegisterType(typeof(AudioSourcePool), new[] { typeof(IAudioSourcePool) }, Lifetime.Singleton, + Resolution.Eager); + containerBuilder.RegisterType(typeof(AudioService), new[] { typeof(IAudioService) }, Lifetime.Singleton, + Resolution.Eager); + // UIFactory // Logo // Scene configs @@ -58,7 +68,9 @@ namespace Code.Infrastructure.App // Camera // Volume Factory // Loading volume - _initialLoading = new Loading(7, () => EssentialLoadEnded(_thatRightContainer)); + // Audio Factory + // Audio Pool + _initialLoading = new Loading(9, () => EssentialLoadEnded(_thatRightContainer)); _ui2CamLoading = new Loading(2, () => { @@ -156,5 +168,15 @@ namespace Code.Infrastructure.App break; } } + + public void AudioSourcePoolInitialized() + { + _initialLoading.DoProgress(); + } + + public void AudioConfigsLoaded() + { + _initialLoading.DoProgress(); + } } } \ No newline at end of file diff --git a/Assets/Code/Infrastructure/App/States/BootstrapState.cs b/Assets/Code/Infrastructure/App/States/BootstrapState.cs index 757c2a3..66c910d 100644 --- a/Assets/Code/Infrastructure/App/States/BootstrapState.cs +++ b/Assets/Code/Infrastructure/App/States/BootstrapState.cs @@ -1,16 +1,13 @@ -using Code.Infrastructure.Camera; +using Code.Infrastructure.Audio; using Code.Infrastructure.Generators; using Code.Infrastructure.SceneLoader; using Code.Infrastructure.UI; -using Cysharp.Threading.Tasks; -using UnityEngine; -using UnityEngine.SceneManagement; namespace Code.Infrastructure.App.States { [State(typeof(AppStates),typeof(AppStateMachineContext))] [StateRaisingEvent] - public partial class BootstrapState : IOnGameplaySceneLoadedHandler, IUIPanelLoaded + public partial class BootstrapState : IOnGameplaySceneLoadedHandler, IUIPanelLoaded, IReadyToPlayHandle { private EventBus.EventBus _eventBus; public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus) @@ -24,11 +21,13 @@ namespace Code.Infrastructure.App.States _eventBus.Subscribe(this); Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser); + Context.AudioFactory.LoadAudioClips(AudioNames.UISounds); // Context.SceneLoader.LoadSceneAsync(SceneId.Gameplay, LoadSceneMode.Single).Forget(); } protected override void OnExitState() { + Context.AudioFactory.ReleaseAudios(AudioNames.UISounds); Context.UIService.TryRemovePanel(UIPanelType.DebugSceneChooser); _eventBus.Unsubscribe(this); } @@ -44,5 +43,10 @@ namespace Code.Infrastructure.App.States Context.UIService.OpenPanel(uiPanelType); } + + public void OnReadyToPlay(AudioNames groupName) + { + Context.AudioService.PlayTest(); + } } } \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioFactory.cs b/Assets/Code/Infrastructure/Audio/AudioFactory.cs index 88ec2aa..7eb867e 100644 --- a/Assets/Code/Infrastructure/Audio/AudioFactory.cs +++ b/Assets/Code/Infrastructure/Audio/AudioFactory.cs @@ -1,7 +1,102 @@ -namespace DefaultNamespace +using System; +using System.Collections.Generic; +using System.Linq; +using Code.Infrastructure.Configs; +using Code.Infrastructure.EventBus; +using Cysharp.Threading.Tasks; +using UnityEngine; +using UnityEngine.AddressableAssets; +using UnityEngine.ResourceManagement.AsyncOperations; + +namespace Code.Infrastructure.Audio { - public class AudioFactory + public interface IAudioFactory { + UniTaskVoid LoadAudioClips(AudioNames groupName); + void ReleaseAudios(AudioNames groupName); + } + + public class AudioFactory : IAudioFactory, IDisposable + { + private string _label; + private Dictionary> _audioInfos = new(); + + private Dictionary>> _clipsHandles = new(); + private AsyncOperationHandle> _configsHandle; + private EventBus.EventBus _eventBus; + + public AudioFactory(IConfigLocator configLocator, EventBus.EventBus eventBus) + { + _eventBus = eventBus; + _label = configLocator.TryGetManyConfigAssetReferences(); + + for (var i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++) + { + _audioInfos.Add((AudioNames)i, new Dictionary()); + _clipsHandles.Add((AudioNames)i, new Dictionary>()); + } + + LoadConfigs().Forget(); + } + private async UniTaskVoid LoadConfigs() + { + _configsHandle = Addressables.LoadAssetsAsync(_label); + + await _configsHandle.ToUniTask(); + + foreach (AudioInfoConfig config in _configsHandle.Result) + _audioInfos[config.GroupName].Add(config.id, config.fileReference); + + _eventBus.RaiseEvent(ui => ui.AudioConfigsLoaded()); + } + + public async UniTaskVoid LoadAudioClips(AudioNames groupName) + { + foreach (var audioInfo in _audioInfos[groupName]) + if (!_clipsHandles[groupName].ContainsKey(audioInfo.Key)) + _clipsHandles[groupName].Add(audioInfo.Key, Addressables.LoadAssetAsync(audioInfo.Value)); + else + _clipsHandles[groupName][audioInfo.Key] = Addressables.LoadAssetAsync(audioInfo.Value); + + foreach (var handle in _clipsHandles[groupName]) + await handle.Value.ToUniTask(); + + _eventBus.RaiseEvent(ui => + ui.AudioClipsLoaded(groupName, _clipsHandles[groupName].ToDictionary( + x => x.Key, + x => x.Value.Result))); + } + + public void ReleaseAudios(AudioNames groupName) + { + _eventBus.RaiseEvent(x=> x.AudioClipsUnLoaded(groupName)); + + foreach (var handle in _clipsHandles) + Addressables.Release(handle.Value); + } + public void Dispose() + { + foreach (var handles in _clipsHandles) + { + foreach (var handle in handles.Value) + { + handle.Value.Release(); + } + } + + _configsHandle.Release(); + } + } + + internal interface IAudioConfigsLoadedHandle : IGlobalSubscriber + { + void AudioConfigsLoaded(); + } + + internal interface IAudioClipsEventHandle : IGlobalSubscriber + { + void AudioClipsLoaded(AudioNames groupName, Dictionary toDictionary); + void AudioClipsUnLoaded(AudioNames groupName); } } \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioInfo.cs b/Assets/Code/Infrastructure/Audio/AudioInfo.cs new file mode 100644 index 0000000..e9a4858 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioInfo.cs @@ -0,0 +1,19 @@ +using Code.Infrastructure.Generators; +using UnityEngine; +using UnityEngine.AddressableAssets; + +namespace Code.Infrastructure.Audio +{ + [Config("Configs/Audio/AudioInfo", true)] + public class AudioInfo + { + [ToConfig] public AudioNames GroupName; + [ToConfig] public int id; + [ToConfig] public AssetReference fileReference; + } + [Config("Configs/Audio/AudioSource")] + public class AudioSourcePrefab + { + [ToConfig] public AssetReference prefabReference; + } +} diff --git a/Assets/Code/Infrastructure/Audio/AudioInfo.cs.meta b/Assets/Code/Infrastructure/Audio/AudioInfo.cs.meta new file mode 100644 index 0000000..51c0be5 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 821f8c193f8846568335e415bf1e7ced +timeCreated: 1769437653 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioNames.cs b/Assets/Code/Infrastructure/Audio/AudioNames.cs new file mode 100644 index 0000000..96c3f70 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioNames.cs @@ -0,0 +1,8 @@ +namespace Code.Infrastructure.Audio +{ + public enum AudioNames + { + UISounds, + EnemySFX + } +} \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioNames.cs.meta b/Assets/Code/Infrastructure/Audio/AudioNames.cs.meta new file mode 100644 index 0000000..691f804 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioNames.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 88f7326e5bec4c97b2a70228dcd9f899 +timeCreated: 1769437552 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioService.cs b/Assets/Code/Infrastructure/Audio/AudioService.cs new file mode 100644 index 0000000..135cfbf --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioService.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using Code.Infrastructure.EventBus; +using UnityEngine; + +namespace Code.Infrastructure.Audio +{ + public interface IAudioService + { + AudioClip GetClip(AudioNames groupName, int id); + void PlayTest(); + } + + public class AudioService : IAudioClipsEventHandle, IAudioService + { + private EventBus.EventBus _eventBus; + private IAudioFactory _audioFactory; + private IAudioSourcePool _pool; + private Dictionary> _audioClips = new(); + + public AudioService(EventBus.EventBus eventBus, IAudioFactory audioFactory, IAudioSourcePool pool) + { + _eventBus = eventBus; + _audioFactory = audioFactory; + _pool = pool; + + _eventBus.Subscribe(this); + + for (int i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++) + _audioClips.Add((AudioNames)i, new Dictionary()); + } + + public void PlayTest() + { + _pool.GetSource(AudioSourceType.NoBlend).PlayOneShot(GetClip(AudioNames.UISounds, 0)); + } + public AudioClip GetClip(AudioNames groupName, int id) => _audioClips[groupName][id]; + + public void AudioClipsLoaded(AudioNames groupname, Dictionary clips) + { + _audioClips[groupname] = clips; + _eventBus.RaiseEvent(x=> x.OnReadyToPlay(groupname)); + } + + public void AudioClipsUnLoaded(AudioNames groupName) + { + _audioClips[groupName] = null; + } + } + + public interface IReadyToPlayHandle : IGlobalSubscriber + { + void OnReadyToPlay(AudioNames groupName); + } +} \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioService.cs.meta b/Assets/Code/Infrastructure/Audio/AudioService.cs.meta new file mode 100644 index 0000000..19a5260 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e8426c9e925a431aa73069c49d6a71c0 +timeCreated: 1769446252 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs b/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs new file mode 100644 index 0000000..4f6a3d9 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using Code.Infrastructure.Configs; +using Code.Infrastructure.EventBus; +using Cysharp.Threading.Tasks; +using UnityEngine; +using UnityEngine.AddressableAssets; +using UnityEngine.Audio; +using UnityEngine.Pool; +using UnityEngine.ResourceManagement.AsyncOperations; +using Object = UnityEngine.Object; + +namespace Code.Infrastructure.Audio +{ + public interface IAudioSourcePool + { + AudioSource GetSource(AudioSourceType sourceType); + void ReleaseSource(AudioSource source); + } + + public class AudioSourcePool : IAudioSourcePool, IDisposable + { + // The pool holds plain GameObjects (you can swap this for any component type). + private IObjectPool _pool; + private GameObject _sourcePrefab; + + private Dictionary _settings; + + public AudioSourcePool(Dictionary settings) => _settings = settings; + + private string _configsLabel; + private AsyncOperationHandle> _handles; + private AssetReference _sourcePrefabConfigReference; + private AsyncOperationHandle _prefabConfigHandle; + private AsyncOperationHandle _prefabHandle; + private EventBus.EventBus _eventBus; + + public AudioSourcePool(IConfigLocator configLocator, EventBus.EventBus eventBus) + { + _eventBus = eventBus; + + _configsLabel = configLocator.TryGetManyConfigAssetReferences(); + _sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference(); + + LoadConfigs().Forget(); + } + + private async UniTaskVoid LoadConfigs() + { + _prefabConfigHandle = Addressables.LoadAssetAsync(_sourcePrefabConfigReference); + _handles = Addressables.LoadAssetsAsync(_configsLabel); + + await UniTask.WhenAll( + _prefabConfigHandle.ToUniTask(), + _handles.ToUniTask()); + + _prefabHandle = Addressables.LoadAssetAsync(_prefabConfigHandle.Result.prefabReference); + + _settings = _handles.Result.ToDictionary(x => x.sourceType); + + await _prefabHandle.ToUniTask(); + + _pool = new ObjectPool( + createFunc: CreateItem, + // actionOnGet: OnGet, + actionOnRelease: OnRelease, + actionOnDestroy: OnDestroyItem, + collectionCheck: true, // helps catch double-release mistakes + defaultCapacity: 10, + maxSize: 20 + ); + + _eventBus.RaiseEvent(x => x.AudioSourcePoolInitialized()); + } + // Creates a new pooled GameObject the first time (and whenever the pool needs more). + private AudioSource CreateItem() + { + var audioSource = Object.Instantiate(_prefabHandle.Result).GetComponent(); + audioSource.name = "PooledAudioSource"; + Object.DontDestroyOnLoad(audioSource); + return audioSource; + } + + // Called when an item is taken from the pool. + private void OnGet(AudioSource source) + { + //source.gameObject.SetActive(true); + } + + // Called when an item is returned to the pool. + private void OnRelease(AudioSource source) + { + source.Stop(); + //source.gameObject.SetActive(false); + } + + // Called when the pool decides to destroy an item (e.g., above max size). + private void OnDestroyItem(AudioSource source) + { + Object.Destroy(source.gameObject); + } + // + // public async UniTaskVoid PlayOneShot(AudioClip clip, Vector3 position, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null) + // { + // AudioSource source = _pool.Get(); + // source.PlayOneShot(clip); + // source.spatialBlend = _settings[audioSourceType].spatialBlend; + // source.transform.position = position; + // source.outputAudioMixerGroup = audioMixerGroup; + // + // await UniTask.WaitUntilValueChanged(source, x => x.isPlaying); + // onComplete?.Invoke(); + // _pool.Release(source); + // } + // public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null) + // { + // AudioSource source = _pool.Get(); + // source.PlayOneShot(clip); + // source.spatialBlend = _settings[audioSourceType].spatialBlend; + // source.outputAudioMixerGroup = audioMixerGroup; + // + // await UniTask.WaitUntilValueChanged(source, x => x.isPlaying); + // onComplete?.Invoke(); + // _pool.Release(source); + // } + // public async UniTaskVoid PlayOneShot(AudioSource audioSource, AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null) + // { + // audioSource.PlayOneShot(clip); + // audioSource.spatialBlend = _settings[audioSourceType].spatialBlend; + // audioSource.outputAudioMixerGroup = audioMixerGroup; + // + // // TODO Потом сделать. Можно с cancellation, но сейчас лень. Ну правда + // await UniTask.WaitUntilValueChanged(audioSource, x => x.isPlaying); + // + // if (!audioSource) return; + // + // _pool.Release(audioSource); + // onComplete?.Invoke(); + // } + // public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, CancellationTokenSource cancellationToken, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null) + // { + // AudioSource source = _pool.Get(); + // source.PlayOneShot(clip); + // source.spatialBlend = _settings[audioSourceType].spatialBlend; + // source.outputAudioMixerGroup = audioMixerGroup; + // + // var (isCanceled, _) = await UniTask.WaitUntilValueChanged(source, x => x.isPlaying, cancellationToken: cancellationToken.Token).SuppressCancellationThrow(); + // + // _pool.Release(source); + // + // if(!isCanceled) onComplete?.Invoke(); + // else cancellationToken.Dispose(); + // } + public AudioSource GetSource(AudioSourceType sourceType) + { + var source = _pool.Get(); + + source.spatialBlend = _settings[sourceType].spatialBlend; + + return source; + } + + public void ReleaseSource(AudioSource source) => _pool.Release(source); + + public void Dispose() + { + Addressables.Release(_handles); + Addressables.Release(_prefabConfigHandle); + Addressables.Release(_sourcePrefab); + } + } + + public interface IAudioSourcePoolInitializedHandle : IGlobalSubscriber + { + void AudioSourcePoolInitialized(); + } +} \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs.meta b/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs.meta new file mode 100644 index 0000000..3cfdb3e --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 246ae406fabc4ca791673d3f38cfe1c5 +timeCreated: 1769448041 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs b/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs new file mode 100644 index 0000000..936fd6f --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs @@ -0,0 +1,13 @@ +using Code.Infrastructure.Generators; + +namespace Code.Infrastructure.Audio +{ + [Config("Configs/Audio/AudioSourceSettings", true)] + public class AudioSourceSettings + { + // Дополнять по мере необходимости + [ToConfig] public float spatialBlend; + + [ToConfig] public AudioSourceType sourceType; + } +} \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs.meta b/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs.meta new file mode 100644 index 0000000..f936d0d --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 76d9dd39cbe641dab0cfa8ed1f2007f4 +timeCreated: 1769448198 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourceType.cs b/Assets/Code/Infrastructure/Audio/AudioSourceType.cs new file mode 100644 index 0000000..bc0794d --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourceType.cs @@ -0,0 +1,8 @@ +namespace Code.Infrastructure.Audio +{ + public enum AudioSourceType + { + Full3D, + NoBlend + } +} \ No newline at end of file diff --git a/Assets/Code/Infrastructure/Audio/AudioSourceType.cs.meta b/Assets/Code/Infrastructure/Audio/AudioSourceType.cs.meta new file mode 100644 index 0000000..94398e8 --- /dev/null +++ b/Assets/Code/Infrastructure/Audio/AudioSourceType.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 85f9cb99599f4399a1fd66496b5184d0 +timeCreated: 1769448254 \ No newline at end of file diff --git a/Assets/Code/Infrastructure/UI/UIPanel.cs b/Assets/Code/Infrastructure/UI/UIPanel.cs index 4bb8b57..7888a78 100644 --- a/Assets/Code/Infrastructure/UI/UIPanel.cs +++ b/Assets/Code/Infrastructure/UI/UIPanel.cs @@ -1,6 +1,4 @@ -using System.ComponentModel; using UnityEngine; -using UnityEngine.Serialization; namespace Code.Infrastructure.UI { diff --git a/Assets/Resources/Audio.meta b/Assets/Resources/Audio.meta new file mode 100644 index 0000000..68d7099 --- /dev/null +++ b/Assets/Resources/Audio.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 13f65a629e8c7e8c4a665474d64bd743 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Audio/UI.meta b/Assets/Resources/Audio/UI.meta new file mode 100644 index 0000000..3d08491 --- /dev/null +++ b/Assets/Resources/Audio/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5dee85ec17f52ef9795843350a175109 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/SystemConfigsReferences.asset b/Assets/Resources/SystemConfigsReferences.asset index 3dbe40b..ea740ee 100644 --- a/Assets/Resources/SystemConfigsReferences.asset +++ b/Assets/Resources/SystemConfigsReferences.asset @@ -18,25 +18,33 @@ MonoBehaviour: m_SubObjectType: m_SubObjectGUID: m_EditorAssetChanged: 0 - CameraSettings: CameraConfig - UIPanelSettings: UIPanelConfig - GameCamera: - m_AssetGUID: c42e39e2fb64cdd45b2ebc4b723d9d0c - m_SubObjectName: - m_SubObjectType: - m_SubObjectGUID: - m_EditorAssetChanged: 1 CanvasSettings: m_AssetGUID: 17c5e56eb6c99db40b6093c9d543bb4f m_SubObjectName: m_SubObjectType: m_SubObjectGUID: m_EditorAssetChanged: 0 + GameCamera: + m_AssetGUID: c42e39e2fb64cdd45b2ebc4b723d9d0c + m_SubObjectName: + m_SubObjectType: + m_SubObjectGUID: + m_EditorAssetChanged: 1 InputService: m_AssetGUID: eab71c0cf90c4b94294e497d3734cfe1 m_SubObjectName: m_SubObjectType: m_SubObjectGUID: m_EditorAssetChanged: 0 + AudioSourcePrefab: + m_AssetGUID: d7dd69cfadda3d6e18ec390724be0d80 + m_SubObjectName: + m_SubObjectType: + m_SubObjectGUID: + m_EditorAssetChanged: 1 + AudioInfo: AudioInfoConfig + CameraSettings: CameraConfig + UIPanelSettings: UIPanelConfig VolumeSettings: PostProccessVolume + AudioSourceSettings: AudioSettingsConfig SceneInfo: SceneConfig diff --git a/Assets/Resources_moved/Audio.meta b/Assets/Resources_moved/Audio.meta new file mode 100644 index 0000000..5566d91 --- /dev/null +++ b/Assets/Resources_moved/Audio.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 71c6e3f3eca713f79aeab6d6d5f97a5c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Audio/UI.meta b/Assets/Resources_moved/Audio/UI.meta new file mode 100644 index 0000000..491107c --- /dev/null +++ b/Assets/Resources_moved/Audio/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a2d053908c1e62df3a20c0dc82138a43 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3 b/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3 new file mode 100644 index 0000000..d6eda7e Binary files /dev/null and b/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3 differ diff --git a/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3.meta b/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3.meta new file mode 100644 index 0000000..baafe3e --- /dev/null +++ b/Assets/Resources_moved/Audio/UI/01. Wake Up, Get Up, Get Out There.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 0f5388dd5b953e74281733a43c9bca5a +AudioImporter: + externalObjects: {} + serializedVersion: 8 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio.meta b/Assets/Resources_moved/Configs/Audio.meta new file mode 100644 index 0000000..0b0877a --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fcdf8416abd923e6bd56b3cae3e64a9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Audio Source.prefab b/Assets/Resources_moved/Configs/Audio/Audio Source.prefab new file mode 100644 index 0000000..f5502d7 --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Audio Source.prefab @@ -0,0 +1,131 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8652297258760236330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 497122190607935989} + - component: {fileID: 8953235124198601079} + m_Layer: 0 + m_Name: Audio Source + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &497122190607935989 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8652297258760236330} + 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!82 &8953235124198601079 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8652297258760236330} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_Resource: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + 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 diff --git a/Assets/Resources_moved/Configs/Audio/Audio Source.prefab.meta b/Assets/Resources_moved/Configs/Audio/Audio Source.prefab.meta new file mode 100644 index 0000000..f5dbc1d --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Audio Source.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2471ee3760db4ecfe8c313bb2c00daf0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset b/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset new file mode 100644 index 0000000..2df6c6d --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset @@ -0,0 +1,20 @@ +%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: ba4d0c0f70786a459b739ae33e66122a, type: 3} + m_Name: AudioSourcePrefabConfig + m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioSourcePrefabConfig + prefabReference: + m_AssetGUID: 2471ee3760db4ecfe8c313bb2c00daf0 + m_SubObjectName: + m_SubObjectType: + m_SubObjectGUID: + m_EditorAssetChanged: 0 diff --git a/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset.meta b/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset.meta new file mode 100644 index 0000000..64789c5 --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7dd69cfadda3d6e18ec390724be0d80 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Infos.meta b/Assets/Resources_moved/Configs/Audio/Infos.meta new file mode 100644 index 0000000..216195c --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Infos.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d71926e410ce41907b3cd545595812fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset b/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset new file mode 100644 index 0000000..c4ba12a --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset @@ -0,0 +1,22 @@ +%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: a8b089dd854c0a084ba749d31f8b399f, type: 3} + m_Name: AudioInfoConfig + m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioInfoConfig + GroupName: 0 + id: 0 + fileReference: + m_AssetGUID: 0f5388dd5b953e74281733a43c9bca5a + m_SubObjectName: + m_SubObjectType: + m_SubObjectGUID: + m_EditorAssetChanged: 0 diff --git a/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset.meta b/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset.meta new file mode 100644 index 0000000..91a1cee --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Infos/AudioInfoConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62388720cc90ef87f9d8ed5328dbc6fe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Settings.meta b/Assets/Resources_moved/Configs/Audio/Settings.meta new file mode 100644 index 0000000..8c765fd --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: edd23fce0ea3a7aa494e02195d8b3ed4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset b/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset new file mode 100644 index 0000000..72e2eea --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset @@ -0,0 +1,16 @@ +%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: 85a3854301201dc0d93ecb89c2f30e92, type: 3} + m_Name: Full3D + m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioSourceSettingsConfig + spatialBlend: 1 + sourceType: 0 diff --git a/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset.meta b/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset.meta new file mode 100644 index 0000000..dc69699 --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Settings/Full3D.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4bf97e6c7f046f849912182e4ded6c9e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset b/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset new file mode 100644 index 0000000..f9d8eff --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset @@ -0,0 +1,16 @@ +%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: 85a3854301201dc0d93ecb89c2f30e92, type: 3} + m_Name: NoBlend + m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioSourceSettingsConfig + spatialBlend: 0 + sourceType: 1 diff --git a/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset.meta b/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset.meta new file mode 100644 index 0000000..fa0c17b --- /dev/null +++ b/Assets/Resources_moved/Configs/Audio/Settings/NoBlend.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ec0362c4c0d045cccbe89aee2231c3be +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs b/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs new file mode 100644 index 0000000..94c9324 --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs @@ -0,0 +1,20 @@ + +#pragma warning disable CS0105 +using Code.Infrastructure.Audio; +using System; +using UnityEngine.AddressableAssets; + +using UnityEngine; +using UnityEngine.AddressableAssets; + +namespace Code.Infrastructure.Audio{ +#pragma warning restore CS0105 +[CreateAssetMenu(fileName = "AudioInfoConfig", menuName = "Configs/Audio/AudioInfo")] +public class AudioInfoConfig : ScriptableObject +{ + public Code.Infrastructure.Audio.AudioNames GroupName; +public System.Int32 id; +public UnityEngine.AddressableAssets.AssetReference fileReference; + +} +} diff --git a/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs.meta b/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs.meta new file mode 100644 index 0000000..1e8aed5 --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: a8b089dd854c0a084ba749d31f8b399f \ No newline at end of file diff --git a/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs b/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs new file mode 100644 index 0000000..3470b77 --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs @@ -0,0 +1,16 @@ + +#pragma warning disable CS0105 +using UnityEngine.AddressableAssets; + +using UnityEngine; +using UnityEngine.AddressableAssets; + +namespace Code.Infrastructure.Audio{ +#pragma warning restore CS0105 +[CreateAssetMenu(fileName = "AudioSourcePrefabConfig", menuName = "Configs/Audio/AudioSource")] +public class AudioSourcePrefabConfig : ScriptableObject +{ + public UnityEngine.AddressableAssets.AssetReference prefabReference; + +} +} diff --git a/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs.meta b/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs.meta new file mode 100644 index 0000000..1bda51f --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ba4d0c0f70786a459b739ae33e66122a \ No newline at end of file diff --git a/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs b/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs new file mode 100644 index 0000000..221c9cd --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs @@ -0,0 +1,18 @@ + +#pragma warning disable CS0105 +using System; +using Code.Infrastructure.Audio; + +using UnityEngine; +using UnityEngine.AddressableAssets; + +namespace Code.Infrastructure.Audio{ +#pragma warning restore CS0105 +[CreateAssetMenu(fileName = "AudioSourceSettingsConfig", menuName = "Configs/Audio/AudioSourceSettings")] +public class AudioSourceSettingsConfig : ScriptableObject +{ + public System.Single spatialBlend; +public Code.Infrastructure.Audio.AudioSourceType sourceType; + +} +} diff --git a/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs.meta b/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs.meta new file mode 100644 index 0000000..cac6465 --- /dev/null +++ b/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 85a3854301201dc0d93ecb89c2f30e92 \ No newline at end of file diff --git a/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs b/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs index ff47eb4..660f016 100644 --- a/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs +++ b/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs @@ -22,12 +22,12 @@ public partial class AppStateMachine : AbstractStateMachine AllowedStates.HasFlag(nextState); diff --git a/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs b/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs index acc4eb7..cb8b77d 100644 --- a/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs +++ b/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs @@ -3,10 +3,13 @@ using Code.Infrastructure.UI; using Code.Infrastructure.Camera; using Code.Infrastructure.Input; -using Code.Infrastructure.Volume; +using Code.Infrastructure.Audio; +using Code.Infrastructure.Audio; using Code.Infrastructure.Camera; -using Code.Infrastructure.SceneLoader; using Code.Infrastructure.UI; +using Code.Infrastructure.Volume; +using Code.Infrastructure.Audio; +using Code.Infrastructure.SceneLoader; using UnityEngine; #pragma warning restore CS0105 @@ -20,19 +23,25 @@ using Code.Infrastructure.UI; { SystemConfigsReferences systemConfigsReferences = Resources.Load("SystemConfigsReferences"); - _multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings); + _singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings); _singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera); _singleConfigReferences.Add(typeof(Code.Infrastructure.Input.InputServiceConfig), systemConfigsReferences.InputService); - _multipleConfigReferences.Add(typeof(Code.Infrastructure.Volume.VolumeSettingsConfig), systemConfigsReferences.VolumeSettings); + _singleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourcePrefabConfig), systemConfigsReferences.AudioSourcePrefab); + + _multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioInfoConfig), systemConfigsReferences.AudioInfo); _multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings); - _multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo); + _multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings); - _singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings); + _multipleConfigReferences.Add(typeof(Code.Infrastructure.Volume.VolumeSettingsConfig), systemConfigsReferences.VolumeSettings); + + _multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourceSettingsConfig), systemConfigsReferences.AudioSourceSettings); + + _multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo); //_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences); } diff --git a/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs b/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs index 587528a..fbc6c56 100644 --- a/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs +++ b/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs @@ -3,10 +3,13 @@ using Code.Infrastructure.UI; using Code.Infrastructure.Camera; using Code.Infrastructure.Input; -using Code.Infrastructure.Volume; +using Code.Infrastructure.Audio; +using Code.Infrastructure.Audio; using Code.Infrastructure.Camera; -using Code.Infrastructure.SceneLoader; using Code.Infrastructure.UI; +using Code.Infrastructure.Volume; +using Code.Infrastructure.Audio; +using Code.Infrastructure.SceneLoader; using UnityEngine.AddressableAssets; #pragma warning restore CS0105 @@ -14,13 +17,16 @@ using Code.Infrastructure.UI; namespace Code.Infrastructure.Configs{ public partial class SystemConfigsReferences { - public string UIPanelSettings; + public AssetReference CanvasSettings; public AssetReference GameCamera; public AssetReference InputService; -public string VolumeSettings; +public AssetReference AudioSourcePrefab; +public string AudioInfo; public string CameraSettings; +public string UIPanelSettings; +public string VolumeSettings; +public string AudioSourceSettings; public string SceneInfo; -public AssetReference CanvasSettings; } } diff --git a/Packages/manifest.json b/Packages/manifest.json index 4900b7b..387e612 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -4,15 +4,15 @@ "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", "com.gustavopsantos.reflex": "https://github.com/gustavopsantos/reflex.git?path=/Assets/Reflex/#14.0.0", "com.unity.2d.sprite": "1.0.0", - "com.unity.addressables": "2.7.6", + "com.unity.addressables": "2.8.0", "com.unity.ai.navigation": "2.0.9", - "com.unity.collab-proxy": "2.10.2", + "com.unity.collab-proxy": "2.11.2", "com.unity.ide.rider": "3.0.38", "com.unity.inputsystem": "1.17.0", "com.unity.multiplayer.center": "1.0.1", "com.unity.render-pipelines.universal": "17.3.0", "com.unity.test-framework": "1.6.0", - "com.unity.timeline": "1.8.9", + "com.unity.timeline": "1.8.10", "com.unity.ugui": "2.0.0", "com.unity.visualscripting": "1.9.9", "com.unity.modules.accessibility": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index b23c4dd..e22d79c 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -28,7 +28,7 @@ "dependencies": {} }, "com.unity.addressables": { - "version": "2.7.6", + "version": "2.8.0", "depth": 0, "source": "registry", "dependencies": { @@ -38,7 +38,7 @@ "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.scriptablebuildpipeline": "2.5.0", + "com.unity.scriptablebuildpipeline": "2.5.1", "com.unity.modules.unitywebrequestassetbundle": "1.0.0" }, "url": "https://packages.unity.com" @@ -53,7 +53,7 @@ "url": "https://packages.unity.com" }, "com.unity.burst": { - "version": "1.8.26", + "version": "1.8.27", "depth": 2, "source": "registry", "dependencies": { @@ -63,7 +63,7 @@ "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "2.10.2", + "version": "2.11.2", "depth": 0, "source": "registry", "dependencies": {}, @@ -168,7 +168,7 @@ } }, "com.unity.scriptablebuildpipeline": { - "version": "2.5.0", + "version": "2.5.1", "depth": 1, "source": "registry", "dependencies": { @@ -214,7 +214,7 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.8.9", + "version": "1.8.10", "depth": 0, "source": "registry", "dependencies": { diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index be4a797..d940b84 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -12,11 +12,13 @@ MonoBehaviour: m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} m_Name: m_EditorClassIdentifier: - m_EnablePreviewPackages: 0 - m_EnablePackageDependencies: 0 + m_EnablePreReleasePackages: 0 m_AdvancedSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 + m_DismissPreviewPackagesInUse: 0 oneTimeWarningShown: 0 + oneTimePackageErrorsPopUpShown: 1 m_Registries: - m_Id: main m_Name: @@ -24,20 +26,15 @@ MonoBehaviour: m_Scopes: [] m_IsDefault: 1 m_Capabilities: 7 + m_ConfigSource: 0 + m_Compliance: + m_Status: 0 + m_Violations: [] m_UserSelectedRegistryName: m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: - m_ErrorMessage: - m_Original: - m_Id: - m_Name: - m_Url: - m_Scopes: [] - m_IsDefault: 0 - m_Capabilities: 0 m_Modified: 0 - m_Name: - m_Url: - m_Scopes: - - - m_SelectedScopeIndex: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -894 + m_OriginalInstanceId: -896 + m_LoadAssets: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index f9dea7f..ee8469e 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.3.1f1 -m_EditorVersionWithRevision: 6000.3.1f1 (37142da19a94) +m_EditorVersion: 6000.3.5f2 +m_EditorVersionWithRevision: 6000.3.5f2 (3fa8bc678cb0) diff --git a/ProjectSettings/ScriptableBuildPipeline.json b/ProjectSettings/ScriptableBuildPipeline.json new file mode 100644 index 0000000..dfa4f08 --- /dev/null +++ b/ProjectSettings/ScriptableBuildPipeline.json @@ -0,0 +1,14 @@ +{ + "useBuildCacheServer": false, + "cacheServerHost": "", + "cacheServerPort": 8126, + "threadedArchiving": true, + "logCacheMiss": false, + "logAssetWarnings": true, + "slimWriteResults": true, + "maximumCacheSize": 20, + "useDetailedBuildLog": false, + "useV2Hasher": true, + "fileIDHashSeed": 0, + "prefabPackedHeaderSize": 2 +} \ No newline at end of file