This commit is contained in:
ThomasCharester committed 2026-02-26 11:21:27 +03:00
1 parent a73338916a
commit fbc1cc8d3e
207 files changed
+10327 -2

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: df98c273f7a040bf929b4f16a5c36b58
timeCreated: 1765563475
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8ae0afd22327405eb4098d4106118b68
timeCreated: 1766056068
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 378d32559e654d4b91e761f7f5d4cee6
timeCreated: 1765572320
@@ -0,0 +1,35 @@
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Input;
using Code.Infrastructure.UI;
using Reflex.Attributes;
namespace Code.Infrastructure.App
{
public enum AppStates
{
Bootstrap,
Gameplay,
MainMenu,
Platformer
}
public class AppStateMachineContext
{
[Inject] public SceneLoader.SceneLoader SceneLoader { get; set; }
[Inject] public CameraStateMachine Camera { get; set; }
[Inject] public CameraFactory CameraFactory { get; set; }
[Inject] public IUIService UIService { get; set; }
[Inject] public IAudioFactory AudioFactory { get; set; }
[Inject] public IAudioService AudioService { get; set; }
[Inject] public IInputService InputService { get; set; }
public AppStateMachine StateMachine { get; set; }
}
[Generators.StateMachine(typeof(AppStateMachineContext),typeof(AppStates))]
public partial class AppStateMachine
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5627248405434f028be921cb7916f823
timeCreated: 1765572329
@@ -0,0 +1,213 @@
using Code.Debug;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Configs;
using Code.Infrastructure.Input;
using Code.Infrastructure.Loadings;
using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.UI;
using Code.Infrastructure.Volume;
using Reflex.Core;
using Reflex.Enums;
using Reflex.Injectors;
using Unity.Cinemachine;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using Resolution = Reflex.Enums.Resolution;
namespace Code.Infrastructure.App
{
public class PapaInstaller : MonoBehaviour, IInstaller,
ISceneConfigsLoadedHandle,
IInputServiceInitializedHandle,
ICameraInitializedHandle,
IUIInitializedHandle,
IUIPanelLoaded,
IVolumesInitializedHandle,
IVolumeLoaded,
IAudioSourcePoolInitializedHandle,
IAudioConfigsLoadedHandle,
ICinematicMachineHandle,
ILayerMasksInitializedHandle
{
public void InstallBindings(ContainerBuilder containerBuilder)
{
InitLoadings();
containerBuilder.RegisterType(typeof(EventBus.EventBus), Lifetime.Singleton, Resolution.Eager);
containerBuilder.RegisterType(typeof(ConfigLocator), new[] { typeof(IConfigLocator) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(SceneLoader.SceneLoader), Lifetime.Singleton, Resolution.Eager);
containerBuilder.RegisterType(typeof(InputService), new[] { typeof(IInputService) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.OnContainerBuilt += Bootstrap;
containerBuilder.RegisterType(typeof(AppStateMachine), Lifetime.Singleton, Resolution.Lazy);
containerBuilder.RegisterType(typeof(AppStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
containerBuilder.RegisterType(typeof(CameraFactory), Lifetime.Singleton, Resolution.Lazy);
containerBuilder.RegisterType(typeof(CameraStateMachine), Lifetime.Singleton, Resolution.Lazy);
containerBuilder.RegisterType(typeof(CameraStateMachineContext), Lifetime.Singleton, Resolution.Lazy);
containerBuilder.RegisterType(typeof(UIFactory), new[] { typeof(IUIFactory) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(UIService), new[] { typeof(IUIService) }, Lifetime.Singleton,
Resolution.Eager);
containerBuilder.RegisterType(typeof(VolumeService), new[] { typeof(IVolumeService) }, Lifetime.Singleton,
Resolution.Lazy);
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);
}
private void InitLoadings()
{
// UIFactory
// Logo
// Scene configs
// Input service
// Camera
// Volume Factory
// Loading volume
// Audio Factory
// Audio Pool
// Cinemachine Camera
// Layer masks
_initialLoading = new Loading(11, () => EssentialLoadEnded(_thatRightContainer));
_ui2CamLoading = new Loading(2,
() =>
{
_thatRightContainer.Resolve<IUIService>().SetCanvasCamera(_thatRightContainer
.Resolve<CameraStateMachineContext>().cameraLoadedData.Camera);
});
}
private Loading _initialLoading;
private Loading _ui2CamLoading;
private Container _thatRightContainer;
private void Bootstrap(Container container)
{
_thatRightContainer = container;
container.Resolve<EventBus.EventBus>().Subscribe(this);
ConstructorInjector.Construct(typeof(LayerMasks), container);
var cameraFactory = container.Resolve<CameraFactory>();
cameraFactory.CreateCameraStateMachine(container.Resolve<CameraStateMachine>())
.Forget();
}
private void EssentialLoadEnded(Container container)
{
container.Resolve<EventBus.EventBus>().Unsubscribe(this);
container.Resolve<AppStateMachine>().SwitchState(AppStates.Bootstrap)
.AllowStateTransition(AppStates.Gameplay)
.AllowStateTransition(AppStates.Platformer);
container.Resolve<AppStateMachineContext>().StateMachine = container.Resolve<AppStateMachine>();
}
public void SceneConfigsLoaded()
{
_initialLoading.DoProgress();
}
public void InputServiceInitialized()
{
_initialLoading.DoProgress();
}
public void CameraInitialized(CameraStateMachineContext.CameraLoadedData data)
{
_thatRightContainer.Resolve<CameraStateMachineContext>().cameraLoadedData = data;
_thatRightContainer.Resolve<CameraStateMachine>().SwitchState(CameraMode.None)
.AllowStateTransition(CameraMode.ThirdPerson)
.AllowStateTransition(CameraMode.Platformer);
data.Camera.GetUniversalAdditionalCameraData().renderPostProcessing = true;
_ui2CamLoading.DoProgress();
_initialLoading.DoProgress();
_thatRightContainer.Resolve<CameraFactory>().LoadCinemachineCamera(CameraMode.None).Forget();
}
public void UIInitialized()
{
_ui2CamLoading.DoProgress();
_initialLoading.DoProgress();
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Logo);
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Loading);
}
public void UILoaded(UIPanelType uiPanelType)
{
switch (uiPanelType)
{
case UIPanelType.Logo:
_thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
_initialLoading.DoProgress();
break;
case UIPanelType.Loading:
// _thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
break;
default:
Application.Quit();
break;
}
}
public void VolumesInitialized()
{
_initialLoading.DoProgress();
_thatRightContainer.Resolve<IVolumeService>().TryLoadVolume(VolumeId.MenuRetro);
}
public void VolumeLoaded(VolumeId volumeId)
{
switch (volumeId)
{
case VolumeId.MenuRetro:
_initialLoading.DoProgress();
break;
default:
Application.Quit();
break;
}
}
public void AudioSourcePoolInitialized()
{
_initialLoading.DoProgress();
}
public void AudioConfigsLoaded()
{
_initialLoading.DoProgress();
}
public void CinemachineLoaded(CinemachineCamera cinemachineCamera)
{
_initialLoading.DoProgress();
}
public void LayerMasksInitialized()
{
_initialLoading.DoProgress();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e62d9c9e01334727887a684e008440a6
timeCreated: 1765572590
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 778cb4118a914d9c8b1cac8bef4295a5
timeCreated: 1765572459
@@ -0,0 +1,48 @@
using System.Threading;
using Code.Debug;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Generators;
using Code.Infrastructure.UI;
namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class BootstrapState : IUIPanelLoaded, IReadyToPlayHandle
{
private EventBus.EventBus _eventBus;
public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
{
_eventBus = eventBus;
}
public override AppStates myState => AppStates.Bootstrap;
protected override void OnEnterState()
{
_eventBus.Subscribe(this);
Context.UIService.TryRemovePanel(UIPanelType.Logo);
Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser);
Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
}
protected override void OnExitState()
{
// Context.AudioFactory.ReleaseAudios(AudioNames.UISounds);
Context.UIService.TryRemovePanel(UIPanelType.DebugSceneChooser);
_eventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)
{
if (uiPanelType != UIPanelType.DebugSceneChooser) return;
Context.UIService.OpenPanel(uiPanelType);
}
public void OnReadyToPlay(AudioNames groupName)
{
Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 71df5370ea2e4819bfbdb9cbb8e6c0ab
timeCreated: 1765572469
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 117e5c36ac3f47b2bff18075759dd50e
timeCreated: 1769344255
@@ -0,0 +1,106 @@
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.ResourceManagement.AsyncOperations;
namespace Code.Infrastructure.Audio
{
public interface IAudioFactory
{
UniTaskVoid LoadAudioClips(AudioNames groupName);
void ReleaseAudios(AudioNames groupName);
}
public class AudioFactory : IAudioFactory, IDisposable
{
private string _label;
private Dictionary<AudioNames, Dictionary<int, AssetReference>> _audioInfos = new();
private Dictionary<AudioNames, Dictionary<int, AsyncOperationHandle<AudioClip>>> _clipsHandles = new();
private AsyncOperationHandle<IList<AudioInfoConfig>> _configsHandle;
private EventBus.EventBus _eventBus;
public AudioFactory(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
_eventBus = eventBus;
_label = configLocator.TryGetManyConfigAssetReferences<AudioInfoConfig>();
for (var i = 0; i < typeof(AudioNames).GetEnumValues().Length; i++)
{
_audioInfos.Add((AudioNames)i, new Dictionary<int, AssetReference>());
_clipsHandles.Add((AudioNames)i, new Dictionary<int, AsyncOperationHandle<AudioClip>>());
}
LoadConfigs().Forget();
}
private async UniTaskVoid LoadConfigs()
{
_configsHandle = Addressables.LoadAssetsAsync<AudioInfoConfig>(_label);
await _configsHandle.ToUniTask();
foreach (AudioInfoConfig config in _configsHandle.Result)
_audioInfos[config.GroupName].Add(config.id, config.fileReference);
_eventBus.RaiseEvent<IAudioConfigsLoadedHandle>(ui => ui.AudioConfigsLoaded());
}
public async UniTaskVoid LoadAudioClips(AudioNames groupName)
{
UnityEngine.Debug.LogWarning($"Audios loaded {groupName}");
foreach (var audioInfo in _audioInfos[groupName])
if (!_clipsHandles[groupName].ContainsKey(audioInfo.Key))
_clipsHandles[groupName].Add(audioInfo.Key, Addressables.LoadAssetAsync<AudioClip>(audioInfo.Value));
else
_clipsHandles[groupName][audioInfo.Key] = Addressables.LoadAssetAsync<AudioClip>(audioInfo.Value);
foreach (var handle in _clipsHandles[groupName])
await handle.Value.ToUniTask();
_eventBus.RaiseEvent<IAudioClipsEventHandle>(ui =>
ui.AudioClipsLoaded(groupName, _clipsHandles[groupName].ToDictionary(
x => x.Key,
x => x.Value.Result)));
}
public void ReleaseAudios(AudioNames groupName)
{
UnityEngine.Debug.LogWarning($"Audios unloaded {groupName}");
_eventBus.RaiseEvent<IAudioClipsEventHandle>(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<int, AudioClip> toDictionary);
void AudioClipsUnLoaded(AudioNames groupName);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cc45c23918ed446681564b467668304b
timeCreated: 1769344269
@@ -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
@@ -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/AudioSourceSettings")]
public class AudioSourcePrefab
{
[ToConfig] public AssetReference sourcePrefab;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 821f8c193f8846568335e415bf1e7ced
timeCreated: 1769437653
@@ -0,0 +1,8 @@
namespace Code.Infrastructure.Audio
{
public enum AudioNames
{
UISounds,
EnemySFX
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 88f7326e5bec4c97b2a70228dcd9f899
timeCreated: 1769437552
@@ -0,0 +1,133 @@
using System.Collections.Generic;
using System.Threading;
using Code.Infrastructure.EventBus;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.Audio;
namespace Code.Infrastructure.Audio
{
public interface IAudioService
{
AudioClip GetClip(AudioNames groupName, int id);
void PlayTest();
UniTaskVoid PlayOneShot(AudioNames groupName, int id, Vector3 position = new Vector3(),
AudioSourceType sourceType = AudioSourceType.NoBlend,
AudioSource audioSource = null);
UniTaskVoid PlayRepeatedly(AudioNames groupName, int id,
AudioSourceType sourceType = AudioSourceType.NoBlend, AudioSource audioSource = null, CancellationTokenSource cancellationTokenSource = null);
bool CheckClip(AudioNames groupName, int id);
void CancelMusic(AudioNames groupName, int id);
void ReleaseCancellationSource(AudioNames groupName, int id);
}
public partial class AudioService : IAudioClipsEventHandle, IAudioService
{
private EventBus.EventBus _eventBus;
private IAudioFactory _audioFactory;
private IAudioSourcePool _pool;
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)
{
_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<int, AudioClip>());
//InitializeMixer();
}
private partial void InitializeMixer();
public void PlayTest()
{
_pool.GetSource(AudioSourceType.NoBlend).PlayOneShot(GetClip(AudioNames.UISounds, 0));
}
public async UniTaskVoid PlayOneShot(AudioNames groupName, int id, Vector3 position = new Vector3(),
AudioSourceType sourceType = AudioSourceType.NoBlend,
AudioSource audioSource = null)
{
if (!CheckClip(groupName, id)) return;
if (!audioSource) audioSource = _pool.GetSource(sourceType);
audioSource.transform.position = position;
audioSource.PlayOneShot(GetClip(groupName, id));
await UniTask.NextFrame();
await UniTask.WaitUntilValueChanged(audioSource, _ => !audioSource.isPlaying);
_pool.ReleaseSource(audioSource);
}
private Dictionary<KeyValuePair<AudioNames, int>, CancellationTokenSource> _cancellationTokenSources = new();
public void CancelMusic(AudioNames groupName, int id) => _cancellationTokenSources[new KeyValuePair<AudioNames, int>(groupName, id)].Cancel();
public void ReleaseCancellationSource(AudioNames groupName, int id) => _cancellationTokenSources[new KeyValuePair<AudioNames, int>(groupName, id)] = null;
public async UniTaskVoid PlayRepeatedly(AudioNames groupName, int id,
AudioSourceType sourceType = AudioSourceType.NoBlend, AudioSource audioSource = null, CancellationTokenSource cancellationTokenSource = null)
{
if (!CheckClip(groupName, id)) return;
if(cancellationTokenSource == null)
{
cancellationTokenSource = new CancellationTokenSource();
_cancellationTokenSources[new KeyValuePair<AudioNames, int>(groupName, id)] = cancellationTokenSource;
}
if (!audioSource) audioSource = _pool.GetSource(sourceType);
if(!audioSource.resource) audioSource.resource = GetClip(groupName, id);
audioSource.Play();
await UniTask.NextFrame();
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(audioSource,
_ => !audioSource.isPlaying,
cancellationToken: cancellationTokenSource.Token).SuppressCancellationThrow();
UnityEngine.Debug.LogError("Music skipping");
if (isCanceled)
{
cancellationTokenSource.Dispose();
_pool.ReleaseSource(audioSource);
ReleaseCancellationSource(groupName,id);
return;
}
PlayRepeatedly(groupName, id, sourceType, audioSource, cancellationTokenSource).Forget();
}
public AudioClip GetClip(AudioNames groupName, int id) => _audioClips[groupName][id];
public bool CheckClip(AudioNames groupName, int id) => _audioClips[groupName].ContainsKey(id);
public void AudioClipsLoaded(AudioNames groupname, Dictionary<int, AudioClip> clips)
{
_audioClips[groupname] = clips;
_eventBus.RaiseEvent<IReadyToPlayHandle>(x => x.OnReadyToPlay(groupname));
}
public void AudioClipsUnLoaded(AudioNames groupName)
{
_audioClips[groupName].Clear();
_audioClips[groupName] = null;
}
}
public interface IReadyToPlayHandle : IGlobalSubscriber
{
void OnReadyToPlay(AudioNames groupName);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8426c9e925a431aa73069c49d6a71c0
timeCreated: 1769446252
@@ -0,0 +1,129 @@
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<AudioSource> _pool;
private GameObject _sourcePrefab;
private Dictionary<AudioSourceType, AudioSourceSettingsConfig> _settings;
public AudioSourcePool(Dictionary<AudioSourceType, AudioSourceSettingsConfig> settings) => _settings = settings;
private string _configsLabel;
private AsyncOperationHandle<IList<AudioSourceSettingsConfig>> _handles;
private AssetReference _sourcePrefabConfigReference;
private AsyncOperationHandle<AudioSourcePrefabConfig> _prefabConfigHandle;
private AsyncOperationHandle<GameObject> _prefabHandle;
private EventBus.EventBus _eventBus;
public AudioSourcePool(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
_eventBus = eventBus;
_configsLabel = configLocator.TryGetManyConfigAssetReferences<AudioSourceSettingsConfig>();
_sourcePrefabConfigReference = configLocator.TryGetConfigAssetReference<AudioSourcePrefabConfig>();
LoadConfigs().Forget();
}
private async UniTaskVoid LoadConfigs()
{
_prefabConfigHandle = Addressables.LoadAssetAsync<AudioSourcePrefabConfig>(_sourcePrefabConfigReference);
_handles = Addressables.LoadAssetsAsync<AudioSourceSettingsConfig>(_configsLabel);
await UniTask.WhenAll(
_prefabConfigHandle.ToUniTask(),
_handles.ToUniTask());
_prefabHandle = Addressables.LoadAssetAsync<GameObject>(_prefabConfigHandle.Result.sourcePrefab);
_settings = _handles.Result.ToDictionary(x => x.sourceType);
await _prefabHandle.ToUniTask();
_pool = new ObjectPool<AudioSource>(
createFunc: CreateItem,
// actionOnGet: OnGet,
actionOnRelease: OnRelease,
actionOnDestroy: OnDestroyItem,
collectionCheck: true, // helps catch double-release mistakes
defaultCapacity: 10,
maxSize: 20
);
_eventBus.RaiseEvent<IAudioSourcePoolInitializedHandle>(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>();
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.resource = null;
//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 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();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 246ae406fabc4ca791673d3f38cfe1c5
timeCreated: 1769448041
@@ -0,0 +1,14 @@
using Code.Infrastructure.Generators;
namespace Code.Infrastructure.Audio
{
[Config("Configs/Audio/AudioSourceSettings", true)]
public class AudioSourceSettings
{
// Дополнять по мере необходимости
[ToConfig] public float spatialBlend;
[ToConfig] public AudioSourceType sourceType;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 76d9dd39cbe641dab0cfa8ed1f2007f4
timeCreated: 1769448198
@@ -0,0 +1,8 @@
namespace Code.Infrastructure.Audio
{
public enum AudioSourceType
{
Full3D,
NoBlend
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 85f9cb99599f4399a1fd66496b5184d0
timeCreated: 1769448254
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ef0499dec5324e12b82f8688c6d3b3d8
timeCreated: 1765711304
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using Code.Infrastructure.SceneLoader;
using Cysharp.Threading.Tasks;
using Reflex.Core;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.Configs
{
public partial class ConfigLocator : IConfigLocator
{
private Dictionary<Type, AssetReference> _singleConfigReferences = new();
private Dictionary<Type, string> _multipleConfigReferences = new();
public AssetReference TryGetConfigAssetReference<T>() => _singleConfigReferences.GetValueOrDefault(typeof(T), null);
public string TryGetManyConfigAssetReferences<T>() => _multipleConfigReferences.GetValueOrDefault(typeof(T), null);
partial void LoadConfigs();
public ConfigLocator()
{
LoadSystemConfigs();
LoadConfigs();
}
private void LoadSystemConfigs()
{
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 42496064fd5d42fea1c889f91e6a7e98
timeCreated: 1765711330
@@ -0,0 +1,7 @@
namespace Code.Infrastructure.Configs
{
public enum LayerMaskType
{
PlatformerGround
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0aab84d976cf4045b47f347ad8d77c79
timeCreated: 1770907660
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Linq;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Generators;
using Cysharp.Threading.Tasks;
using Reflex.Attributes;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.Configs
{
[Config("Configs/LayerMasksConfig", true)]
public struct LayerMasksConfig
{
[ToConfig] public LayerMask mask;
[ToConfig] public LayerMaskType type;
}
public class LayerMasks
{
public static Dictionary<LayerMaskType, LayerMask> Masks { get; } = new();
private static void SetMasks(IList<LayerMasksConfigConfig> configs)
{
foreach (var config in configs.Where(config => !Masks.ContainsKey(config.type)))
Masks.Add(config.type, config.mask);
}
public LayerMasks(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
SetupMasks(configLocator, eventBus).Forget();
}
private async UniTaskVoid SetupMasks(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
var handle =
Addressables.LoadAssetsAsync<LayerMasksConfigConfig>(
configLocator.TryGetManyConfigAssetReferences<LayerMasksConfigConfig>(), null, Addressables.MergeMode.Union);
await handle.ToUniTask();
SetMasks(handle.Result);
Addressables.Release(handle);
eventBus.RaiseEvent<ILayerMasksInitializedHandle>(x => x.LayerMasksInitialized());
}
}
public interface ILayerMasksInitializedHandle : IGlobalSubscriber
{
void LayerMasksInitialized();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2fe6e42771fc4a48a37acbe4fa992e4a
timeCreated: 1770906616
@@ -0,0 +1,11 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.Configs
{
[CreateAssetMenu(fileName = "SystemConfigsReferences", menuName = "Configs/SystemConfigsReferences")]
public partial class SystemConfigsReferences : ScriptableObject
{
public AssetReference scenesAssetReferences;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 728b0ad306a64bd28d47fc4d052c5e81
timeCreated: 1766325607
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b34014c0c80c914baed6d14ef39dada
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace Code.Infrastructure.EventBus
{
public class EventBus
{
private Dictionary<Type, SubscribersList<IGlobalSubscriber>> s_Subscribers
= new();
public void Subscribe(IGlobalSubscriber subscriber)
{
List<Type> subscriberTypes = EventBusHelper.GetSubscriberTypes(subscriber);
foreach (Type t in subscriberTypes)
{
if (!s_Subscribers.ContainsKey(t))
{
s_Subscribers[t] = new SubscribersList<IGlobalSubscriber>();
}
s_Subscribers[t].Add(subscriber);
}
}
public void Unsubscribe(IGlobalSubscriber subscriber)
{
List<Type> subscriberTypes = EventBusHelper.GetSubscriberTypes(subscriber);
foreach (Type t in subscriberTypes)
{
if (s_Subscribers.ContainsKey(t))
s_Subscribers[t].Remove(subscriber);
}
}
public void RaiseEvent<TSubscriber>(Action<TSubscriber> action)
where TSubscriber : class, IGlobalSubscriber
{
if (!s_Subscribers.ContainsKey(typeof(TSubscriber))) return;
SubscribersList<IGlobalSubscriber> subscribers = s_Subscribers[typeof(TSubscriber)];
subscribers.Executing = true;
InvokeSubscribers(action, subscribers);
subscribers.Executing = false;
subscribers.Cleanup();
}
private void InvokeSubscribers<TSubscriber>(Action<TSubscriber> action, SubscribersList<IGlobalSubscriber> subscribers)
where TSubscriber : class, IGlobalSubscriber
{
for ( int i = 0; i < subscribers.List.Count; i++)
{
IGlobalSubscriber subscriber = subscribers.List[i];
try
{
action.Invoke(subscriber as TSubscriber);
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e);
}
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b0547f2543ccf5e47b9ec486f35aa2df
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Code.Infrastructure.EventBus
{
internal static class EventBusHelper
{
private static Dictionary<Type, List<Type>> s_CashedSubscriberTypes =
new();
public static List<Type> GetSubscriberTypes(
IGlobalSubscriber globalSubscriber)
{
Type type = globalSubscriber.GetType();
if (s_CashedSubscriberTypes.ContainsKey(type))
{
return s_CashedSubscriberTypes[type];
}
List<Type> subscriberTypes = type
.GetInterfaces()
.Where(t => t.GetInterfaces()
.Contains(typeof(IGlobalSubscriber)))
.ToList();
s_CashedSubscriberTypes[type] = subscriberTypes;
return subscriberTypes;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ab2b1bcff76d5614dbda77a3c7b24158
@@ -0,0 +1,5 @@
namespace Code.Infrastructure.EventBus
{
public interface IGlobalSubscriber
{ }
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fe414b0de24841347b03eec77d1855c0
@@ -0,0 +1,46 @@
using System.Collections.Generic;
namespace Code.Infrastructure.EventBus
{
internal class SubscribersList<TSubscriber> where TSubscriber : class
{
private bool m_NeedsCleanUp;
public bool Executing;
public readonly List<TSubscriber> List = new(); // TODO Weakptr
public void Add(TSubscriber subscriber)
{
List.Add(subscriber);
}
public void Remove(TSubscriber subscriber)
{
if (Executing)
{
var i = List.IndexOf(subscriber);
if (i >= 0)
{
m_NeedsCleanUp = true;
List[i] = null;
}
}
else
{
List.Remove(subscriber);
}
}
public void Cleanup()
{
if (!m_NeedsCleanUp)
{
return;
}
List.RemoveAll(s => s == null);
m_NeedsCleanUp = false;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d364e9c8ac1c255428486d5892d23c1d
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 56928494c304465d8dea6fe4bac75de2
timeCreated: 1765563811
@@ -0,0 +1,52 @@
using System;
namespace Code.Infrastructure.Generators
{
public class StateMachine : Attribute
{
public Type StateMachineContextType;
public Type StateMachineEnumType;
public StateMachine(Type stateMachineContextType, Type stateMachineEnumType)
{
StateMachineContextType = stateMachineContextType;
StateMachineEnumType = stateMachineEnumType;
}
}
public class State : Attribute
{
public Type StateEnum;
public Type StateMachineContext;
public bool SilentBitch; // Поэтому нейминг переменных очень важен
public State(Type stateEnum,Type stateMachineContext, bool silentBitch = false)
{
StateEnum = stateEnum;
StateMachineContext = stateMachineContext;
SilentBitch = silentBitch;
}
}
public class StateRaisingEvent : Attribute
{
}
public class Config : Attribute
{
public bool Multiple;
public string MenuName;
public Config(string menuName, bool multiple = false)
{
Multiple = multiple;
MenuName = menuName;
}
}
public class ToConfig : Attribute
{
}
public class SceneIdEnum : Attribute
{
}
public class AudioMixerEnum : Attribute
{
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 03e07712b53c4a3d8f6c8033af003369
timeCreated: 1765563884
@@ -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
@@ -0,0 +1,111 @@
#if UNITY_EDITOR
using System.Linq;
using Unity.VisualScripting;
using UnityCodeGen;
using UnityEditor;
namespace Code.Infrastructure.Generators
{
[Generator]
public class ConfigGenerator : ICodeGenerator
{
public void Execute(GeneratorContext context)
{
var configs = TypeCache.GetTypesWithAttribute<Config>();
var configsCode = "";
var configAddCode = "";
var configReferencesCode = "";
var configReferencesUsingsCode = "";
var configOfConfigsCode = "";
foreach (var cfg in configs)
{
var configFields = "";
var configUsings = "";
var mem = cfg.GetFields();
var members = mem.Where(m => m.HasAttribute<ToConfig>()).ToList();
foreach (var m in members)
{
configUsings += $"using {m.FieldType.Namespace};\n";
configFields += $"public {m.FieldType.FullName} {m.Name};\n";
}
var attribute = cfg.GetAttribute<Config>();
configUsings += @"
using UnityEngine;
using UnityEngine.AddressableAssets;
";
var configCode = $@"
#pragma warning disable CS0105
{configUsings}
namespace {cfg.Namespace}{{
#pragma warning restore CS0105
[CreateAssetMenu(fileName = ""{cfg.Name}Config"", menuName = ""{attribute.MenuName}"")]
public class {cfg.Name}Config : ScriptableObject
{{
{configFields}
}}
}}
";
context.AddCode($"{cfg.Name}Config.Generated.cs", configCode);
configReferencesUsingsCode += $"using {cfg.Namespace};\n";
if (attribute.Multiple)
{
configReferencesCode += $"public string {cfg.Name};\n";
configAddCode += $@"
_multipleConfigReferences.Add(typeof({cfg.FullName}Config), systemConfigsReferences.{cfg.Name});
";
}
else
{
configReferencesCode += $"public AssetReference {cfg.Name};\n";
configAddCode += $@"
_singleConfigReferences.Add(typeof({cfg.FullName}Config), systemConfigsReferences.{cfg.Name});
";
}
}
configsCode += $@"
#pragma warning disable CS0105
{configReferencesUsingsCode}
using UnityEngine;
#pragma warning restore CS0105
namespace Code.Infrastructure.Configs
{{
public partial class ConfigLocator
{{
partial void LoadConfigs()
{{
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>(""SystemConfigsReferences"");
{configAddCode}
//_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
}}
}}
}}
";
context.AddCode($"ConfigLocator.Generated.cs", configsCode);
configOfConfigsCode += $@"
#pragma warning disable CS0105
{configReferencesUsingsCode}
using UnityEngine.AddressableAssets;
#pragma warning restore CS0105
namespace Code.Infrastructure.Configs{{
public partial class SystemConfigsReferences
{{
{configReferencesCode}
}}
}}
";
context.AddCode($"SystemConfigsReferences.Generated.cs", configOfConfigsCode);
}
}
}
#endif
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 026403be8eae4546adcb407308031c1d
timeCreated: 1765660396
@@ -0,0 +1,149 @@
#if UNITY_EDITOR
using UnityCodeGen;
using UnityEditor;
using UnityEngine;
namespace Code.Infrastructure.Generators
{
[Generator]
public class SceneLoaderGenerator : ICodeGenerator
{
public void Execute(GeneratorContext context)
{
var Enum = TypeCache.GetTypesWithAttribute<SceneIdEnum>();
var loaderCode = "";
var dictionaryCode = "";
var interfacesCode = "";
var interfacesUsingsCode = $@"
using Code.Infrastructure.EventBus;
";
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;
interfacesCode += $@"
public interface IOn{member.Name}SceneLoadedHandler : IGlobalSubscriber
{{
void On{member.Name}SceneLoaded();
void On{member.Name}SceneInitialized(Reflex.Core.Container container); // Until its fixed
}}
";
dictionaryCode += $@"
_scenesActions.Add(SceneId.{member.Name},() => _eventBus.RaiseEvent<IOn{member.Name}SceneLoadedHandler>(h=> h.On{member.Name}SceneLoaded()));
";
}
}
loaderCode = $@"
#pragma warning disable CS0105
{interfacesUsingsCode}
#pragma warning restore CS0105
namespace Code.Infrastructure.SceneLoader
{{
public partial class SceneLoader{{
partial void SetupScenesInfo(){{
{dictionaryCode}
}}
}}
{interfacesCode}
}}
";
context.AddCode($"SceneLoader.Generated.cs", loaderCode);
// var configsCode = "";
// var configCode = "";
// var configUsings = "";
// var configFields = "";
// var configAddCode = "";
// var configReferencesCode = "";
// var configReferencesUsingsCode = "";
// var configOfConfigsCode = "";
//
// foreach (var cfg in configs)
// {
// var mem = cfg.GetFields();
// var members = mem.Where(m => m.HasAttribute<ToConfig>()).ToList();
// foreach (var m in members)
// {
// configUsings += $"using {m.FieldType.Namespace};\n";
// configFields += $"public {m.FieldType.FullName} {m.Name};\n";
// }
//
// var attribute = cfg.GetAttribute<Config>();
//
// configUsings += @"
// using UnityEngine;
// using UnityEngine.AddressableAssets;
// ";
// configCode = $@"
// {configUsings}
// namespace {cfg.Namespace}{{
// [CreateAssetMenu(fileName = ""{cfg.Name}Config"", menuName = ""{attribute.MenuName}"")]
// public class {cfg.Name}Config : ScriptableObject
// {{
// {configFields}
// }}
// }}
// ";
// context.AddCode($"{cfg.Name}Config.Generated.cs", configCode);
//
// configReferencesUsingsCode += $"using {cfg.Namespace};\n";
//
// if (attribute.Multiple)
// {
// configReferencesCode += $"public String {cfg.Name};\n";
// configAddCode += $@"
// _multipleConfigReferences.Add(typeof({cfg.FullName}), systemConfigsReferences.{cfg.Name});
// ";
// }
// else
// {
// configReferencesCode += $"public AssetReference {cfg.Name};\n";
// configAddCode += $@"
// _singleConfigReferences.Add(typeof({cfg.FullName}Config), systemConfigsReferences.{cfg.Name});
// ";
// }
// }
// configsCode += $@"
// {configReferencesUsingsCode}
// using UnityEngine;
//
// namespace Code.Infrastructure.Configs
// {{
//
// public partial class ConfigLocator
// {{
// partial void LoadConfigs()
// {{
// SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>(""SystemConfigsReferences"");
// {configAddCode}
// //_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
// }}
// }}
// }}
// ";
// context.AddCode($"ConfigLocator.Generated.cs", configsCode);
//
// configOfConfigsCode += $@"
// {configReferencesUsingsCode}
// using UnityEngine.AddressableAssets;
//
// namespace Code.Infrastructure.Configs{{
// public partial class SystemConfigsReferences
// {{
// {configReferencesCode}
// }}
// }}
// ";
// context.AddCode($"SystemConfigsReferences.Generated.cs", configOfConfigsCode);
}
}
}
#endif
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 92ec56ffd46d4a569bb9a7d436790439
timeCreated: 1766423754
@@ -0,0 +1,133 @@
#if UNITY_EDITOR
using System.Linq;
using Unity.VisualScripting;
using UnityCodeGen;
using UnityEditor;
namespace Code.Infrastructure.Generators
{
[Generator]
public class StateMachineGenerator : ICodeGenerator
{
public void Execute(GeneratorContext context)
{
GenerateStates(context);
GenerateStateMachine(context);
}
private void GenerateStateMachine(GeneratorContext context)
{
var stateMachines = TypeCache.GetTypesWithAttribute<StateMachine>();
foreach (var sm in stateMachines)
{
var attribute = sm.GetAttribute<StateMachine>();
var states = TypeCache.GetTypesWithAttribute<State>()
.Where(st =>
st.GetAttribute<State>().StateMachineContext.FullName ==
attribute.StateMachineContextType.FullName);
var statesCode = "";
var statesNamespacesCode = "";
foreach (var st in states)
{
statesNamespacesCode += $@"
using {st.Namespace};
";
statesCode += $@"
var state{st.Name} = new {st.Name}(StateMachineContext,eventBus);
States.Add(state{st.Name}.myState, state{st.Name});
";
}
var stateMachineCode =
$@"
// <auto-generated/>
#pragma warning disable CS0105
using Code.Infrastructure.StateMachine;
{statesNamespacesCode}
#pragma warning restore CS0105
namespace {sm.Namespace}
{{
public partial class {sm.Name} : AbstractStateMachine<{attribute.StateMachineEnumType.FullName},{attribute.StateMachineContextType.FullName}>
{{
public {sm.Name}({attribute.StateMachineContextType.FullName} context, EventBus.EventBus eventBus) : base(context)
{{
{statesCode}
}}
protected override bool CheckTransitionAllowed({attribute.StateMachineEnumType.FullName} nextState) => AllowedStates.HasFlag(nextState);
protected override void ResetAllowedTransitions() => AllowedStates = 0;
}}
public static class {sm.Name}Extensions
{{
public static AbstractStateMachine<{attribute.StateMachineEnumType.FullName}, {attribute.StateMachineContextType.FullName}> AllowStateTransition(
this AbstractStateMachine<{attribute.StateMachineEnumType.FullName}, {attribute.StateMachineContextType.FullName}> stateMachine, {attribute.StateMachineEnumType.FullName} state)
{{
if (stateMachine == null) return null;
stateMachine.AllowedStates |= state;
return stateMachine;
}}
}}
}}
";
context.AddCode($"{sm.FullName}.Generated.cs", stateMachineCode);
}
}
private void GenerateStates(GeneratorContext context)
{
var states = TypeCache.GetTypesWithAttribute<State>();
var statesCode = "";
foreach (var st in states)
{
var attribute = st.GetAttribute<State>();
var fireStatesCode = "";
if(st.HasAttribute<StateRaisingEvent>()) fireStatesCode = $@"
protected override void _fireEnterState()
{{
EventBus.RaiseEvent<IEnterStateHandle<{st.FullName}>>(h => h.EnterState());
}}
protected override void _fireExitState()
{{
EventBus.RaiseEvent<IExitStateHandle<{st.FullName}>>(h => h.ExitState());
}}
";
var genetics = "";
if(!attribute.SilentBitch) genetics = $@" : BaseState<{attribute.StateEnum.FullName}, {attribute.StateMachineContext.FullName}>";
statesCode = $@"
// retard-generated
using Code.Infrastructure.StateMachine;
namespace {st.Namespace}
{{
public partial class {st.Name} {genetics}
{{
{fireStatesCode}
}}
}}
";
context.AddCode($"{st.FullName}.Generated.cs", statesCode);
}
}
}
}
#endif
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9fb4b6961cd0471d8183511316c15000
timeCreated: 1765563824
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 629db0b5c4ac4624b5bde7022e167b3b
timeCreated: 1766612368
@@ -0,0 +1,24 @@
namespace Code.Infrastructure.Input
{
public enum ActionMappings
{
MainMenu,
Gameplay,
Debug
}
public enum GameplayActions
{
Move,
Brake,
}
public enum DebugActions
{
Debug1,
Debug2,
Debug3,
Debug4,
Debug5,
Debug6,
Debug7
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: dc62fec94fde411ab1420155a5087d64
timeCreated: 1766613550
@@ -0,0 +1,15 @@
using System;
using UnityEngine.InputSystem;
namespace Code.Infrastructure.Input
{
public interface IInputService
{
void EnableMap(ActionMappings actionMap);
void DisableMap(ActionMappings actionMap);
void BindActionPerformed(int mapId, int actionId, Action<InputAction.CallbackContext> action);
void BindActionCancelled(int mapId, int actionId, Action<InputAction.CallbackContext> action);
void UnbindActionPerformed(int mapId, int actionId, Action<InputAction.CallbackContext> action);
void UnbindActionCancelled(int mapId, int actionId, Action<InputAction.CallbackContext> action);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9443ed0c0d76423f8ecebbd9398bacf3
timeCreated: 1766614201
@@ -0,0 +1,62 @@
using System;
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Generators;
using Cysharp.Threading.Tasks;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace Code.Infrastructure.Input
{
[Config("Configs/InputService")]
public class InputService : IInputService
{
[ToConfig] public InputActionAsset inputActionAsset;
private EventBus.EventBus _eventBus;
public InputService(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
_eventBus = eventBus;
LoadConfigs(configLocator.TryGetConfigAssetReference<InputServiceConfig>()).Forget();
}
private AsyncOperationHandle<InputServiceConfig> _configHandle;
private async UniTaskVoid LoadConfigs(AssetReference configReference)
{
_configHandle = Addressables.LoadAssetAsync<InputServiceConfig>(configReference);
await _configHandle.ToUniTask();
inputActionAsset = _configHandle.Result.inputActionAsset;
// inputActionAsset.actionMaps[(int)ActionMappings.Debug].Enable();
// inputActionAsset.actionMaps[(int)ActionMappings.Gameplay].Enable();
_eventBus.RaiseEvent<IInputServiceInitializedHandle>(h => h.InputServiceInitialized());
}
public void EnableMap(ActionMappings actionMap) => inputActionAsset.actionMaps[(int)actionMap].Enable();
public void DisableMap(ActionMappings actionMap) => inputActionAsset.actionMaps[(int)actionMap].Disable();
public void BindActionPerformed(int mapId, int actionId, Action<InputAction.CallbackContext> action) => inputActionAsset
.actionMaps[mapId].actions[actionId].performed += action;
public void BindActionCancelled(int mapId, int actionId, Action<InputAction.CallbackContext> action) => inputActionAsset
.actionMaps[mapId].actions[actionId].canceled += action;
public void UnbindActionPerformed(int mapId, int actionId, Action<InputAction.CallbackContext> action) =>
inputActionAsset
.actionMaps[mapId].actions[actionId].performed -= action;
public void UnbindActionCancelled(int mapId, int actionId, Action<InputAction.CallbackContext> action) =>
inputActionAsset
.actionMaps[mapId].actions[actionId].canceled -= action;
}
public interface IInputServiceInitializedHandle : IGlobalSubscriber
{
void InputServiceInitialized();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2755e684d68a4f79994f0f92e8327a73
timeCreated: 1766612399
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d78dfc7c05e54743bfa99dfeaa7dc064
timeCreated: 1766483099
@@ -0,0 +1,36 @@
using System;
using UnityEngine;
namespace Code.Infrastructure.Loadings
{
public class Loading
{
private int _progress;
public bool Completed { get; private set; }
private Action _completed;
private Action<Loading> _loadProgress;
public Loading(int maxProgress, Action completed, Action<Loading> loadProgress = null)
{
_progress = maxProgress;
MaxProgress = maxProgress;
_completed = completed;
_loadProgress = loadProgress;
}
public int CurrentProgress => _progress;
public int MaxProgress { get; }
public void DoProgress()
{
_progress--;
_loadProgress?.Invoke(this);
if(_progress <= 0) // Зачем инвертировать, если так читается лучше, райдер соси
{
Completed = true;
_completed();
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a1707a55b78d4218b1557d42adb7d961
timeCreated: 1766483205
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b7568293a2874477b2faeb918157ca94
timeCreated: 1766325345
@@ -0,0 +1,13 @@
using Code.Infrastructure.Generators;
namespace Code.Infrastructure.SceneLoader
{
[SceneIdEnum]
public enum SceneId
{
MainMenu,
Gameplay,
SoundTest,
Platformer
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: af1da0e870d542f2a864d7ddbbe9fb4c
timeCreated: 1766396924
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Generators;
using Cysharp.Threading.Tasks;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
namespace Code.Infrastructure.SceneLoader
{
[Config("Configs/SceneConfig",true)]
public class SceneInfo
{
[ToConfig] public AssetReference SceneAsset;
[ToConfig] public SceneId SceneId;
}
public partial class SceneLoader : IDisposable
{
private Dictionary<SceneId, SceneInfo> _sceneInfos = new();
private Dictionary<SceneId, Action> _scenesActions = new();
private EventBus.EventBus _eventBus;
partial void SetupScenesInfo();
private AsyncOperationHandle<IList<SceneInfoConfig>> _loadHandle;
public SceneLoader(EventBus.EventBus eventBus, IConfigLocator configLocator)
{
_eventBus = eventBus;
LoadConfigs(configLocator.TryGetManyConfigAssetReferences<SceneInfoConfig>()).Forget();
}
// TODO типилище
public async UniTaskVoid LoadSceneAsync(SceneId id, LoadSceneMode loadMode)
{
if (loadMode == LoadSceneMode.Single)
for (var i = 0; i < _loadedScenes.Count; i++)
UnloadSceneAsync(_loadedScenes.Keys.ToList()[i]).Forget();
_loadedScenes.Add(id,Addressables.LoadSceneAsync(_sceneInfos[id].SceneAsset, loadMode));
await _loadedScenes[id];
_scenesActions[id]();
}
private Dictionary<SceneId, AsyncOperationHandle<SceneInstance>> _loadedScenes = new();
public Scene GetScene(SceneId id) => _loadedScenes[id].Result.Scene;
public async UniTaskVoid UnloadSceneAsync(SceneId id)
{
await Addressables.UnloadSceneAsync(_loadedScenes[id]);
_loadedScenes.Remove(id);
}
private AsyncOperationHandle<IList<SceneInfoConfig>> _configHandle;
private async UniTaskVoid LoadConfigs(string configReferences)
{
_configHandle = Addressables.LoadAssetsAsync<SceneInfoConfig>(configReferences, OnSceneConfigLoaded, Addressables.MergeMode.Union);
await _configHandle.ToUniTask();
SetupScenesInfo();
_eventBus.RaiseEvent<ISceneConfigsLoadedHandle>(h => h.SceneConfigsLoaded());
}
private void OnSceneConfigLoaded(SceneInfoConfig sceneInfoConfig)
{
SceneInfo sceneInfo = new();
sceneInfo.SceneId = sceneInfoConfig.SceneId;
sceneInfo.SceneAsset = sceneInfoConfig.SceneAsset;
_sceneInfos.Add(sceneInfoConfig.SceneId, sceneInfo);
}
public void Dispose()
{
Addressables.Release(_configHandle);
}
}
public interface ISceneConfigsLoadedHandle : IGlobalSubscriber
{
void SceneConfigsLoaded();
}
public interface ILoadedSceneHandle : IGlobalSubscriber
{
void SceneLoaded(SceneId sceneId);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 760817ac86164799ac58327509052257
timeCreated: 1766325358
@@ -0,0 +1,11 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.SceneLoader
{
[CreateAssetMenu(fileName = "ScenesAssetReferences", menuName = "Configs/ScenesAssetReferences")]
public class ScenesAssetReferences : ScriptableObject
{
public AssetReference gameplaySceneReference;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9759979f397044a5bcb03ded0d1c9561
timeCreated: 1766325404
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f1c4dc7e83794f978e68900a1be81bc2
timeCreated: 1765563491
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using Code.Infrastructure.EventBus;
namespace Code.Infrastructure.StateMachine
{
public abstract class AbstractStateMachine<TStateEnum, TStateMachineContext>
where TStateMachineContext : new()
{
protected AbstractStateMachine(TStateMachineContext stateMachineContext )
{
StateMachineContext = stateMachineContext;
}
public TStateEnum CurrentState { get; protected set; }
public BaseState<TStateEnum, TStateMachineContext> CurrentBaseState { get; private set; }
private BaseState<TStateEnum, TStateMachineContext> _previousBaseState;
protected Dictionary<TStateEnum, BaseState<TStateEnum, TStateMachineContext>> States = new();
protected Dictionary<TStateEnum, Type> StatesTypes = new();
public TStateEnum AllowedStates { get; set; }
protected TStateMachineContext StateMachineContext { get; }
// Костыли 2 шт. для флагового енама в шаблонах
protected abstract bool CheckTransitionAllowed(TStateEnum nextState);
protected abstract void ResetAllowedTransitions();
// TODO Если в EnterState вызывается ExitState, то будет гарантированная поломка
public AbstractStateMachine<TStateEnum, TStateMachineContext> SwitchState(TStateEnum nextState)
{
if (!CheckTransitionAllowed(nextState) && CurrentBaseState != null)
{
return null;
}
ResetAllowedTransitions();
_previousBaseState = CurrentBaseState;
CurrentBaseState = States[nextState];
_previousBaseState?.ExitState();
CurrentBaseState.EnterState();
CurrentState = nextState;
return this;
}
}
public interface IEnterStateHandle<TState> : IGlobalSubscriber
{
void EnterState();
}
public interface IExitStateHandle<TState> : IGlobalSubscriber
{
void ExitState();
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8f6ce15c93464753a99851fc5d46440f
timeCreated: 1765563731
@@ -0,0 +1,37 @@
namespace Code.Infrastructure.StateMachine
{
public abstract class BaseState<TEnum, TStateMachineContext>
{
public abstract TEnum myState { get; }
protected BaseState(TStateMachineContext context, EventBus.EventBus eventBus)
{
Context = context;
EventBus = eventBus;
}
protected EventBus.EventBus EventBus;
protected TStateMachineContext Context { get; }
protected virtual void _fireEnterState()
{
}
protected virtual void _fireExitState()
{
}
protected abstract void OnEnterState();
protected abstract void OnExitState();
public void EnterState()
{
OnEnterState();
_fireEnterState();
}
public void ExitState()
{
OnExitState();
_fireExitState();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0c348c251b644c3c941d2bd91bbb290c
timeCreated: 1765563748
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f00c637597e248c9b6df168e80ab4ea2
timeCreated: 1768978928
@@ -0,0 +1,94 @@
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.UI
{
public interface IUIFactory
{
UniTaskVoid LoadPanel(UIPanelType panelType);
void ReleasePanel(UIPanel panel);
Canvas Canvas { get; }
}
public class UIFactory : IDisposable, IUIFactory
{
private Dictionary<UIPanelType, UIPanelSettingsConfig> _configs;
private AssetReference _canvasConfigReference;
private string _configsLabel;
private EventBus.EventBus _eventBus;
private AsyncOperationHandle<IList<UIPanelSettingsConfig>> _configsHandle;
private AsyncOperationHandle<CanvasSettingsConfig> _canvasSettingsHandle;
private CanvasSettingsConfig _canvasConfig;
private GameObject _canvas;
public Canvas Canvas { get; private set; }
public UIFactory(IConfigLocator configLocator, EventBus.EventBus eventBus)
{
_eventBus = eventBus;
_configsLabel = configLocator.TryGetManyConfigAssetReferences<UIPanelSettingsConfig>();
_canvasConfigReference = configLocator.TryGetConfigAssetReference<CanvasSettingsConfig>();
LoadConfigs().Forget();
}
public async UniTaskVoid LoadPanel(UIPanelType panelType)
{
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, _canvas.transform).ToUniTask())
.GetComponent<UIPanel>();
UnityEngine.Debug.LogWarning($"Panel loaded {panelType}");
_eventBus.RaiseEvent<IUIPanelLoadedHandle>(ui => ui.UIPanelLoaded(panel, panelType));
}
public void ReleasePanel(UIPanel panel)
{
UnityEngine.Debug.LogWarning($"Panel released {panel.gameObject.name}");
Addressables.ReleaseInstance(panel.gameObject);
}
private async UniTaskVoid LoadConfigs()
{
_configsHandle = Addressables.LoadAssetsAsync<UIPanelSettingsConfig>(_configsLabel);
_canvasSettingsHandle = Addressables.LoadAssetAsync<CanvasSettingsConfig>(_canvasConfigReference);
await _configsHandle.ToUniTask();
await _canvasSettingsHandle.ToUniTask();
_canvasConfig = _canvasSettingsHandle.Result;
_configs = _configsHandle.Result.ToDictionary(c => c.UIPanelType);
_canvas = await Addressables.InstantiateAsync(_canvasConfig.Prefab).ToUniTask();
UnityEngine.Object.DontDestroyOnLoad(_canvas);
Canvas = _canvas.GetComponent<Canvas>();
_eventBus.RaiseEvent<IUIInitializedHandle>(ui => ui.UIInitialized());
}
public void Dispose()
{
Addressables.Release(_configsHandle);
Addressables.Release(_canvasSettingsHandle);
Addressables.ReleaseInstance(_canvas);
}
}
public interface IUIInitializedHandle : IGlobalSubscriber
{
void UIInitialized();
}
public interface IUIPanelLoadedHandle : IGlobalSubscriber
{
void UIPanelLoaded(UIPanel panel, UIPanelType panelType);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8447b81247b24f1b869b0067aeeff0b8
timeCreated: 1768979324
+13
View File
@@ -0,0 +1,13 @@
using System;
using UnityEngine;
namespace Code.Infrastructure.UI
{
public abstract class UIPanel : MonoBehaviour
{
[SerializeField] protected bool injectMeSenpai;
public bool InjectMeSenpai => injectMeSenpai;
public abstract void Open(Action callback = null);
public abstract void Close(Action callback = null);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4464e0158e044f5985c45cb73250cf43
timeCreated: 1768980188
@@ -0,0 +1,18 @@
using Code.Infrastructure.Generators;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.UI
{
[Config("Configs/UI/UIPanelSettings", true)]
public class UIPanelSettings
{
[ToConfig] public AssetReference Prefab;
[ToConfig] public UIPanelType UIPanelType;
}
[Config("Configs/UI/CanvasSettings")]
public class CanvasSettings
{
[ToConfig] public AssetReference Prefab;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 996c214bb8624a64b6c563f0c13320ac
timeCreated: 1768979468
@@ -0,0 +1,15 @@
namespace Code.Infrastructure.UI
{
public enum UIPanelType
{
Logo,
Loading,
DebugSceneChooser,
// Race
PlayerScoreCounter,
WinScreen,
PlayerScores,
//
DebugMenu
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e33d3007130a4cbbac8a5e962d5c4806
timeCreated: 1768979170
@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using Code.Infrastructure.EventBus;
using Reflex.Core;
using Reflex.Extensions;
using Reflex.Injectors;
using UnityEngine.SceneManagement;
namespace Code.Infrastructure.UI
{
public interface IUIService
{
void OpenPanel(UIPanelType uiPanelType);
void ClosePanel(UIPanelType uiPanelType);
void TryLoadPanel(UIPanelType uiPanelType);
void TryRemovePanel(UIPanelType uiPanelType);
void SetCanvasCamera(UnityEngine.Camera camera);
UIPanel TryGetPanel(UIPanelType panelType);
}
public class UIService : IUIPanelLoadedHandle, IUIService
{
private Dictionary<UIPanelType, UIPanel> _loadedPanels = new();
private EventBus.EventBus _eventBus;
private IUIFactory _factory;
public UIService(EventBus.EventBus eventBus, IUIFactory factory)
{
_eventBus = eventBus;
_factory = factory;
eventBus.Subscribe(this);
}
public void SetCanvasCamera(UnityEngine.Camera camera)
{
_factory.Canvas.worldCamera = camera;
_factory.Canvas.planeDistance = 0.3f;
}
public void OpenPanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].gameObject.SetActive(true);
_loadedPanels[uiPanelType].Open();
}
// TODO Close event
public void ClosePanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].Close(() => { _loadedPanels[uiPanelType].gameObject.SetActive(false); });
}
public void TryLoadPanel(UIPanelType uiPanelType) => _factory.LoadPanel(uiPanelType);
public void UIPanelLoaded(UIPanel panel, UIPanelType panelType)
{
_loadedPanels.Add(panelType, panel);
if (panel.InjectMeSenpai)
GameObjectInjector.InjectRecursive(panel.gameObject, Container.RootContainer);
// GameObjectInjector.InjectRecursive(panel.gameObject, SceneManager.GetActiveScene().GetSceneContainer()); // Скорее всего будут нужны компоненты текущей сцены
_eventBus.RaiseEvent<IUIPanelLoaded>(ui => ui.UILoaded(panelType));
}
public void TryRemovePanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].Close(() =>
{
_loadedPanels[uiPanelType].gameObject.SetActive(false);
RemovePanel(uiPanelType);
});
}
private void RemovePanel(UIPanelType panelType)
{
_factory.ReleasePanel(_loadedPanels[panelType]);
_loadedPanels.Remove(panelType);
}
public UIPanel TryGetPanel(UIPanelType panelType) => _loadedPanels.GetValueOrDefault(panelType);
}
public interface IUIPanelLoaded : IGlobalSubscriber
{
void UILoaded(UIPanelType uiPanelType);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0bcb777d18014c428f24113d73787e38
timeCreated: 1768980594
+798
View File
@@ -0,0 +1,798 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8186968272690591729
MonoBehaviour:
m_ObjectHideFlags: 3
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: 3eb4b772797da9440885e8bd939e9560, type: 3}
m_Name: ColorCurves
m_EditorClassIdentifier:
active: 1
master:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
red:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
green:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
blue:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 2
m_Loop: 0
m_ZeroValue: 0
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 1
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
hueVsHue:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 1
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
hueVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 1
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
satVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 0
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
lumVsSat:
m_OverrideState: 1
m_Value:
<length>k__BackingField: 0
m_Loop: 0
m_ZeroValue: 0.5
m_Range: 1
m_Curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &-7645455725216806467
MonoBehaviour:
m_ObjectHideFlags: 3
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: 29fa0085f50d5e54f8144f766051a691, type: 3}
m_Name: FilmGrain
m_EditorClassIdentifier:
active: 1
type:
m_OverrideState: 1
m_Value: 0
intensity:
m_OverrideState: 1
m_Value: 0
response:
m_OverrideState: 1
m_Value: 0.8
texture:
m_OverrideState: 1
m_Value: {fileID: 0}
--- !u!114 &-6951754464447674219
MonoBehaviour:
m_ObjectHideFlags: 3
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: 558a8e2b6826cf840aae193990ba9f2e, type: 3}
m_Name: ShadowsMidtonesHighlights
m_EditorClassIdentifier:
active: 1
shadows:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
midtones:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
highlights:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
shadowsStart:
m_OverrideState: 1
m_Value: 0
shadowsEnd:
m_OverrideState: 1
m_Value: 0.3
highlightsStart:
m_OverrideState: 1
m_Value: 0.55
highlightsEnd:
m_OverrideState: 1
m_Value: 1
--- !u!114 &-4210620904635426390
MonoBehaviour:
m_ObjectHideFlags: 3
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: cdfbdbb87d3286943a057f7791b43141, type: 3}
m_Name: ChannelMixer
m_EditorClassIdentifier:
active: 1
redOutRedIn:
m_OverrideState: 1
m_Value: 100
redOutGreenIn:
m_OverrideState: 1
m_Value: 0
redOutBlueIn:
m_OverrideState: 1
m_Value: 0
greenOutRedIn:
m_OverrideState: 1
m_Value: 0
greenOutGreenIn:
m_OverrideState: 1
m_Value: 100
greenOutBlueIn:
m_OverrideState: 1
m_Value: 0
blueOutRedIn:
m_OverrideState: 1
m_Value: 0
blueOutGreenIn:
m_OverrideState: 1
m_Value: 0
blueOutBlueIn:
m_OverrideState: 1
m_Value: 100
--- !u!114 &-3978695733392391637
MonoBehaviour:
m_ObjectHideFlags: 3
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: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.9
intensity:
m_OverrideState: 1
m_Value: 0
scatter:
m_OverrideState: 1
m_Value: 0.7
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 0
filter:
m_OverrideState: 1
m_Value: 0
downscale:
m_OverrideState: 1
m_Value: 0
maxIterations:
m_OverrideState: 1
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-3757877592200609216
MonoBehaviour:
m_ObjectHideFlags: 3
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: 70afe9e12c7a7ed47911bb608a23a8ff, type: 3}
m_Name: SplitToning
m_EditorClassIdentifier:
active: 1
shadows:
m_OverrideState: 1
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
highlights:
m_OverrideState: 1
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
balance:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-3386560400091697801
MonoBehaviour:
m_ObjectHideFlags: 3
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: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 10
aperture:
m_OverrideState: 1
m_Value: 5.6
focalLength:
m_OverrideState: 1
m_Value: 50
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-1083910812058648046
MonoBehaviour:
m_ObjectHideFlags: 3
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: 6bd486065ce11414fa40e631affc4900, type: 3}
m_Name: ProbeVolumesOptions
m_EditorClassIdentifier:
active: 1
normalBias:
m_OverrideState: 1
m_Value: 0.05
viewBias:
m_OverrideState: 1
m_Value: 0.1
scaleBiasWithMinProbeDistance:
m_OverrideState: 1
m_Value: 0
samplingNoise:
m_OverrideState: 1
m_Value: 0.1
animateSamplingNoise:
m_OverrideState: 1
m_Value: 1
leakReductionMode:
m_OverrideState: 1
m_Value: 2
minValidDotProductValue:
m_OverrideState: 1
m_Value: 0.1
occlusionOnlyReflectionNormalization:
m_OverrideState: 1
m_Value: 1
intensityMultiplier:
m_OverrideState: 1
m_Value: 1
skyOcclusionIntensityMultiplier:
m_OverrideState: 1
m_Value: 1
worldOffset:
m_OverrideState: 1
m_Value: {x: 0, y: 0, z: 0}
--- !u!114 &-277880470225475626
MonoBehaviour:
m_ObjectHideFlags: 3
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: ccf1aba9553839d41ae37dd52e9ebcce, type: 3}
m_Name: MotionBlur
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
quality:
m_OverrideState: 1
m_Value: 0
intensity:
m_OverrideState: 1
m_Value: 0
clamp:
m_OverrideState: 1
m_Value: 0.05
--- !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: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: DefaultVolumeProfile
m_EditorClassIdentifier:
components:
- {fileID: 1247868777620691934}
- {fileID: -277880470225475626}
- {fileID: 2338690907228448291}
- {fileID: 2335868966179733374}
- {fileID: 3460444317416099510}
- {fileID: 7933203426823181213}
- {fileID: 5762530381802164056}
- {fileID: -3386560400091697801}
- {fileID: 156332030701414761}
- {fileID: 9099548931283147545}
- {fileID: -3757877592200609216}
- {fileID: 2332282131777942337}
- {fileID: -4210620904635426390}
- {fileID: -6951754464447674219}
- {fileID: 8549655192814258499}
- {fileID: -7645455725216806467}
- {fileID: -8186968272690591729}
- {fileID: -3978695733392391637}
- {fileID: -1083910812058648046}
--- !u!114 &156332030701414761
MonoBehaviour:
m_ObjectHideFlags: 3
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: 5485954d14dfb9a4c8ead8edb0ded5b1, type: 3}
m_Name: LiftGammaGain
m_EditorClassIdentifier:
active: 1
lift:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
gamma:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
gain:
m_OverrideState: 1
m_Value: {x: 1, y: 1, z: 1, w: 0}
--- !u!114 &1247868777620691934
MonoBehaviour:
m_ObjectHideFlags: 3
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: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 1
m_Value: 2
acesPreset:
m_OverrideState: 1
m_Value: 3
hueShiftAmount:
m_OverrideState: 1
m_Value: 0
detectPaperWhite:
m_OverrideState: 1
m_Value: 0
paperWhite:
m_OverrideState: 1
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 1
m_Value: 1
minNits:
m_OverrideState: 1
m_Value: 0.005
maxNits:
m_OverrideState: 1
m_Value: 1000
--- !u!114 &2332282131777942337
MonoBehaviour:
m_ObjectHideFlags: 3
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: e021b4c809a781e468c2988c016ebbea, type: 3}
m_Name: ColorLookup
m_EditorClassIdentifier:
active: 1
texture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
contribution:
m_OverrideState: 1
m_Value: 0
--- !u!114 &2335868966179733374
MonoBehaviour:
m_ObjectHideFlags: 3
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: c5e1dc532bcb41949b58bc4f2abfbb7e, type: 3}
m_Name: LensDistortion
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
xMultiplier:
m_OverrideState: 1
m_Value: 1
yMultiplier:
m_OverrideState: 1
m_Value: 1
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
scale:
m_OverrideState: 1
m_Value: 1
--- !u!114 &2338690907228448291
MonoBehaviour:
m_ObjectHideFlags: 3
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: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 0
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &3460444317416099510
MonoBehaviour:
m_ObjectHideFlags: 3
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: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &5762530381802164056
MonoBehaviour:
m_ObjectHideFlags: 3
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: 06437c1ff663d574d9447842ba0a72e4, type: 3}
m_Name: ScreenSpaceLensFlare
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0
tintColor:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
bloomMip:
m_OverrideState: 1
m_Value: 1
firstFlareIntensity:
m_OverrideState: 1
m_Value: 1
secondaryFlareIntensity:
m_OverrideState: 1
m_Value: 1
warpedFlareIntensity:
m_OverrideState: 1
m_Value: 1
warpedFlareScale:
m_OverrideState: 1
m_Value: {x: 1, y: 1}
samples:
m_OverrideState: 1
m_Value: 1
sampleDimmer:
m_OverrideState: 1
m_Value: 0.5
vignetteEffect:
m_OverrideState: 1
m_Value: 1
startingPosition:
m_OverrideState: 1
m_Value: 1.25
scale:
m_OverrideState: 1
m_Value: 1.5
streaksIntensity:
m_OverrideState: 1
m_Value: 0
streaksLength:
m_OverrideState: 1
m_Value: 0.5
streaksOrientation:
m_OverrideState: 1
m_Value: 0
streaksThreshold:
m_OverrideState: 1
m_Value: 0.25
resolution:
m_OverrideState: 1
m_Value: 4
chromaticAbberationIntensity:
m_OverrideState: 1
m_Value: 0.5
--- !u!114 &7933203426823181213
MonoBehaviour:
m_ObjectHideFlags: 3
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: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0
contrast:
m_OverrideState: 1
m_Value: 0
colorFilter:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 1
m_Value: 0
saturation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &8549655192814258499
MonoBehaviour:
m_ObjectHideFlags: 3
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: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0
smoothness:
m_OverrideState: 1
m_Value: 0.2
rounded:
m_OverrideState: 1
m_Value: 0
--- !u!114 &9099548931283147545
MonoBehaviour:
m_ObjectHideFlags: 3
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: fb60a22f311433c4c962b888d1393f88, type: 3}
m_Name: PaniniProjection
m_EditorClassIdentifier:
active: 1
distance:
m_OverrideState: 1
m_Value: 0
cropToFit:
m_OverrideState: 1
m_Value: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3f9215ea0144899419cfbc0957140d3f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 2bcd2660ca9b64942af0de543d8d7100
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 0
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aede24c794a9a64168ef45392c38c9cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: da2e19a1c5f8b4e2ca7c1785ea338b2e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
%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: 118450fad714b420684eb5f984268b5c, type: 3}
m_Name: PrimeTweenInstaller
m_EditorClassIdentifier:
demoScene: {fileID: 102900000, guid: 13170347bc506405f88d3a87bd0982b3, type: 3}
demoSceneUrp: {fileID: 102900000, guid: 15054139658a5445689224c71f805b10, type: 3}
demoScenePro: {fileID: 102900000, guid: e8086c8f95dba534ca9bf16d3ce9ef31, type: 3}
demoSceneProUrp: {fileID: 102900000, guid: 2992e8ebf85ed47489b777c4d27b9952, type: 3}
uninstallButtonColor: {r: 1, g: 0.23113209, b: 0.2762581, a: 1}
@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: aafeeef745bb4406db1b2cd166853022
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 252960
packageName: "PrimeTween \xB7 High-Performance Animations and Sequences"
packageVersion: 1.3.7
assetPath: Assets/Plugins/PrimeTween/PrimeTweenInstaller.asset
uploadId: 860556
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f164d11d6323e46b786f187ecd84eb1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
{
"name": "PrimeTween.Installer",
"rootNamespace": "",
"references": [
"PrimeTween.Runtime"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.kyrylokuzyk.primetween",
"expression": "1.0.0",
"define": "PRIME_TWEEN_INSTALLED"
},
{
"name": "com.kyrylokuzyk.primetween",
"expression": "[1.3.6-pro]",
"define": "PRIME_TWEEN_PRO"
}
],
"noEngineReferences": false
}
@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 090d70c1ebac0421985bd70fa7f561ef
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 252960
packageName: "PrimeTween \xB7 High-Performance Animations and Sequences"
packageVersion: 1.3.7
assetPath: Assets/Plugins/PrimeTween/internal/PrimeTween.Installer.asmdef
uploadId: 860556
Loaded 100 of 207 files, more files were not shown because too many files have changed in this diff. Show more