Skip to content

Script driven GUI System

DoDoCat edited this page Aug 13, 2020 · 8 revisions

Summary

Parts

UI Layout Xml File

Parts

UILayout Node

The UILayout Node is the root of the UI Xml definetion

Attributes:

ID - ID for this UI

Background Node

The Background Node described the UI background

Attributes:

Type - UI Background Type

Script Node

The Script Node attached the script file for this UI

Widgets Node

Widgets Node included many Widget Node for describing the widgets of this UI

Widget Node

Widget Node described a specific Widget defined in engine or mod

Widget Parameter Node

Widget Parameters will give the parameters to the widget factory when contruct the widget

Example:

<UILayout ID="ui_custom_game">
	<Background Type="NoChange"></Background>
	<Script>ui_custom_game.script</Script>
	<Widgets>
		<Widget Type="Label" TrayLocation="TL_TOP">
			<WidgetParameters>
				<WidgetParameter Name="name" Type="String">lbTitle</WidgetParameter>
				<WidgetParameter Name="caption" Type="String">str_custom_game_title</WidgetParameter>
				<WidgetParameter Name="width" Type="Float">200</WidgetParameter>
			</WidgetParameters>
		</Widget>
	</Widgets>
</UILayout>

UI Script File

Entry Function

Entry function for UI is uiInit function, you can add some init code in this function

Event Change Function

You can capture the UI event change in uiEventChanged function, this function needs two paramters:
Param 1: widgetID
Param 2: value

Example:

function uiEventChanged
  store_input_param %widgetID 1
  store_input_param %value 2 
  ...other code...  
end