Files
sbox-public/game/addons/tools/Code/Editor/ProjectSettings/PackageReferences.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

41 lines
1.2 KiB
C#

namespace Editor.ProjectSettingPages;
[Title( "Packages" )]
internal sealed class ReferencesCategory : ProjectInspector.Category
{
public List<string> PackageReferences { get; set; } = new List<string>();
public override void OnInit( Project project )
{
base.OnInit( project );
project.Config.PackageReferences ??= new();
PackageReferences.Clear();
PackageReferences.AddRange( project.Config.PackageReferences );
var warning = new WarningBox( "This stuff hasn't been properly end to end tested - please don't expect it to work just yet!", this );
BodyLayout.Add( warning );
{
var thisSerialized = this.GetSerialized();
BodyLayout.AddSpacingCell( 8 );
BodyLayout.Add( new Label.Body( "Your project can reference other packages. These will be downloaded when your package is downloaded and your package will be able to use code and resources " ) );
var sheet = new ControlSheet();
sheet.AddRow( thisSerialized.GetProperty( nameof( PackageReferences ) ) );
ListenForChanges( thisSerialized );
BodyLayout.Add( sheet );
}
}
public override void OnSave()
{
Project.Config.PackageReferences = [.. PackageReferences];
base.OnSave();
}
}