Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using XWorld.Framework;
|
||||
|
||||
namespace XWorld.Server.Host
|
||||
{
|
||||
public sealed class ConsoleLogger : ILogger
|
||||
{
|
||||
private readonly string _prefix;
|
||||
public ConsoleLogger(string prefix = "") { _prefix = prefix; }
|
||||
public void Info(string message) => Console.WriteLine($"[INFO]{_prefix} {message}");
|
||||
public void Warn(string message) => Console.WriteLine($"[WARN]{_prefix} {message}");
|
||||
public void Error(string message) => Console.WriteLine($"[ERROR]{_prefix} {message}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using XWorld.Framework;
|
||||
|
||||
namespace XWorld.Server.Host
|
||||
{
|
||||
public sealed class InMemoryStorage : IStorage
|
||||
{
|
||||
private readonly Dictionary<string, byte[]> _data = new Dictionary<string, byte[]>();
|
||||
public byte[] Load(string key) => _data.TryGetValue(key, out var v) ? v : null;
|
||||
public void Save(string key, byte[] data) => _data[key] = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using XWorld.Framework;
|
||||
|
||||
namespace XWorld.Server.Host
|
||||
{
|
||||
// 手动推进的时钟;真实运行时改用墙钟实现(子项目 2b/后续)
|
||||
public sealed class ManualClock : ITimer
|
||||
{
|
||||
public float Now { get; private set; }
|
||||
public void Advance(float dt) { Now += dt; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user