diff options
Diffstat (limited to 'src/jrummikub/view/impl')
-rw-r--r-- | src/jrummikub/view/impl/SettingsPanel.java | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index 5eb82fb..95089a3 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -17,6 +17,7 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; import javax.swing.Box; import javax.swing.BoxLayout; @@ -44,6 +45,7 @@ import jrummikub.control.turn.TurnControlFactory; import jrummikub.control.turn.TurnControlFactory.Type; import jrummikub.model.GameSettings; import jrummikub.model.PlayerSettings; +import jrummikub.model.StoneColor; import jrummikub.util.Event; import jrummikub.util.Event1; import jrummikub.util.Event2; @@ -66,6 +68,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private JSpinner initialMeldThresholdSpinner; private JSpinner stoneSetNumberSpinner; + private JSpinner highestValueSpinner; + private JSpinner numberOfStonesDealtSpinner; private JSpinner jokerNumberSpinner; private Event startGameEvent = new Event(); @@ -77,6 +81,9 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private Event1<Integer> changeInitialMeldThresholdEvent = new Event1<Integer>(); private Event1<Integer> changeJokerNumberEvent = new Event1<Integer>(); private Event1<Integer> changeStoneSetNumberEvent = new Event1<Integer>(); + private Event1<Integer> changeNumberOfStonesDealtEvent = new Event1<Integer>(); + private Event1<Integer> changeHighestValueEvent = new Event1<Integer>(); + private Event1<Set<StoneColor>> changeStoneColorsEvent = new Event1<Set<StoneColor>>(); @Override public IEvent getStartGameEvent() { @@ -114,6 +121,21 @@ class SettingsPanel extends JPanel implements ISettingsPanel { } @Override + public IEvent1<Integer> getChangeNumberOfStonesDealtEvent() { + return changeNumberOfStonesDealtEvent; + } + + @Override + public IEvent1<Integer> getChangeHighestValueEvent() { + return changeHighestValueEvent; + } + + @Override + public IEvent1<Set<StoneColor>> getChangeStoneColorsEvent() { + return changeStoneColorsEvent; + } + + @Override public void setError(SettingsError error) { switch (error) { case NO_ERROR: @@ -178,6 +200,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel { initialMeldThresholdSpinner.setValue(gameSettings .getInitialMeldThreshold()); stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber()); + highestValueSpinner.setValue(gameSettings.getHighestValue()); + numberOfStonesDealtSpinner.setValue(gameSettings.getNumberOfStonesDealt()); jokerNumberSpinner.setValue(gameSettings.getJokerNumber()); playerSettingsViewport.revalidate(); @@ -251,13 +275,21 @@ class SettingsPanel extends JPanel implements ISettingsPanel { stoneSetNumberSpinner = makeOptionSpinner(1, 1, 999, 1, changeStoneSetNumberEvent); - makeOptionLabel(2, "Jokeranzahl:"); - jokerNumberSpinner = makeOptionSpinner(2, 1, 999, 1, + makeOptionLabel(2, "H\u00f6chster Steinwert:"); + highestValueSpinner = makeOptionSpinner(2, 3, 99, 1, + changeHighestValueEvent); + + makeOptionLabel(3, "Anzahl Startsteine:"); + numberOfStonesDealtSpinner = makeOptionSpinner(3, 1, 999, 1, + changeNumberOfStonesDealtEvent); + + makeOptionLabel(4, "Jokeranzahl:"); + jokerNumberSpinner = makeOptionSpinner(4, 1, 999, 1, changeJokerNumberEvent); GridBagConstraints c = new GridBagConstraints(); c.gridx = 1; - c.gridy = 3; + c.gridy = 5; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; |