|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.sahits.game.rendering.AbstractRenderPart
ch.sahits.game.graphic.display.OpenPatricianBackgroundView
ch.sahits.game.graphic.display.start.NewGameView
public class NewGameView
Rendering view to create a new single player game. This view encompasses the whole screen with a red brick background.
| Field Summary | |
|---|---|
private ch.sahits.game.openpatrician.model.Difficulty |
difficulity
|
private Slider |
difficulty
|
private RadioButton |
female
|
private static ch.sahits.game.openpatrician.util.RandomNameLoader |
firstNameLoader
|
private Font |
font
|
private Spinner |
home
|
private TextInput |
lastName
|
private static ch.sahits.game.openpatrician.util.RandomNameLoader |
lastNameLoader
|
private RadioButton |
male
|
private Spinner |
map
|
private FontMetrics |
metic
|
private TextInput |
name
|
private Spinner |
objective
|
private Slider |
speed
|
private Spinner |
startYear
|
| Fields inherited from class ch.sahits.game.rendering.AbstractRenderPart |
|---|
rect |
| Constructor Summary | |
|---|---|
NewGameView(Rectangle rect,
FontMetrics metric)
Construct the view with the specified dimensions and the font metrics |
|
| Method Summary | |
|---|---|
private Button |
addButton(String text)
Create a button with the text label |
private TextInput |
addInput(String value)
Create a TextInput field with an optional preset text |
private ISahitsComponent |
addLabel(String name)
Creating a label. |
private RadioButton |
addRadioButton(String label,
boolean selected,
SelectableGroup group)
Add a RadioButton to the view. |
private Slider |
addSlider(List<String> elements)
Add a slider control to the component. |
private Spinner |
addSpinner(List<String> elements)
Add a spinner control to the component. |
private void |
createComponents()
Create the form element to specify the start settings of the new game |
private Runnable |
createStartButtonClickAction()
Action to be called when the start button is hit. |
private List<String> |
getDificutlyList()
Compile a list of the difficulty levels |
private List<String> |
getGameSpeedList()
Compile a list of game speeds |
private List<String> |
getHomeTowns4Map()
Create a list of town names that are available on the selected map as home towns. |
private List<String> |
getMapList()
Retrieve the list of the available maps |
private List<String> |
getObjectiveList()
Create a list of objectives to select from |
private static String |
getRandomFirstName()
|
private static String |
getRandomLastName()
|
private List<String> |
getStartYears()
Initialize the list of start years from 1300 to 1400 |
void |
setDifficulity(ch.sahits.game.openpatrician.model.Difficulty difficulity)
Set the difficulty |
private void |
setFont(ISahitsComponent comp)
Set the font on the component |
private boolean |
validInput()
check if the input is valid and one may proceed. |
| Methods inherited from class ch.sahits.game.graphic.display.OpenPatricianBackgroundView |
|---|
add, gameRender, gameUpdate, get, getComponentCount, getHeight, getInsets, getWidth |
| Methods inherited from class ch.sahits.game.rendering.AbstractRenderPart |
|---|
getBounds, isEnabled, setEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ch.sahits.game.graphic.display.ISahitsContainer |
|---|
add, get, getBounds, getComponentCount, getHeight, getInsets, getWidth |
| Field Detail |
|---|
private Font font
private FontMetrics metic
private ch.sahits.game.openpatrician.model.Difficulty difficulity
private static ch.sahits.game.openpatrician.util.RandomNameLoader firstNameLoader
private static ch.sahits.game.openpatrician.util.RandomNameLoader lastNameLoader
private TextInput name
private TextInput lastName
private RadioButton male
private RadioButton female
private Spinner map
private Spinner home
private Spinner startYear
private Slider difficulty
private Spinner objective
private Slider speed
| Constructor Detail |
|---|
public NewGameView(Rectangle rect,
FontMetrics metric)
rect - metric - | Method Detail |
|---|
private void createComponents()
private Runnable createStartButtonClickAction()
private List<String> getObjectiveList()
private List<String> getGameSpeedList()
private List<String> getDificutlyList()
private List<String> getStartYears()
private List<String> getHomeTowns4Map()
private RadioButton addRadioButton(String label,
boolean selected,
SelectableGroup group)
RadioButton to the view.
There should only on radio button be defined, that is selected in the same group
label - of the radio buttonselected - flag indicating if the button is currently selected.group - the button belongs to
private TextInput addInput(String value)
TextInput field with an optional preset text
value - optional text of the input field
TextInput fieldprivate ISahitsComponent addLabel(String name)
name -
private Spinner addSpinner(List<String> elements)
elements - List of elements in the spinner
private Slider addSlider(List<String> elements)
elements - List of the selectable values. There should be only a few
private Button addButton(String text)
text - label of the button
private List<String> getMapList()
private void setFont(ISahitsComponent comp)
comp - private boolean validInput()
public void setDifficulity(ch.sahits.game.openpatrician.model.Difficulty difficulity)
difficulity - private static String getRandomFirstName()
private static String getRandomLastName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||