Files
sbox-public/game/addons/tools/Code/Editor/VRStats.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

59 lines
942 B
C#

namespace Editor;
[Dock( "Editor", "VR Stats", "view_in_ar" )]
public partial class VRStats : Widget
{
Sheet StatSheet;
public string Group;
public float RefreshSpeed = 0.25f;
public VRStats( Widget parent ) : base( parent )
{
MinimumSize = 200;
SwitchGroup( "default" );
}
public void SwitchGroup( string group )
{
if ( Group == group ) return;
Group = group;
StatSheet?.Destroy();
StatSheet = new Sheet( this );
StatSheet.BackgroundColor = Theme.SurfaceBackground.Darken( 0.7f );
StatSheet.Visible = true;
StatSheet.Lower();
}
protected override void DoLayout()
{
base.DoLayout();
if ( StatSheet.IsValid() )
{
StatSheet.Position = 0;
StatSheet.Size = Size;
}
}
RealTimeSince timeSinceUpdate;
[EditorEvent.Frame]
public void Frame()
{
if ( timeSinceUpdate < RefreshSpeed )
return;
if ( !StatSheet.IsValid() )
return;
timeSinceUpdate = 0;
StatSheet.Draw();
}
}