Changes

Jump to navigation Jump to search
Line 150: Line 150:  
== Reading external files ==
 
== Reading external files ==
 
All modbehaviours have access to their '''ParentMod''', this is the class that manages your mod, and through this you can load files using the methods '''LoadTexture'''(png, jpg, jpeg), '''LoadXMLFile'''(xml, only first tag), '''LoadFullXMLFile'''(xml, all tags in a list), '''LoadTydFile'''(tyd), '''LoadAudio'''(mp3, wav, ogg), '''LoadGLTF'''(gltf, glb, only loads the first mesh and its morph targets) and '''LoadOBJ'''(obj). Note that these methods all use relative paths from where your mod is installed and using '''../''' won't work.
 
All modbehaviours have access to their '''ParentMod''', this is the class that manages your mod, and through this you can load files using the methods '''LoadTexture'''(png, jpg, jpeg), '''LoadXMLFile'''(xml, only first tag), '''LoadFullXMLFile'''(xml, all tags in a list), '''LoadTydFile'''(tyd), '''LoadAudio'''(mp3, wav, ogg), '''LoadGLTF'''(gltf, glb, only loads the first mesh and its morph targets) and '''LoadOBJ'''(obj). Note that these methods all use relative paths from where your mod is installed and using '''../''' won't work.
 +
 +
== Creating UI ==
 +
You can add buttons to the bottom main HUD by calling '''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 method.
 +
 +
You can load in UIs using xml files with an html like structure. Example:
 +
<window MinSize="0,0" NonLocTitle="Test window">
 +
<scrollview anchor="fill" position="4,4" size="-8,-8">
 +
<VerticalLayout anchor="top" padding="4,4,4,4" spacing="2" childForceExpandHeight="False" childControlHeight="False">
 +
<ContentFitter verticalFit="PreferredSize">
 +
<label id="lab" color="FF0000" height="24">Hello</label>
 +
<button onClick="ShowMessage(Hehe)" height="24">Click me</button>
 +
<combo height="24">a,b,c</combo>
 +
</ContentFitter>
 +
</VerticalLayout>
 +
</scrollview>
 +
</window>
    
== Networking ==
 
== Networking ==

Navigation menu