feat: add channel enable/disable, prefab docs, and UI updates

Add per-channel enable/disable toggle to the in-game logging system
with Enable()/Disable() on InGameLogger and EnableChannel/DisableChannel
on IGameLogStore. Update README with prefab setup guide and enable/disable
documentation. Update character creation and log container prefabs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sebastian Bularca
2026-04-05 14:37:51 +02:00
parent fa15608f3a
commit 31951cfbf8
13 changed files with 597 additions and 230 deletions

View File

@@ -5,6 +5,7 @@ using UnityEngine;
namespace Jovian.InGameLogging {
public sealed class GameLogStore : IGameLogStore {
readonly LogEntry[] buffer;
readonly HashSet<LogChannel> disabledChannels = new();
int head;
int count;
@@ -21,6 +22,9 @@ namespace Jovian.InGameLogging {
}
public void Add(LogChannel channel, string message) {
if(disabledChannels.Contains(channel)) {
return;
}
var entry = new LogEntry(message, channel, Time.time);
buffer[head] = entry;
head = (head + 1) % buffer.Length;
@@ -30,6 +34,18 @@ namespace Jovian.InGameLogging {
OnEntryAdded?.Invoke(entry);
}
public void EnableChannel(LogChannel channel) {
disabledChannels.Remove(channel);
}
public void DisableChannel(LogChannel channel) {
disabledChannels.Add(channel);
}
public bool IsChannelEnabled(LogChannel channel) {
return !disabledChannels.Contains(channel);
}
public void Clear() {
head = 0;
count = 0;

View File

@@ -7,6 +7,9 @@ namespace Jovian.InGameLogging {
int Capacity { get; }
void Add(LogChannel channel, string message);
void EnableChannel(LogChannel channel);
void DisableChannel(LogChannel channel);
bool IsChannelEnabled(LogChannel channel);
void Clear();
void Clear(LogChannel channel);

View File

@@ -19,5 +19,17 @@ namespace Jovian.InGameLogging {
public void Log(string message, string hexColor) {
store.Add(channel, $"<color={hexColor}>{message}</color>");
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enable() {
store.EnableChannel(channel);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Disable() {
store.DisableChannel(channel);
}
public bool IsEnabled => store.IsChannelEnabled(channel);
}
}

View File

@@ -4,7 +4,7 @@ using UnityEngine;
namespace Jovian.InGameLogging {
[Serializable]
public readonly struct LogChannel : IEquatable<LogChannel> {
[SerializeField] readonly string id;
private readonly string id;
public string Id => id;