5 层 UI 规范收敛 SelectRoleForm 的 RawData / Context

围绕规范 §3.2 / §3.4 / §8 整理 SelectRoleForm 的数据传输与展示模型,让两层各自只承担规范允许的职责,并把子组件归位到模块目录内。

RawData层:
- RolePropertyAreaRawData 移除展示串 InitialPropertyText,改为业务字段 StatModifier[] InitialProperties,并补回 RoleId,避免 RawData 携带已格式化的展示文本(违反 §3.2)。
- SelectRoleRawData 拆掉平铺的 RoleIds / RoleIconNames 平行数组与 SelectedRoleId / SelectedRoleName / SelectedRoleInitialProperties 哨兵字段,聚合为 RoleItemRawData[] RoleItems 与 RolePropertyAreaRawData SelectedRole(null 表示未选中),跟 Context 端的子结构形态对称。
- SelectRoleUseCase.BuildModel 同步改造为构造子 RawData,不再处理 -1 哨兵 ID。

Context 层:
- 删除 SelectRoleContext.RoleIds 冗余字段(信息已由 RoleItemContexts[i].RoleId 承载)。
- 新增 bool ShowRoleProperty,把"显示属性卡 vs 显示随机卡"从 RolePropertyAreaContext == null 的隐式哨兵改成显式信号;Form 端 UpdateShowRole 改为读 ShowRoleProperty 切换卡片,不再用 null 当三态信号。
- Controller.BuildContext 用 rawData.SelectedRole != null 取代 >= 0 判定,InitialPropertyText 仍由 Controller 通过 ItemDescUtility.CreatePropDescription 拼装后注入 Context。

目录归属
事件命名
This commit is contained in:
SepComet
2026-06-16 17:09:20 +08:00
committed by basil
parent d2ce741a37
commit aca311dd60
21 changed files with 49 additions and 69 deletions
@@ -0,0 +1,8 @@
namespace SepCore.UI
{
public class RoleItemRawData
{
public int RoleId;
public string IconName;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd682bb88cf9b8c4fac0fe7002d3646b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using SepCore.Definition;
namespace SepCore.UI
{
public class RolePropertyAreaRawData
{
public int RoleId;
public string RoleName;
public StatModifier[] InitialProperties;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a582029cb4c5e5459ebe6d42335299f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,13 +1,8 @@
using SepCore.Definition;
namespace SepCore.UI
{
public class SelectRoleRawData
{
public int[] RoleIds;
public string[] RoleIconNames;
public int SelectedRoleId;
public string SelectedRoleName;
public StatModifier[] SelectedRoleInitialProperties;
public RoleItemRawData[] RoleItems;
public RolePropertyAreaRawData SelectedRole;
}
}
@@ -57,22 +57,30 @@ namespace SepCore.UI
{
DRRole[] roles = _roleDataTable.GetAllDataRows();
int count = _roleDataTable.Count;
int[] roleIds = new int[count];
string[] iconNames = new string[count];
RoleItemRawData[] roleItems = new RoleItemRawData[count];
for (int i = 0; i < count; i++)
{
roleIds[i] = roles[i].Id;
iconNames[i] = roles[i].IconName;
roleItems[i] = new RoleItemRawData
{
RoleId = roles[i].Id,
IconName = roles[i].IconName
};
}
DRRole selectedRole = selectedRoleId > 0 ? _roleDataTable.GetDataRow(selectedRoleId) : null;
RolePropertyAreaRawData selectedRoleData = selectedRole == null
? null
: new RolePropertyAreaRawData
{
RoleId = selectedRole.Id,
RoleName = selectedRole.RoleName,
InitialProperties = selectedRole.InitialProperties
};
return new SelectRoleRawData
{
RoleIds = roleIds,
RoleIconNames = iconNames,
SelectedRoleId = selectedRole?.Id ?? -1,
SelectedRoleName = selectedRole?.RoleName,
SelectedRoleInitialProperties = selectedRole?.InitialProperties
RoleItems = roleItems,
SelectedRole = selectedRoleData
};
}
}