riversong code showcase

This commit is contained in:
Daniele Marotta
2026-05-21 15:52:18 +02:00
commit 4c9eea1c02
462 changed files with 23406 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using System;
using Cysharp.Threading.Tasks;
using QFSW.QC;
namespace DanieleMarotta.RiversongCodeShowcase
{
[GameSystemGroup(typeof(DebugSystemGroup))]
public class DebugCommandsSystem : GameSystem, IInitializable, IDisposable
{
[InjectService]
private IUnlocksService _unlocksService;
[InjectService]
private ISignalBus _signalBus;
public DebugCommandsSystem(IServiceLocator serviceLocator) : base(serviceLocator)
{
}
public UniTask InitializeAsync()
{
QuantumRegistry.RegisterObject(this);
return UniTask.CompletedTask;
}
public void Dispose()
{
QuantumRegistry.DeregisterObject(this);
}
[Command("unlock-all", MonoTargetType.Registry)]
private void UnlockAll()
{
_unlocksService.UnlockAll();
}
[Command("complete-demo", MonoTargetType.Registry)]
private void CompleteDemo(float gameTime = 15 * 60)
{
_signalBus.Raise(new DemoCompletedSignal(gameTime));
}
}
}

View File

@@ -0,0 +1,8 @@
namespace DanieleMarotta.RiversongCodeShowcase
{
[InitializeAfter(typeof(UISystemGroup))]
public class DebugSystemGroup : GameSystemGroup
{
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
namespace DanieleMarotta.RiversongCodeShowcase
{
[GameSystemGroup(typeof(DebugSystemGroup))]
public class DrawGizmosSystem : GameSystem, IInitializable, IDisposable
{
[InjectService]
private IEngine _engine;
private DrawGizmosSceneProxy _sceneProxy;
private List<IDrawGizmos> _callbacks = new();
public DrawGizmosSystem(IServiceLocator serviceLocator) : base(serviceLocator)
{
}
public UniTask InitializeAsync()
{
#if DEBUG
_sceneProxy = new GameObject(nameof(DrawGizmosSceneProxy)).AddComponent<DrawGizmosSceneProxy>();
_sceneProxy.DrawGizmos += OnDrawGizmos;
#endif
foreach (var system in _engine.Systems)
if (system is IDrawGizmos callback)
_callbacks.Add(callback);
return UniTask.CompletedTask;
}
public void Dispose()
{
_sceneProxy.DrawGizmos -= OnDrawGizmos;
}
private void OnDrawGizmos(bool selected)
{
foreach (var callback in _callbacks) callback.DrawGizmos(selected);
}
private class DrawGizmosSceneProxy : MonoBehaviour
{
public event Action<bool> DrawGizmos;
private void OnDrawGizmos()
{
DrawGizmos?.Invoke(false);
}
private void OnDrawGizmosSelected()
{
DrawGizmos?.Invoke(true);
}
}
}
}

View File

@@ -0,0 +1,7 @@
namespace DanieleMarotta.RiversongCodeShowcase
{
public interface IDrawGizmos
{
void DrawGizmos(bool selected);
}
}