Files
RobustToolbox/Robust.Client/UserInterface/CustomControls/DebugTimePanel.cs
T
SilverandGitHub 25926a17b7 Renames SS14.* to Robust.* (#793)
RobustToolbox projects should be named Robust.* 

This PR changes the RobustToolbox projects from SS14.* to Robust.*

Updates SS14.* prefixes/namespaces to Robust.*
Updates SpaceStation14.sln to RobustToolbox.sln
Updates MSBUILD/SS14.* to MSBUILD/Robust.*
Updates CSProject and MSBuild references for the above
Updates git_helper.py
Removes Runserver and Runclient as they are unusable
2019-04-15 20:24:59 -06:00

76 lines
2.1 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.Utility;
namespace Robust.Client.UserInterface.CustomControls
{
public class DebugTimePanel : Panel
{
private readonly IResourceCache _resourceCache;
private readonly IGameTiming _gameTiming;
private Label _contents;
public DebugTimePanel(IResourceCache resourceCache, IGameTiming gameTiming)
{
_resourceCache = resourceCache;
_gameTiming = gameTiming;
PerformLayout();
}
protected override void Initialize()
{
base.Initialize();
_contents = new Label();
}
private void PerformLayout()
{
_contents = new Label
{
FontOverride = _resourceCache.GetResource<FontResource>(new ResourcePath("/Fonts/CALIBRI.TTF"))
.MakeDefault(),
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(ProcessFrameEventArgs 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);
}
}
}