unityzgy/Assets/Scripts/ThisProjectTool/VRCtrl/RepairSub/RepairPrefabManager.cs
ayuan9957 bf12e02276 feat: 多语言本地化系统 - 支持中/英/法/俄实时切换
- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg)
- LoginPanel: InputField placeholder本地化、字体颜色保持
- HistoryPanel: 用时数据本地化、placeholder本地化
- RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建)
- AppraiseWindowBase: 评价等级本地化、操作消息重建
- EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized
- StudentOperateRecorder: 新增InjectOperateMsgLocalized方法
- LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选
- 字体切换时保留颜色和verticalOverflow
2026-07-16 10:05:59 +08:00

105 lines
3.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XNode;
//维修场景预制件管理器 用于规划维修步骤 管理维修步骤
public class RepairPrefabManager : MonoBehaviour
{
[Tooltip("步骤规划编辑器")]
public NodeGraph Procress;
[Tooltip("拆卸时终步骤节点")]
public StepNode tearDownLastNode;
[Tooltip("安装时终步骤节点")]
public StepNode installLastNode;
Dictionary<string, List<string>> keyValues = new Dictionary<string, List<string>>();
List<StepRelation> stepRelations = new List<StepRelation>();
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < Procress.nodes.Count; i++)
{
foreach (NodePort item in Procress.nodes[i].Outputs)
{
if (item.IsConnected)
{
string nodeName = (string)item.node.GetValue(null);
if (keyValues.ContainsKey(nodeName))
{
Debug.LogError($"存在重复的步骤名称{nodeName},跳过重复节点");
continue;
}
keyValues.Add(nodeName, new List<string>());
List<NodePort> Connections = item.GetConnections();//获取当前节点 后续的所有节点
for (int j = 0; j < Connections.Count; j++)
{
string postpositionNodeName = (string)Connections[j].node.GetValue(null);
keyValues[nodeName].Add(postpositionNodeName);
stepRelations.Add(new StepRelation(nodeName, postpositionNodeName));
}
}
}
}//梳理流程关系
ProcessManager.Instance.InitStepRelationDic(stepRelations, (string)tearDownLastNode.GetValue(null), (string)installLastNode.GetValue(null));//注入流程管理器
}
//测试代码
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
List<string> unFinishedStep = ProcessManager.Instance.GetUnFinishedtep();
if (unFinishedStep.Count == 0)
{
Debug.Log("所有步骤都完成了!");
}
else
{
for (int i = 0; i < unFinishedStep.Count; i++)
{
Debug.Log($"当前未完成步骤:{unFinishedStep[i]}");
}
}
}
//if (Input.GetKeyDown(KeyCode.S))
//{
// ProcessManager.Instance.SetProcess(ProcessEnum.teardown);
// ProcessManager.Instance.StartProcess(ProcessOver);
//}
}
#if UNITY_EDITOR
private void ProcessOver(ProcessEnum process)
{
Debug.LogWarning($"{process}流程结束");
switch (process)
{
case ProcessEnum.teardown://拆卸流程结束时 反转流程继续开始安装流程
Invoke("ResetProcress", 10f);
break;
case ProcessEnum.assemble:
Debug.LogWarning($"安装流程结束,训练完成");
break;
default:
break;
}
}
private void ResetProcress()
{
Debug.Log($"开始安装流程");
ProcessManager.Instance.SetProcess(ProcessEnum.assemble);
ProcessManager.Instance.StartProcess(ProcessOver);
}
#endif
}