mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 08:18:20 -04:00
* Fix scene reference gizmos not showing up * Fix links not pulsing when viewing a graph in play mode * Fix undo system error when action graph gizmos are selected in scene view * Fix warning about when a graph can be saved or not * Fix some SerializedObject.IsValid / SerializedProperty.IsValid implementations * Fixed errors in console when opening the node creation menu * Fix possible error when dragging links during play mode * Fix errors when opening some graphs that reference removed component types * Strip action graph editor code from engine projects
46 lines
849 B
C#
46 lines
849 B
C#
using Sandbox;
|
|
|
|
namespace Editor.ActionGraphs;
|
|
|
|
#nullable enable
|
|
|
|
public sealed class WarningFrame : Widget
|
|
{
|
|
public Color Color { get; set; } = Color.Parse( "#FA9131" )!.Value;
|
|
|
|
public string? Text
|
|
{
|
|
get;
|
|
set
|
|
{
|
|
if ( field == value ) return;
|
|
|
|
field = value;
|
|
Update();
|
|
}
|
|
}
|
|
|
|
public WarningFrame()
|
|
{
|
|
TransparentForMouseEvents = true;
|
|
}
|
|
|
|
protected override void OnPaint()
|
|
{
|
|
if ( string.IsNullOrEmpty( Text ) ) return;
|
|
|
|
Paint.SetPen( Color, 8f );
|
|
Paint.DrawRect( LocalRect );
|
|
|
|
Paint.SetDefaultFont( 10f );
|
|
var textRect = LocalRect.Contain( Paint.MeasureText( Text ) + new Vector2( 16f, 8f ), TextFlag.RightBottom );
|
|
|
|
Paint.ClearPen();
|
|
Paint.SetBrush( Color );
|
|
Paint.DrawRect( textRect.Shrink( 0f, 0f, 4f, 4f ) );
|
|
Paint.ClearBrush();
|
|
Paint.SetPen( Color.Black );
|
|
Paint.DrawText( textRect, Text );
|
|
}
|
|
}
|