拆分 UIController 组装 Context 职责 + 描述文本滚动展示
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
using GeometryTD.Definition;
|
||||
using GeometryTD.Procedure;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public sealed partial class NodeMapFormController
|
||||
{
|
||||
private static NodeMapFormContext BuildContext(NodeMapFormRawData rawData)
|
||||
{
|
||||
NodeItemContext[] nodeItemContexts = System.Array.Empty<NodeItemContext>();
|
||||
if (rawData?.Nodes != null && rawData.Nodes.Count > 0)
|
||||
{
|
||||
nodeItemContexts = new NodeItemContext[rawData.Nodes.Count];
|
||||
for (int i = 0; i < rawData.Nodes.Count; i++)
|
||||
{
|
||||
NodeMapNodeRawData node = rawData.Nodes[i];
|
||||
nodeItemContexts[i] = new NodeItemContext
|
||||
{
|
||||
NodeId = node?.NodeId ?? 0,
|
||||
SequenceIndex = node?.SequenceIndex ?? i,
|
||||
NodeType = node?.NodeType ?? RunNodeType.None,
|
||||
IsLocked = node != null && node.Status == RunNodeStatus.Locked,
|
||||
IsCurrent = node != null && node.IsCurrentNode,
|
||||
IsCompleted = node != null && node.Status == RunNodeStatus.Completed,
|
||||
IsException = node != null && node.Status == RunNodeStatus.Exception,
|
||||
CanClick = node != null && node.CanEnter
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return new NodeMapFormContext
|
||||
{
|
||||
Title = rawData?.Title ?? "节点地图",
|
||||
ProgressText = rawData?.ProgressText ?? "0 / 0",
|
||||
CurrentNodeText = rawData?.CurrentNodeText ?? "当前节点: 无",
|
||||
IsRunCompleted = rawData != null && rawData.IsRunCompleted,
|
||||
NodeItems = nodeItemContexts
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf16e881b2eeae447b3ff2b36e4f6753
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,7 @@ using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public sealed class NodeMapFormController : UIFormControllerCommonBase<NodeMapFormContext, NodeMapForm>
|
||||
public sealed partial class NodeMapFormController : UIFormControllerCommonBase<NodeMapFormContext, NodeMapForm>
|
||||
{
|
||||
private NodeMapFormUseCase _useCase;
|
||||
|
||||
@@ -126,37 +126,5 @@ namespace GeometryTD.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
private static NodeMapFormContext BuildContext(NodeMapFormRawData rawData)
|
||||
{
|
||||
NodeItemContext[] nodeItemContexts = System.Array.Empty<NodeItemContext>();
|
||||
if (rawData?.Nodes != null && rawData.Nodes.Count > 0)
|
||||
{
|
||||
nodeItemContexts = new NodeItemContext[rawData.Nodes.Count];
|
||||
for (int i = 0; i < rawData.Nodes.Count; i++)
|
||||
{
|
||||
NodeMapNodeRawData node = rawData.Nodes[i];
|
||||
nodeItemContexts[i] = new NodeItemContext
|
||||
{
|
||||
NodeId = node?.NodeId ?? 0,
|
||||
SequenceIndex = node?.SequenceIndex ?? i,
|
||||
NodeType = node?.NodeType ?? RunNodeType.None,
|
||||
IsLocked = node != null && node.Status == RunNodeStatus.Locked,
|
||||
IsCurrent = node != null && node.IsCurrentNode,
|
||||
IsCompleted = node != null && node.Status == RunNodeStatus.Completed,
|
||||
IsException = node != null && node.Status == RunNodeStatus.Exception,
|
||||
CanClick = node != null && node.CanEnter
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return new NodeMapFormContext
|
||||
{
|
||||
Title = rawData?.Title ?? "节点地图",
|
||||
ProgressText = rawData?.ProgressText ?? "0 / 0",
|
||||
CurrentNodeText = rawData?.CurrentNodeText ?? "当前节点: 无",
|
||||
IsRunCompleted = rawData != null && rawData.IsRunCompleted,
|
||||
NodeItems = nodeItemContexts
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user