mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
* Refactor UI system. Deferred updating is used for styling & layout. This fixes the awful time complexity of containers. Removed SetDefaults and Initialize. They were a bad idea alright. * Fix build on .NET Framework.
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using Robust.Client.Graphics.Drawing;
|
|
using Robust.Client.Interfaces.ResourceManagement;
|
|
using Robust.Client.ResourceManagement;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.Interfaces.Timing;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Timing;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Client.UserInterface.CustomControls
|
|
{
|
|
public class DebugTimePanel : Panel
|
|
{
|
|
private readonly IGameTiming _gameTiming;
|
|
|
|
private Label _contents;
|
|
|
|
public DebugTimePanel(IGameTiming gameTiming)
|
|
{
|
|
_gameTiming = gameTiming;
|
|
|
|
_contents = new Label
|
|
{
|
|
FontColorShadowOverride = Color.Black,
|
|
MarginTop = 5,
|
|
MarginLeft = 5
|
|
};
|
|
AddChild(_contents);
|
|
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = new Color(67, 105, 255, 138),
|
|
};
|
|
|
|
MouseFilter = _contents.MouseFilter = MouseFilterMode.Ignore;
|
|
|
|
SizeFlagsHorizontal = SizeFlags.None;
|
|
}
|
|
|
|
protected override void Update(FrameEventArgs args)
|
|
{
|
|
base.Update(args);
|
|
|
|
if (!VisibleInTree)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_contents.Text = $@"Paused: {_gameTiming.Paused}, CurTick: {_gameTiming.CurTick},
|
|
CurTime: {_gameTiming.CurTime}, RealTime: {_gameTiming.RealTime}, CurFrame: {_gameTiming.CurFrame}";
|
|
|
|
MinimumSizeChanged();
|
|
}
|
|
|
|
protected override Vector2 CalculateMinimumSize()
|
|
{
|
|
return new Vector2(_contents.CombinedMinimumSize.X + 10, _contents.CombinedMinimumSize.Y + 10);
|
|
}
|
|
}
|
|
}
|