mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 05:48:07 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
59 lines
942 B
C#
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();
|
|
}
|
|
}
|