DanielWillett.UnturnedUITools 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DanielWillett.UnturnedUITools --version 1.1.0                
NuGet\Install-Package DanielWillett.UnturnedUITools -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DanielWillett.UnturnedUITools" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DanielWillett.UnturnedUITools --version 1.1.0                
#r "nuget: DanielWillett.UnturnedUITools, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DanielWillett.UnturnedUITools as a Cake Addin
#addin nuget:?package=DanielWillett.UnturnedUITools&version=1.1.0

// Install DanielWillett.UnturnedUITools as a Cake Tool
#tool nuget:?package=DanielWillett.UnturnedUITools&version=1.1.0                

UI Tools and Extensions

Powerful Unturned Module/Library for manipulating Glazier/Sleek UI.

Requires HarmonyLib 2.2.2+.

NuGet package: DanielWillett.UnturnedUITools

Reflection Tools

This package references my Reflection Tools library which has a lot of good tools for efficient access to non-public members.

XML Documentation

This package includes complete XML documentation for SDG.Glazier.Runtime.dll, which houses all of the Glazier code.

Note: this is done by including a reference assembly in the package, so don't copy it from the output directory to your libraries.

UI Tools

The UIAccessor class has many tools for working with UIs:

  • Many efficient getters for internal types and instances of vanilla UIs.
  • Optional managed Harmony log that clears on startup to help diagnose transpilers.
  • EditorUIReady and PlayerUIReady events.
  • UI TypeInfo with basic information about each UI type (used by UI extensions).
  • OnInitializingUIInfo to add your own information to TypeInfo.
  • LoadUIToILGenerator and EnumerateUIInstructions to load instance singleton UIs to ILGenerators or transpilers.
  • Extension for ISleekElement: CopyTransformFrom to copy all transform values from one element to another.

UI Extensions

Add a class as an extension to existing vanilla or modded UI classes.

You can extend the following types. It is also possible to add your own types.

  • Singleton and Static UIs. This includes any of the 'standard' in-game UI classes.
  • Useable UIs (Guns, Housing Planners, etc).
  • Node and Volume editor menus.
  • Any class deriving from SleekWrapper.
  • Modules can add their own classes in as well.

Existing Members

Easy access to members of the class you're expanding (static or instance) is possible with Existing Members.

// Property getter will be patched to return messageLabel.
[ExistingMember("messageLabel")]
private ISleekLabel MessageLabel { get; }

// Property will be set before the constructor runs. Change this behavior with the 'InitializeMode' attribute property.
// If you choose to use the 'PatchGetter' option with a setter,
// you cannot use the setter to set the existing member's value back.
[ExistingMember("messageLabel")]
private ISleekLabel MessageLabel { get; set; }

// Field will be set before the constructor runs.
[ExistingMember("messageLabel")]
private readonly ISleekLabel _messageLabel;

Static Compatability

The system is designed to be able to be accessed from a static context (like a patch, for example).


// Getting static or singleton UI extensions:

MenuDashboardUIExtension? extension = UnturnedUIToolsNexus.UIExtensionManager.GetInstance<MenuDashboardUIExtension>();


// Getting non-singleton UI extensions:

static void Postfix(object __instance)
{
  SleekItemExtension? extension = UnturnedUIToolsNexus.UIExtensionManager.GetInstance<SleekItemExtension>(__instance);
}

Examples

More examples available in: ExampleModule/Examples.

This example adds a button to the bottom left of the main menu.

ex1 1

[UIExtension(typeof(MenuDashboardUI))]
internal class MenuDashboardUIExtension : UIExtension, IDisposable
{
    private const string Url = "https://github.com/DanielWillett/UnturnedUITools";

    private readonly ISleekButton _githubButton;

    [ExistingMember("exitButton")]
    private readonly SleekButtonIcon _exitButton;

    [ExistingMember("container")]
    private readonly SleekFullscreenBox _container;

    public MenuDashboardUIExtension()
    {
        _githubButton = Glazier.Get().CreateButton();

        _githubButton.CopyTransformFrom(_exitButton);
        _githubButton.PositionOffset_Y -= 60;
        _githubButton.Text = "UITools GitHub";
        _githubButton.FontSize = ESleekFontSize.Medium;
        _githubButton.OnClicked += OnClickedGithubButton;
        _githubButton.BackgroundColor = ESleekTint.BACKGROUND;

        _container.AddChild(_githubButton);
    }

    private static void OnClickedGithubButton(ISleekElement button)
    {
        Process.Start(new ProcessStartInfo
        {
            FileName = Url,
            UseShellExecute = true
        });
    }

    public void Dispose()
    {
        _githubButton.OnClicked -= OnClickedGithubButton;
        _container.RemoveChild(_githubButton);
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on DanielWillett.UnturnedUITools:

Package Downloads
DevkitServer.Client

Module for Unturned that enables multi-user map editing.

DevkitServer.Server

Module for Unturned that enables multi-user map editing.

Breakdown.Tools

Package containing several tools for plugin and module development.

DanielWillett.LevelObjectIcons

LevelObject icon renderer for the Unturned Map Editor.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.3 168 8/18/2024
1.4.2 147 6/8/2024
1.4.1 122 5/7/2024
1.4.0 147 2/12/2024
1.3.1 306 11/22/2023
1.3.0 414 11/18/2023
1.2.2 134 11/13/2023
1.2.1 158 10/30/2023
1.2.0 145 10/28/2023
1.1.1 158 10/23/2023 1.1.1 is deprecated because it has critical bugs.
1.1.0 161 10/23/2023 1.1.0 is deprecated because it has critical bugs.
1.0.0 185 10/22/2023 1.0.0 is deprecated because it has critical bugs.