Changes

Jump to navigation Jump to search
Line 155: Line 155:  
=== HTML-like UI ===
 
=== 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, ModBehaviour callback). Example:  
 
You can load in UIs using xml files with an html like structure using '''WindowManager.GenerateUI'''(List<XMLParser.XMLNode> nodes, GameObject parent, ModBehaviour callback). Example:  
<pre class="language-html"><window MinSize="0,0" NonLocTitle="Test window">
+
<pre class="language-html"><Window MinSize="0,0" NonLocTitle="Test window">
<scrollview anchor="fill" position="4,4" size="-8,-8">
+
<ScrollView anchor="fill" position="4,4" size="-8,-8">
 
<VerticalLayout anchor="top" padding="4,4,4,4" spacing="2" childForceExpandHeight="False" childControlHeight="False">
 
<VerticalLayout anchor="top" padding="4,4,4,4" spacing="2" childForceExpandHeight="False" childControlHeight="False">
 
<ContentFitter verticalFit="PreferredSize">
 
<ContentFitter verticalFit="PreferredSize">
<label id="lab" color="FF0000" height="24">Hello</label>
+
<Label id="lab" color="FF0000" height="24">Hello</Label>
<button onClick="ShowMessage(Hehe)" height="24">Click me</button>
+
<Button onClick="ShowMessage(Hehe)" height="24">Click me</Button>
<combo OnSelectedChanged="ShowMessageCombo(this)" height="24">a,b,c</combo>
+
<Combo OnSelectedChanged="ShowMessageCombo(this)" height="24">a,b,c</Combo>
 
</ContentFitter>
 
</ContentFitter>
 
</VerticalLayout>
 
</VerticalLayout>
</scrollview>
+
</ScrollView>
</window></pre>
+
</Window></pre>
 
This will create a window with a scroll view containing a label, a button and a combobox automatically laid out vertically. Please note that attributes, e.g. '''position'''="4,4" are case sensitive!
 
This will create a window with a scroll view containing a label, a button and a combobox automatically laid out vertically. Please note that attributes, e.g. '''position'''="4,4" are case sensitive!
  

Navigation menu