Game Development Reference
In-Depth Information
<onEndScreen name="fade" start="#ff" end="#00"
length="200" inherit="true"/>
</effect>
6. The dialog panel will have four <panel> elements inside it. At the top and bot-
tom, we should add two thin panels with black background to give it a cinematic
feel.
7. The upper part of the two central panels will contain the characterControl
we just created:
<control name="characterControl" id="character"/>
8. The lower one will have a listbox that contains the player's dialog options:
<control id="dialogOptions" name="listBox"
vertical="off" horizontal="off" displayItems="3"
selection="Single"/>
9. If we also want support for the options menu, it should go in a separate layer to
make it show on top of the rest of the GUI.
The controller code for it can be created by performing the following 12 steps:
1. Begin by defining a new class called DialogScreenController that ex-
tends NiftyController or implements ScreenController if an abstract
Controller class is not available.
2. Next, we add two fields: one for the current DialogNode , dialogNode , and a
reference to ListBox in the XML called dialogOptions .
3. The onStartScreen() method should be overridden; here, it should set
dialogOptions by calling screen.findNiftyControl :
dialogOptions =
screen.findNiftyControl("dialogOptions",
ListBox.class);
4. Finally, onStartScreen should also call onDialogNodeChanged() if
dialogNode is set.
5. Now, we need to define the method called onDialogNodeChanged that will
apply the dialog information to the layout.
Search WWH ::




Custom Search