- 组合式单位与数值基础重构:scripts/Models/UnitModel.cs, scripts/Models/UnitComponents.cs, scripts/Models/StudentModel.cs, scripts/Models/MentorModel.cs, scripts/Models/StaffModel.cs, scripts/Models/PropertyValue.cs, scripts/Models/StatusValue.cs - 任务与运行时状态骨架:scripts/Models/Task.cs, scripts/Models/TaskDefinitions.cs, scripts/Models/GameState.cs - 配置与规则定义骨架:scripts/Models/DefinitionSupport.cs, scripts/Models/DomainEnums.cs, scripts/Models/Modifiers.cs, scripts/Models/DisciplineDefinitions.cs, scripts/Models/SynergyDefinitions.cs, scripts/Models/ItemDefinitions.cs, scripts/Models/PaperDefinitions.cs, scripts/Models/RogueliteDefinitions.cs, scripts/Models/GameContentDatabase.cs, scripts/Models/CoreIds.cs - MVC/会话/系统/i18n/Mod 支撑:scripts/Core/GameSession.cs, scripts/Core/GameSystems.cs, scripts/Core/GameController.cs, scripts/Core/Mvc.cs, scripts/Core/LocalizationService.cs, scripts/Core/ContentRegistry.cs, scripts/Core/ModManifest.cs, scripts/Core/EventBus.cs - 主控流程衔接:scripts/GameManager.cs
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using Models;
|
|
|
|
namespace Core;
|
|
|
|
/// <summary>
|
|
/// 游戏会话(运行时入口)
|
|
/// 设计说明:
|
|
/// 1) 将 State + Content + Systems + Services 组织为一个整体。
|
|
/// 2) 便于在 Godot Node 中持有,避免散落的静态单例。
|
|
/// 注意事项:
|
|
/// - 真实项目中应通过工厂或依赖注入创建。
|
|
/// 未来扩展:
|
|
/// - 可加入“加载存档/保存存档/重置”接口。
|
|
/// </summary>
|
|
public sealed class GameSession
|
|
{
|
|
public GameState State { get; }
|
|
public GameContentDatabase Content { get; }
|
|
public DomainEventBus Events { get; }
|
|
public ILocalizationService Localization { get; }
|
|
public GameSystems Systems { get; }
|
|
|
|
public GameSession(GameState state, GameContentDatabase content, ILocalizationService localization, DomainEventBus events)
|
|
{
|
|
State = state;
|
|
Content = content;
|
|
Localization = localization;
|
|
Events = events;
|
|
Systems = new GameSystems();
|
|
Systems.Initialize(this);
|
|
}
|
|
|
|
public static GameSession CreateDefault()
|
|
{
|
|
var registry = new ContentRegistry();
|
|
var content = registry.BuildDatabase();
|
|
var localization = new GodotLocalizationService();
|
|
var events = new DomainEventBus();
|
|
return new GameSession(new GameState(), content, localization, events);
|
|
}
|
|
|
|
public void Tick(float delta)
|
|
{
|
|
Systems.Tick(delta);
|
|
}
|
|
}
|
|
|