Difference between revisions of "Widget Templates"
From PowerUI
Bablakeluke (talk | contribs) |
Bablakeluke (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | Widget templates are a new way of easily making reusable, extremely extendible UI components in PowerUI. They are central to the [[Widget Manager]] which forms the basis of other systems such as [[Dialogue|dialogue (speech)]] and [[Context Menu|context menus]]. | |
− | [[File:Floating_window.png|thumb|The built in floating window is one example of a template]] | + | [[File:Floating_window.png|thumb|The built in floating window is one example of a widget template]] |
== Making a template == | == Making a template == | ||
Line 8: | Line 8: | ||
* A C# file which handles any logic for you. | * A C# file which handles any logic for you. | ||
− | Inside is a class which ultimately derive from | + | Inside is a class which ultimately derive from Widget ''(context menu's, for example, derive from ContextMenu which itself is a Widget)''. |
* A html file which provides the basic style ''(optional)'' | * A html file which provides the basic style ''(optional)'' | ||
Line 23: | Line 23: | ||
* MyTemplate/Resources/myTemplate-template.html | * MyTemplate/Resources/myTemplate-template.html | ||
− | For an example of a built in | + | For an example of a built in widget, check out the "Floating Window" which is at PowerUI/Source/Extras/Widgets/Built in/Floating Window/ |
Latest revision as of 16:35, 18 March 2017
Widget templates are a new way of easily making reusable, extremely extendible UI components in PowerUI. They are central to the Widget Manager which forms the basis of other systems such as dialogue (speech) and context menus.
Making a template
A template usually consists of 3 parts:
- A C# file which handles any logic for you.
Inside is a class which ultimately derive from Widget (context menu's, for example, derive from ContextMenu which itself is a Widget).
- A html file which provides the basic style (optional)
(which is actually CSS, because Unity doesn't recognise .css as text)
- A html file which provides the basic layout (optional)
Template structure
The (self contained) structure of those files is usually like this:
- MyTemplate/myTemplate.cs
- MyTemplate/Resources/myTemplate-style.html
- MyTemplate/Resources/myTemplate-template.html
For an example of a built in widget, check out the "Floating Window" which is at PowerUI/Source/Extras/Widgets/Built in/Floating Window/