Changes

Jump to navigation Jump to search
Line 150: Line 150:     
== Creating UI ==
 
== Creating UI ==
 +
=== Button in the main HUD ===
 
You can add buttons to the bottom main HUD by calling '''HUD.Instance.AddBottomButton'''(string panel, string name, string desc, Sprite icon). If you want your own Icon you need to instantiate a Sprite with a texture that you load using '''ParentMod.LoadTexture''' or in the '''ModMeta''''s '''Initialize'''(ModController.DLLMod parentMod) method. The game uses 32x32 icons that are completely white with a transparent background, if you want to stay consistent.
 
You can add buttons to the bottom main HUD by calling '''HUD.Instance.AddBottomButton'''(string panel, string name, string desc, Sprite icon). If you want your own Icon you need to instantiate a Sprite with a texture that you load using '''ParentMod.LoadTexture''' or in the '''ModMeta''''s '''Initialize'''(ModController.DLLMod parentMod) method. The game uses 32x32 icons that are completely white with a transparent background, if you want to stay consistent.
    +
=== HTML-like UI ===
 
You can load in UIs using xml files with an html like structure using '''WindowManager.GenerateUI'''(List<XMLParser.XMLNode> nodes, GameObject parent, object callback). Example:  
 
You can load in UIs using xml files with an html like structure using '''WindowManager.GenerateUI'''(List<XMLParser.XMLNode> nodes, GameObject parent, object callback). Example:  
 
<pre class="language-html">&lt;window MinSize="0,0" NonLocTitle="Test window"&gt;
 
<pre class="language-html">&lt;window MinSize="0,0" NonLocTitle="Test window"&gt;

Navigation menu