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]
61 lines
1.0 KiB
C#
61 lines
1.0 KiB
C#
using System.ComponentModel;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Editor.ShaderGraph;
|
|
|
|
public class MissingNode : BaseNode
|
|
{
|
|
[Hide]
|
|
public string Title { get; set; }
|
|
|
|
[Hide]
|
|
private string _content = "";
|
|
|
|
[Hide]
|
|
public string Content
|
|
{
|
|
get => _content;
|
|
set
|
|
{
|
|
_content = value;
|
|
Paint.SetDefaultFont();
|
|
ContentSize = Paint.MeasureText( Content );
|
|
ExpandSize = new Vector2( 30, ContentSize.y + 16 );
|
|
}
|
|
}
|
|
|
|
[Hide]
|
|
Vector2 ContentSize = new();
|
|
|
|
[Hide]
|
|
public override Color PrimaryColor => Theme.MultipleValues;
|
|
|
|
public MissingNode()
|
|
{
|
|
}
|
|
|
|
public MissingNode( string title, JsonElement json ) : base()
|
|
{
|
|
Title = title;
|
|
Content = json.ToString();
|
|
}
|
|
|
|
public override void OnPaint( Rect rect )
|
|
{
|
|
Paint.SetDefaultFont();
|
|
Paint.DrawText( rect.Shrink( 8, 22, 8, 8 ), Content, TextFlag.LeftTop );
|
|
}
|
|
|
|
[JsonIgnore, Hide, Browsable( false )]
|
|
public override DisplayInfo DisplayInfo
|
|
{
|
|
get
|
|
{
|
|
var info = base.DisplayInfo;
|
|
info.Name = "Missing " + Title ?? info.Name;
|
|
info.Icon = "error";
|
|
return info;
|
|
}
|
|
}
|
|
}
|