Пытаюсь добавить AudioMixer
This commit is contained in:
1 parent
1f8e14d078
commit
ec60c47652
20 files changed
+197
-80
No files matched your search
Generated
+17
-24
@@ -5,31 +5,23 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="7a4e4e1b-6c5f-4c8d-968e-512e90aa8c7c" name="Changes" comment="">
|
<list default="true" id="7a4e4e1b-6c5f-4c8d-968e-512e90aa8c7c" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Debug.meta" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioGroupType.cs" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Debug/SceneChooser.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioGroupType.cs.meta" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Debug/SceneChooser.cs.meta" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/AudioMixerGenerator.cs" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio.meta" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/AudioMixerGenerator.cs.meta" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioFactory.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioFactory.cs.meta" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/DamnEmptyPanel.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/DamnEmptyPanel.cs.meta" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/AddressableAssetsData/AddressableAssetSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/AddressableAssetsData/AddressableAssetSettings.asset" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioInfo.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioInfo.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioService.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/AppStateMachine.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/AppStateMachine.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioSourcePool.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/PapaInstaller.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/PapaInstaller.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Audio/AudioSourceSettings.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/BootstrapState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/BootstrapState.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/Attributes.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/Attributes.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/EventBus/EventBus.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/EventBus/EventBus.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/SceneId.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/SceneId.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioInfoConfig.Generated.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/SceneLoader.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/SceneLoader.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanel.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioSourcePrefabConfig.Generated.cs.meta" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanelType.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanelType.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/AudioSourceSettingsConfig.Generated.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/UI/Canvas.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/UI/Canvas.prefab" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scenes/Bootstrap.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/Bootstrap.unity" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scenes/UITest.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/UITest.unity" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SceneLoader.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SceneLoader.Generated.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@@ -83,7 +75,7 @@
|
|||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="Start Unity" type="RunUnityExe" factoryName="Unity Executable">
|
<configuration name="Start Unity" type="RunUnityExe" factoryName="Unity Executable">
|
||||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\6000.3.1f1\Editor\Unity.exe" />
|
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\6000.3.5f2\Editor\Unity.exe" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="-projectPath A:\Projects\Infra -debugCodeOptimization" />
|
<option name="PROGRAM_PARAMETERS" value="-projectPath A:\Projects\Infra -debugCodeOptimization" />
|
||||||
<option name="WORKING_DIRECTORY" value="A:\Projects\Infra" />
|
<option name="WORKING_DIRECTORY" value="A:\Projects\Infra" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
@@ -91,7 +83,7 @@
|
|||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="Unit Tests (batch mode)" type="RunUnityExe" factoryName="Unity Executable">
|
<configuration name="Unit Tests (batch mode)" type="RunUnityExe" factoryName="Unity Executable">
|
||||||
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\6000.3.1f1\Editor\Unity.exe" />
|
<option name="EXE_PATH" value="C:\Program Files\Unity\Hub\Editor\6000.3.5f2\Editor\Unity.exe" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="-runTests -batchmode -projectPath A:\Projects\Infra -testResults Logs/results.xml -logFile Logs/Editor.log -testPlatform EditMode -debugCodeOptimization" />
|
<option name="PROGRAM_PARAMETERS" value="-runTests -batchmode -projectPath A:\Projects\Infra -testResults Logs/results.xml -logFile Logs/Editor.log -testPlatform EditMode -debugCodeOptimization" />
|
||||||
<option name="WORKING_DIRECTORY" value="A:\Projects\Infra" />
|
<option name="WORKING_DIRECTORY" value="A:\Projects\Infra" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
@@ -132,6 +124,7 @@
|
|||||||
<workItem from="1769169358065" duration="12883000" />
|
<workItem from="1769169358065" duration="12883000" />
|
||||||
<workItem from="1769342663511" duration="4805000" />
|
<workItem from="1769342663511" duration="4805000" />
|
||||||
<workItem from="1769350118757" duration="196000" />
|
<workItem from="1769350118757" duration="196000" />
|
||||||
|
<workItem from="1769608253594" duration="3971000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Code.Infrastructure.Generators;
|
||||||
|
|
||||||
|
namespace Code.Infrastructure.Audio
|
||||||
|
{
|
||||||
|
[AudioMixerEnum]
|
||||||
|
public enum AudioGroupType
|
||||||
|
{
|
||||||
|
Master,
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 754a72a6b2c140a49a23bf6d39654c94
|
||||||
|
timeCreated: 1769609499
|
||||||
@@ -11,9 +11,10 @@ namespace Code.Infrastructure.Audio
|
|||||||
[ToConfig] public int id;
|
[ToConfig] public int id;
|
||||||
[ToConfig] public AssetReference fileReference;
|
[ToConfig] public AssetReference fileReference;
|
||||||
}
|
}
|
||||||
[Config("Configs/Audio/AudioSource")]
|
[Config("Configs/Audio/AudioServiceSettings")]
|
||||||
public class AudioSourcePrefab
|
public class AudioServiceSettings
|
||||||
{
|
{
|
||||||
[ToConfig] public AssetReference prefabReference;
|
[ToConfig] public AssetReference sourcePrefab;
|
||||||
|
[ToConfig] public AssetReference mixerPrefab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ using System.Threading;
|
|||||||
using Code.Infrastructure.EventBus;
|
using Code.Infrastructure.EventBus;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
|
||||||
namespace Code.Infrastructure.Audio
|
namespace Code.Infrastructure.Audio
|
||||||
{
|
{
|
||||||
@@ -19,13 +20,15 @@ namespace Code.Infrastructure.Audio
|
|||||||
CancellationTokenSource cancellationTokenSource, AudioSourceType sourceType = AudioSourceType.NoBlend, AudioSource audioSource = null);
|
CancellationTokenSource cancellationTokenSource, AudioSourceType sourceType = AudioSourceType.NoBlend, AudioSource audioSource = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AudioService : IAudioClipsEventHandle, IAudioService
|
public partial class AudioService : IAudioClipsEventHandle, IAudioService
|
||||||
{
|
{
|
||||||
private EventBus.EventBus _eventBus;
|
private EventBus.EventBus _eventBus;
|
||||||
private IAudioFactory _audioFactory;
|
private IAudioFactory _audioFactory;
|
||||||
private IAudioSourcePool _pool;
|
private IAudioSourcePool _pool;
|
||||||
private Dictionary<AudioNames, Dictionary<int, AudioClip>> _audioClips = new();
|
private Dictionary<AudioNames, Dictionary<int, AudioClip>> _audioClips = new();
|
||||||
|
private AudioMixer _mixer;
|
||||||
|
|
||||||
|
private Dictionary<AudioGroupType, AudioMixerGroup> _audioMixerGroups = new();
|
||||||
public AudioService(EventBus.EventBus eventBus, IAudioFactory audioFactory, IAudioSourcePool pool)
|
public AudioService(EventBus.EventBus eventBus, IAudioFactory audioFactory, IAudioSourcePool pool)
|
||||||
{
|
{
|
||||||
_eventBus = eventBus;
|
_eventBus = eventBus;
|
||||||
@@ -36,8 +39,11 @@ namespace Code.Infrastructure.Audio
|
|||||||
|
|
||||||
for (int i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++)
|
for (int i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++)
|
||||||
_audioClips.Add((AudioNames)i, new Dictionary<int, AudioClip>());
|
_audioClips.Add((AudioNames)i, new Dictionary<int, AudioClip>());
|
||||||
|
|
||||||
|
InitializeMixer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private partial void InitializeMixer();
|
||||||
public void PlayTest()
|
public void PlayTest()
|
||||||
{
|
{
|
||||||
_pool.GetSource(AudioSourceType.NoBlend).PlayOneShot(GetClip(AudioNames.UISounds, 0));
|
_pool.GetSource(AudioSourceType.NoBlend).PlayOneShot(GetClip(AudioNames.UISounds, 0));
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Code.Infrastructure.Audio
|
|||||||
private string _configsLabel;
|
private string _configsLabel;
|
||||||
private AsyncOperationHandle<IList<AudioSourceSettingsConfig>> _handles;
|
private AsyncOperationHandle<IList<AudioSourceSettingsConfig>> _handles;
|
||||||
private AssetReference _sourcePrefabConfigReference;
|
private AssetReference _sourcePrefabConfigReference;
|
||||||
private AsyncOperationHandle<AudioSourcePrefabConfig> _prefabConfigHandle;
|
private AsyncOperationHandle<AudioServiceSettingsConfig> _prefabConfigHandle;
|
||||||
private AsyncOperationHandle<GameObject> _prefabHandle;
|
private AsyncOperationHandle<GameObject> _prefabHandle;
|
||||||
private EventBus.EventBus _eventBus;
|
private EventBus.EventBus _eventBus;
|
||||||
|
|
||||||
@@ -42,21 +42,21 @@ namespace Code.Infrastructure.Audio
|
|||||||
_eventBus = eventBus;
|
_eventBus = eventBus;
|
||||||
|
|
||||||
_configsLabel = configLocator.TryGetManyConfigAssetReferences<AudioSourceSettingsConfig>();
|
_configsLabel = configLocator.TryGetManyConfigAssetReferences<AudioSourceSettingsConfig>();
|
||||||
_sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference<AudioSourcePrefabConfig>();
|
_sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference<AudioServiceSettingsConfig>();
|
||||||
|
|
||||||
LoadConfigs().Forget();
|
LoadConfigs().Forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTaskVoid LoadConfigs()
|
private async UniTaskVoid LoadConfigs()
|
||||||
{
|
{
|
||||||
_prefabConfigHandle = Addressables.LoadAssetAsync<AudioSourcePrefabConfig>(_sourcePrefabConfigReference);
|
_prefabConfigHandle = Addressables.LoadAssetAsync<AudioServiceSettingsConfig>(_sourcePrefabConfigReference);
|
||||||
_handles = Addressables.LoadAssetsAsync<AudioSourceSettingsConfig>(_configsLabel);
|
_handles = Addressables.LoadAssetsAsync<AudioSourceSettingsConfig>(_configsLabel);
|
||||||
|
|
||||||
await UniTask.WhenAll(
|
await UniTask.WhenAll(
|
||||||
_prefabConfigHandle.ToUniTask(),
|
_prefabConfigHandle.ToUniTask(),
|
||||||
_handles.ToUniTask());
|
_handles.ToUniTask());
|
||||||
|
|
||||||
_prefabHandle = Addressables.LoadAssetAsync<GameObject>(_prefabConfigHandle.Result.prefabReference);
|
_prefabHandle = Addressables.LoadAssetAsync<GameObject>(_prefabConfigHandle.Result.sourcePrefab);
|
||||||
|
|
||||||
_settings = _handles.Result.ToDictionary(x => x.sourceType);
|
_settings = _handles.Result.ToDictionary(x => x.sourceType);
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ namespace Code.Infrastructure.Audio
|
|||||||
[ToConfig] public float spatialBlend;
|
[ToConfig] public float spatialBlend;
|
||||||
|
|
||||||
[ToConfig] public AudioSourceType sourceType;
|
[ToConfig] public AudioSourceType sourceType;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,4 +46,7 @@ namespace Code.Infrastructure.Generators
|
|||||||
public class SceneIdEnum : Attribute
|
public class SceneIdEnum : Attribute
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public class AudioMixerEnum : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityCodeGen;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Code.Infrastructure.Generators
|
||||||
|
{
|
||||||
|
[Generator]
|
||||||
|
public class AudioMixerGenerator : ICodeGenerator
|
||||||
|
{
|
||||||
|
public void Execute(GeneratorContext context)
|
||||||
|
{
|
||||||
|
var Enum = TypeCache.GetTypesWithAttribute<AudioMixerEnum>();
|
||||||
|
|
||||||
|
var initializedCode = "";
|
||||||
|
var serviceCode = "";
|
||||||
|
var interfacesUsingsCode = $@"
|
||||||
|
// using Code.Infrastructure.Audio;
|
||||||
|
";
|
||||||
|
|
||||||
|
foreach (var en in Enum)
|
||||||
|
{
|
||||||
|
if (!en.IsEnum) return;
|
||||||
|
|
||||||
|
var members = en.GetFields();
|
||||||
|
|
||||||
|
foreach (var member in members)
|
||||||
|
{
|
||||||
|
if (member.FieldType.FullName != en.FullName) continue;
|
||||||
|
initializedCode += $@"
|
||||||
|
_audioMixerGroups.Add({en.FullName}.{member.Name}, _mixer.FindMatchingGroups(""{member.Name}"")[0]);
|
||||||
|
|
||||||
|
";
|
||||||
|
// dictionaryCode += $@"
|
||||||
|
//
|
||||||
|
// _scenesActions.Add(SceneId.{member.Name},() => _eventBus.RaiseEvent<IOn{member.Name}SceneLoadedHandler>(h=> h.On{member.Name}SceneLoaded()));
|
||||||
|
// ";
|
||||||
|
}
|
||||||
|
|
||||||
|
serviceCode += $@"
|
||||||
|
#pragma warning disable CS0105
|
||||||
|
{interfacesUsingsCode}
|
||||||
|
#pragma warning restore CS0105
|
||||||
|
namespace Code.Infrastructure.Audio{{
|
||||||
|
public partial class AudioService
|
||||||
|
{{
|
||||||
|
private partial void InitializeMixer(){{
|
||||||
|
{initializedCode}
|
||||||
|
}}
|
||||||
|
}}
|
||||||
|
}}";
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// loaderCode = $@"
|
||||||
|
// #pragma warning disable CS0105
|
||||||
|
// {interfacesUsingsCode}
|
||||||
|
// #pragma warning restore CS0105
|
||||||
|
//
|
||||||
|
// namespace Code.Infrastructure.SceneLoader
|
||||||
|
// {{
|
||||||
|
// public partial class SceneLoader{{
|
||||||
|
// partial void SetupScenesInfo(){{
|
||||||
|
// {dictionaryCode}
|
||||||
|
// }}
|
||||||
|
// }}
|
||||||
|
// {initializedCode}
|
||||||
|
// }}
|
||||||
|
// ";
|
||||||
|
context.AddCode($"AudioMixer.Generated.cs", serviceCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c0e1349496af435c8bad4f3a409d8d58
|
||||||
|
timeCreated: 1769608573
|
||||||
@@ -12,9 +12,11 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: ba4d0c0f70786a459b739ae33e66122a, type: 3}
|
m_Script: {fileID: 11500000, guid: ba4d0c0f70786a459b739ae33e66122a, type: 3}
|
||||||
m_Name: AudioSourcePrefabConfig
|
m_Name: AudioSourcePrefabConfig
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioSourcePrefabConfig
|
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Audio.AudioSourcePrefabConfig
|
||||||
prefabReference:
|
sourcePrefab:
|
||||||
m_AssetGUID: 2471ee3760db4ecfe8c313bb2c00daf0
|
m_AssetGUID: 2471ee3760db4ecfe8c313bb2c00daf0
|
||||||
m_SubObjectName:
|
m_SubObjectName:
|
||||||
m_SubObjectType:
|
m_SubObjectType:
|
||||||
m_SubObjectGUID:
|
m_SubObjectGUID:
|
||||||
|
m_CachedAsset: {fileID: 8652297258760236330, guid: 2471ee3760db4ecfe8c313bb2c00daf0, type: 3}
|
||||||
|
m_CachedGUID: 2471ee3760db4ecfe8c313bb2c00daf0
|
||||||
m_EditorAssetChanged: 0
|
m_EditorAssetChanged: 0
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
#pragma warning disable CS0105
|
||||||
|
|
||||||
|
// using Code.Infrastructure.Audio;
|
||||||
|
|
||||||
|
#pragma warning restore CS0105
|
||||||
|
namespace Code.Infrastructure.Audio{
|
||||||
|
public partial class AudioService
|
||||||
|
{
|
||||||
|
private partial void InitializeMixer(){
|
||||||
|
|
||||||
|
_audioMixerGroups.Add(Code.Infrastructure.Audio.AudioGroupType.Master, _mixer.FindMatchingGroups("Master")[0]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a277529887b1e2e4688f63c5c886c6fe
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
#pragma warning disable CS0105
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.AddressableAssets;
|
||||||
|
|
||||||
|
namespace Code.Infrastructure.Audio{
|
||||||
|
#pragma warning restore CS0105
|
||||||
|
[CreateAssetMenu(fileName = "AudioServiceSettingsConfig", menuName = "Configs/Audio/AudioServiceSettings")]
|
||||||
|
public class AudioServiceSettingsConfig : ScriptableObject
|
||||||
|
{
|
||||||
|
public UnityEngine.AddressableAssets.AssetReference sourcePrefab;
|
||||||
|
public UnityEngine.AddressableAssets.AssetReference mixerPrefab;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0f74886b687d21842831d79d48f04eee
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
#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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ba4d0c0f70786a459b739ae33e66122a
|
|
||||||
@@ -19,12 +19,12 @@ public partial class AppStateMachine : AbstractStateMachine<Code.Infrastructure.
|
|||||||
public AppStateMachine(Code.Infrastructure.App.AppStateMachineContext context, EventBus.EventBus eventBus) : base(context)
|
public AppStateMachine(Code.Infrastructure.App.AppStateMachineContext context, EventBus.EventBus eventBus) : base(context)
|
||||||
{
|
{
|
||||||
|
|
||||||
var stateBootstrapState = new BootstrapState(StateMachineContext,eventBus);
|
|
||||||
States.Add(stateBootstrapState.myState, stateBootstrapState);
|
|
||||||
|
|
||||||
var stateMainMenuState = new MainMenuState(StateMachineContext,eventBus);
|
var stateMainMenuState = new MainMenuState(StateMachineContext,eventBus);
|
||||||
States.Add(stateMainMenuState.myState, stateMainMenuState);
|
States.Add(stateMainMenuState.myState, stateMainMenuState);
|
||||||
|
|
||||||
|
var stateBootstrapState = new BootstrapState(StateMachineContext,eventBus);
|
||||||
|
States.Add(stateBootstrapState.myState, stateBootstrapState);
|
||||||
|
|
||||||
var stateGameplayState = new GameplayState(StateMachineContext,eventBus);
|
var stateGameplayState = new GameplayState(StateMachineContext,eventBus);
|
||||||
States.Add(stateGameplayState.myState, stateGameplayState);
|
States.Add(stateGameplayState.myState, stateGameplayState);
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
#pragma warning disable CS0105
|
#pragma warning disable CS0105
|
||||||
using Code.Infrastructure.UI;
|
using Code.Infrastructure.Camera;
|
||||||
using Code.Infrastructure.Camera;
|
|
||||||
using Code.Infrastructure.Input;
|
using Code.Infrastructure.Input;
|
||||||
using Code.Infrastructure.Audio;
|
using Code.Infrastructure.Audio;
|
||||||
|
using Code.Infrastructure.Volume;
|
||||||
|
using Code.Infrastructure.UI;
|
||||||
|
using Code.Infrastructure.UI;
|
||||||
using Code.Infrastructure.Audio;
|
using Code.Infrastructure.Audio;
|
||||||
using Code.Infrastructure.Camera;
|
using Code.Infrastructure.Camera;
|
||||||
using Code.Infrastructure.UI;
|
|
||||||
using Code.Infrastructure.Volume;
|
|
||||||
using Code.Infrastructure.Audio;
|
|
||||||
using Code.Infrastructure.SceneLoader;
|
using Code.Infrastructure.SceneLoader;
|
||||||
|
using Code.Infrastructure.Audio;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
#pragma warning restore CS0105
|
#pragma warning restore CS0105
|
||||||
@@ -23,26 +23,26 @@ using Code.Infrastructure.SceneLoader;
|
|||||||
{
|
{
|
||||||
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
|
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
|
||||||
|
|
||||||
_singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings);
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
|
||||||
|
|
||||||
_singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
|
|
||||||
|
|
||||||
_singleConfigReferences.Add(typeof(Code.Infrastructure.Input.InputServiceConfig), systemConfigsReferences.InputService);
|
_singleConfigReferences.Add(typeof(Code.Infrastructure.Input.InputServiceConfig), systemConfigsReferences.InputService);
|
||||||
|
|
||||||
_singleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourcePrefabConfig), systemConfigsReferences.AudioSourcePrefab);
|
_singleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioServiceSettingsConfig), systemConfigsReferences.AudioServiceSettings);
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioInfoConfig), systemConfigsReferences.AudioInfo);
|
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
|
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings);
|
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Volume.VolumeSettingsConfig), systemConfigsReferences.VolumeSettings);
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Volume.VolumeSettingsConfig), systemConfigsReferences.VolumeSettings);
|
||||||
|
|
||||||
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings);
|
||||||
|
|
||||||
|
_singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings);
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourceSettingsConfig), systemConfigsReferences.AudioSourceSettings);
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourceSettingsConfig), systemConfigsReferences.AudioSourceSettings);
|
||||||
|
|
||||||
|
_singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
|
||||||
|
|
||||||
_multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo);
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo);
|
||||||
|
|
||||||
|
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioInfoConfig), systemConfigsReferences.AudioInfo);
|
||||||
|
|
||||||
//_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
|
//_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
#pragma warning disable CS0105
|
#pragma warning disable CS0105
|
||||||
using Code.Infrastructure.UI;
|
using Code.Infrastructure.Camera;
|
||||||
using Code.Infrastructure.Camera;
|
|
||||||
using Code.Infrastructure.Input;
|
using Code.Infrastructure.Input;
|
||||||
using Code.Infrastructure.Audio;
|
using Code.Infrastructure.Audio;
|
||||||
|
using Code.Infrastructure.Volume;
|
||||||
|
using Code.Infrastructure.UI;
|
||||||
|
using Code.Infrastructure.UI;
|
||||||
using Code.Infrastructure.Audio;
|
using Code.Infrastructure.Audio;
|
||||||
using Code.Infrastructure.Camera;
|
using Code.Infrastructure.Camera;
|
||||||
using Code.Infrastructure.UI;
|
|
||||||
using Code.Infrastructure.Volume;
|
|
||||||
using Code.Infrastructure.Audio;
|
|
||||||
using Code.Infrastructure.SceneLoader;
|
using Code.Infrastructure.SceneLoader;
|
||||||
|
using Code.Infrastructure.Audio;
|
||||||
|
|
||||||
using UnityEngine.AddressableAssets;
|
using UnityEngine.AddressableAssets;
|
||||||
#pragma warning restore CS0105
|
#pragma warning restore CS0105
|
||||||
@@ -17,16 +17,16 @@ using Code.Infrastructure.SceneLoader;
|
|||||||
namespace Code.Infrastructure.Configs{
|
namespace Code.Infrastructure.Configs{
|
||||||
public partial class SystemConfigsReferences
|
public partial class SystemConfigsReferences
|
||||||
{
|
{
|
||||||
public AssetReference CanvasSettings;
|
public string CameraSettings;
|
||||||
public AssetReference GameCamera;
|
|
||||||
public AssetReference InputService;
|
public AssetReference InputService;
|
||||||
public AssetReference AudioSourcePrefab;
|
public AssetReference AudioServiceSettings;
|
||||||
public string AudioInfo;
|
|
||||||
public string CameraSettings;
|
|
||||||
public string UIPanelSettings;
|
|
||||||
public string VolumeSettings;
|
public string VolumeSettings;
|
||||||
|
public string UIPanelSettings;
|
||||||
|
public AssetReference CanvasSettings;
|
||||||
public string AudioSourceSettings;
|
public string AudioSourceSettings;
|
||||||
|
public AssetReference GameCamera;
|
||||||
public string SceneInfo;
|
public string SceneInfo;
|
||||||
|
public string AudioInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user