Skip to content

Creates a subscribable event in C# for Vintage Story that triggers on Gui registration through the game's main API. Clientside-only mod.

License

Notifications You must be signed in to change notification settings

NicholasBaldwinSE/GUIRegistrationEvent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GUIRegistrationEvent

A simple Vintage Story mod creating a clientside subscribable event that fires when a GUI is registered.

NOTICE

This mod uses a Harmony patch and, therefore, a static event. Make sure that every subscriber to the event created by this mod is also properly unsubscribed, or there could be potential data leaks. This also means that you can subscribe to the event without directly pulling the modsystem itself, since it is static. This is by no means perfect, but from testing it works well enough.

USAGE

public class YourMod : ModSystem
{
	ICoreClientAPI capi;

	public override void StartClientSide(ICoreClientAPI capi)
	{
		this.capi = capi;
			
		GUIRegistrationEventModSystem.GUIRegistrationEvent += onGuiRegistered;
	}
	
	public override void Dispose()
	{
		if (capi != null) GUIRegistrationEventModSystem.GUIRegistrationEvent -= onGuiRegistered;
	}
	
	public void onGuiRegistered(GuiDialog dialog)
	{
		Console.WriteLine(dialog.DebugName);
	}
}

About

Creates a subscribable event in C# for Vintage Story that triggers on Gui registration through the game's main API. Clientside-only mod.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published