kakozuzo/Code/swb_base/ui/RootWeaponDisplay.cs
2024-10-30 19:01:58 +03:00

29 lines
550 B
C#

using Sandbox.UI;
namespace SWB.Base.UI;
public class RootWeaponDisplay : PanelComponent
{
public Weapon Weapon { get; set; }
protected override void OnStart()
{
if ( IsProxy )
{
Enabled = false;
return;
}
Panel.StyleSheet.Load( "/swb_base/ui/RootWeaponDisplay.cs.scss" );
var crosshair = new Crosshair( Weapon );
Panel.AddChild( crosshair );
if ( Weapon.Scoping )
{
var sniperScope = new SniperScope( Weapon, Weapon.ScopeInfo.LensTexture, Weapon.ScopeInfo.ScopeTexture );
Panel.AddChild( sniperScope );
}
}
}