- 组合式单位与数值基础重构: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
75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
|
||
namespace Models;
|
||
|
||
/// <summary>
|
||
/// 学生数据模型 (StudentModel)
|
||
/// 设计说明:
|
||
/// 1) 不再继承 UnitModel,而是通过 Core 组合通用组件(属性/状态/标签/装备等)。
|
||
/// 2) 学生特有内容(年级/体力/忠诚/署名贡献)放在独立组件中,保持高内聚。
|
||
/// 3) Model 层仅负责数据,不做 Godot 行为调用,方便后续存档与 Mod 注入。
|
||
/// 注意事项:
|
||
/// - Traits 实际上是标签(Tag),统一走 Core.Tags.TraitIds,避免双份真相。
|
||
/// - Grade 仅表示“学年进度”,不是学术能力值。
|
||
/// 未来扩展:
|
||
/// - 可新增“毕业/退学事件队列”,由系统层驱动。
|
||
/// - 可新增“论文署名历史”用于复盘与羁绊叠层回溯。
|
||
/// </summary>
|
||
public sealed class StudentModel
|
||
{
|
||
public enum StudentType
|
||
{
|
||
MasterCandidate,
|
||
DoctorCandidate
|
||
}
|
||
|
||
public UnitModel Core { get; }
|
||
public StudentType Type { get; private set; }
|
||
public StudentProgress Progress { get; }
|
||
public StudentContributions Contributions { get; }
|
||
|
||
public string Name
|
||
{
|
||
get => Core.Name;
|
||
set => Core.Name = value;
|
||
}
|
||
|
||
public List<string> Traits => Core.Tags.TraitIds;
|
||
|
||
public StudentModel(string name, Random random = null)
|
||
{
|
||
var rng = random ?? Random.Shared;
|
||
Core = new UnitModel(name, rng);
|
||
Type = rng.Next(2) == 0 ? StudentType.MasterCandidate : StudentType.DoctorCandidate;
|
||
Progress = new StudentProgress(Type);
|
||
Contributions = new StudentContributions();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 学生进度组件(只关心学生生命周期)
|
||
/// </summary>
|
||
public sealed class StudentProgress
|
||
{
|
||
public StatusValue Stamina { get; set; }
|
||
public StatusValue Loyalty { get; set; }
|
||
public PropertyValue Grade { get; set; }
|
||
|
||
public StudentProgress(StudentModel.StudentType type)
|
||
{
|
||
Stamina = new StatusValue(100, 100, 0);
|
||
Loyalty = new StatusValue(80, 100, 0);
|
||
var maxGrade = type == StudentModel.StudentType.DoctorCandidate ? 6 : 3;
|
||
Grade = new PropertyValue(0, 0, maxGrade);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 署名贡献记录(任务 -> 贡献值)
|
||
/// </summary>
|
||
public sealed class StudentContributions
|
||
{
|
||
public Dictionary<Guid, PropertyValue> ByTask { get; } = new();
|
||
}
|