This repository has been archived on 2026-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
Virtual-Memory-Demo/Assets/Scripts/UI/SimulationProcessHeaderView.cs

37 lines
893 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using TMPro;
using UnityEngine;
using VMdemo.Simulation;
namespace VMdemo.UI
{
public class SimulationProcessHeaderView : MonoBehaviour
{
[SerializeField] private TMP_Text currentStepText;
[SerializeField] private TMP_Text currentEventText;
public void RenderStep(SimulationState state)
{
if (state == null)
{
SetText(currentStepText, "步骤N/A");
return;
}
SetText(currentStepText, $"步骤:{TranslationStepDisplay.ToChinese(state.CurrentStep)}");
}
public void SetEvent(string message)
{
SetText(currentEventText, message);
}
private static void SetText(TMP_Text target, string text)
{
if (target != null)
{
target.text = text;
}
}
}
}