forked from Shardstone/trail-into-darkness
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user