38 lines
833 B
C#
38 lines
833 B
C#
using Godot;
|
|
|
|
public partial class RobotDisplay : PanelContainer
|
|
{
|
|
[Export] public RichTextLabel listItem;
|
|
[Export] public RichTextLabel currentScript;
|
|
[Signal]
|
|
public delegate void OnRobotJumpToEventHandler(Robot robot);
|
|
[Signal]
|
|
public delegate void OnRobotFollowEventHandler(Robot robot);
|
|
public Robot robot;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
string status = GetStatusText();
|
|
if (status != currentScript.Text)
|
|
{
|
|
currentScript.Text = status;
|
|
}
|
|
}
|
|
|
|
private string GetStatusText()
|
|
{
|
|
string programName = robot.currentProgram ?? "";
|
|
return $"{programName} | Heat {robot.heat:0}% | Maintenance {robot.maintenance:0}%";
|
|
}
|
|
|
|
public void OnJumpToClicked()
|
|
{
|
|
EmitSignal(SignalName.OnRobotJumpTo, robot);
|
|
}
|
|
|
|
public void OnFollowToClicked()
|
|
{
|
|
EmitSignal(SignalName.OnRobotFollow, robot);
|
|
}
|
|
}
|