forked from Shardstone/trail-into-darkness
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>
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System.Runtime.CompilerServices;
|
|
|
|
namespace Jovian.InGameLogging {
|
|
public readonly struct InGameLogger {
|
|
readonly IGameLogStore store;
|
|
readonly LogChannel channel;
|
|
|
|
public InGameLogger(IGameLogStore store, LogChannel channel) {
|
|
this.store = store;
|
|
this.channel = channel;
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Log(string message) {
|
|
store.Add(channel, message);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
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);
|
|
}
|
|
}
|