|
From: Frederick W. <fre...@us...> - 2012-02-05 06:35:36
|
LocalisedText.properties | 3 +++
data/Properties.xml | 2 ++
rails/game/GameManager.java | 4 ++++
rails/game/GameManagerI.java | 2 ++
rails/sound/SoundConfig.java | 6 ++++--
rails/sound/SoundEventInterpreter.java | 28 ++++++++++++++++++++++++++--
6 files changed, 41 insertions(+), 4 deletions(-)
New commits:
commit 4439e439edd8982aca87b35c0ea64e331a4981cb
Author: Frederick Weld <fre...@gm...>
Date: Sun Feb 5 07:28:16 2012 +0100
Added new sfx options (gameOverPending and "laid last available tile")
diff --git a/LocalisedText.properties b/LocalisedText.properties
index 071d381..6aaa145 100644
--- a/LocalisedText.properties
+++ b/LocalisedText.properties
@@ -178,6 +178,7 @@ Config.infoText.sound.backgroundMusic=The only music file type supported is mp3.
Config.infoText.sound.backgroundMusic.stockRound=<html>Enter assignment of music files to phases.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax phaseName=complete file path<li>Default music is defined by omitting "phaseName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default music: <br><code>c:\SR-default.mp3</code><li>Set phase-dependent music and a default (for trains above 6): <br><code>2=c:\SR-2.mp3,3=c:\SR-3.mp3,4=c:\SR-4.mp3,5=c:\SR-5.mp3,6=c:\SR-6.mp3,c:\SR-D.mp3</code></ul> </html>
Config.infoText.sound.backgroundMusic.operatingRound=<html>Enter assignment of music files to phases.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax phaseName=complete file path<li>Default music is defined by omitting "phaseName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default music: <br><code>c:\OR-default.mp3</code><li>Set phase-dependent music and a default (for trains above 6): <br><code>2=c:\OR-2.mp3,3=c:\OR-3.mp3,4=c:\OR-4.mp3,5=c:\OR-5.mp3,6=c:\OR-6.mp3,c:\OR-D.mp3</code></ul> </html>
Config.infoText.sound.sfx=The only sound effects file type supported is mp3.
+Config.infoText.sound.sfx.gen.gameOverPending=<html>Sound effect is played in case of any event that triggers the end of the game. Examples:<ul><li>Bank is broken.<li>Share price reaches maximum (only game-end trigger for some 18xx variants).</ul></html>
Config.infoText.sound.sfx.gen.newCurrentPlayer=<html>Enter assignment of sound effect files to player names.<br>The assigned sound is played if the player becomes the active one - meaning, the user interface is responsive for this player's commands.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax playerName=complete file path<li>Default sound effect is defined by omitting "playerName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default sound effect: <br><code>c:\ChangeActivePlayer.mp3</code><li>Set player-dependent sound effect and a default (for all other players): <br><code>Tom=c:\ChangeActivePlayer_Tom.mp3,Sarah=c:\ChangeActivePlayer_Sarah.mp3,c:\ChangeActivePlayer_default.mp3</code></ul> </html>
Config.infoText.sound.sfx.or.buyTrain=<html>Enter assignment of sound effect files to train types.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax trainName=complete file path<li>Default sound effect is defined by omitting "trainName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default sound effect: <br><code>c:\BuyTrain-default.mp3</code><li>Set train-dependent sound effect and a default (for trains above 6): <br><code>2=c:\BuyTrain-2.mp3,3=c:\BuyTrain-3.mp3,4=c:\BuyTrain-4.mp3,5=c:\BuyTrain-5.mp3,6=c:\BuyTrain-6.mp3,c:\BuyTrain-D.mp3</code></ul> </html>
Config.infoText.sound.sfx.or.setRevenue=<html><ul><li>Only the latter portion of this file is played.<ul><li>For an average revenue, the last third is played.</ul><li>The higher the company's revenue the longer this file is played.<ul><li>But the file is at most played once as a whole.</li></ul></html>
@@ -216,6 +217,7 @@ Config.label.sound.backgroundMusic.startRound=Start Round
Config.label.sound.backgroundMusic.stockRound=Stock Round (several files)
Config.label.sound.backgroundMusic.operatingRound=Operating Round (several files)
Config.label.sound.sfx=Sound Effects
+Config.label.sound.sfx.gen.gameOverPending=Imminent Game End
Config.label.sound.sfx.gen.newCurrentPlayer=Change of active player
Config.label.sound.sfx.gen.pass=Pass
Config.label.sound.sfx.gen.select=Select (hexes, click fields)
@@ -228,6 +230,7 @@ Config.label.sound.sfx.or.decision.split=Split Revenue
Config.label.sound.sfx.or.decision.withhold=Withhold Revenue
Config.label.sound.sfx.or.layTile.city=Lay Tile (city)
Config.label.sound.sfx.or.layTile.track=Lay Tile (track, town)
+Config.label.sound.sfx.or.layTile.lastTileLaid=Last available tile is laid
Config.label.sound.sfx.or.layToken=Lay Token
Config.label.sound.sfx.or.rotateTile=Rotate Tile
Config.label.sound.sfx.or.setRevenue=Set Revenue
diff --git a/data/Properties.xml b/data/Properties.xml
index 4802f74..da62099 100644
--- a/data/Properties.xml
+++ b/data/Properties.xml
@@ -77,6 +77,7 @@
<Property name="sound.sfx.gen.pass" type="FILE" />
<Property name="sound.sfx.gen.select" type="FILE" />
<Property name="sound.sfx.gen.newCurrentPlayer" type="STRING" />
+ <Property name="sound.sfx.gen.gameOverPending" type="FILE" />
<Property name="sound.sfx.str.bidStartItem" type="FILE" />
<Property name="sound.sfx.str.buyStartItem" type="FILE" />
<Property name="sound.sfx.sr.openingBell" type="FILE" />
@@ -89,6 +90,7 @@
<Property name="sound.sfx.or.rotateTile" type="FILE" />
<Property name="sound.sfx.or.layTile.track" type="FILE" />
<Property name="sound.sfx.or.layTile.city" type="FILE" />
+ <Property name="sound.sfx.or.layTile.lastTileLaid" type="FILE" />
<Property name="sound.sfx.or.layToken" type="FILE" />
<Property name="sound.sfx.or.setRevenue" type="FILE" />
<Property name="sound.sfx.or.decision.payout" type="FILE" />
diff --git a/rails/sound/SoundConfig.java b/rails/sound/SoundConfig.java
index 6867ddf..5e3aa03 100644
--- a/rails/sound/SoundConfig.java
+++ b/rails/sound/SoundConfig.java
@@ -24,6 +24,7 @@ public class SoundConfig {
public static final String KEY_BGM_OperatingRound = "sound.backgroundMusic.operatingRound";
public static final String KEY_BGM_EndOfGameRound = "sound.backgroundMusic.endOfGameRound";
public static final String KEY_SFX_Enabled = "sound.sfx";
+ public static final String KEY_SFX_GEN_GameOverPending = "sound.sfx.gen.gameOverPending";
public static final String KEY_SFX_GEN_Pass = "sound.sfx.gen.pass";
public static final String KEY_SFX_GEN_Select = "sound.sfx.gen.select";
public static final String KEY_SFX_GEN_NewCurrentPlayer = "sound.sfx.gen.newCurrentPlayer";
@@ -37,8 +38,9 @@ public class SoundConfig {
public static final String KEY_SFX_SR_SellShare_NonPresident = "sound.sfx.sr.sellShare.nonPresident";
public static final String KEY_SFX_SR_CompanyFloats = "sound.sfx.sr.companyFloats";
public static final String KEY_SFX_OR_RotateTile = "sound.sfx.or.rotateTile";
- public static final String KEY_SFX_OR_LayTile_track = "sound.sfx.or.layTile.track";
- public static final String KEY_SFX_OR_LayTile_city = "sound.sfx.or.layTile.city";
+ public static final String KEY_SFX_OR_LayTile_Track = "sound.sfx.or.layTile.track";
+ public static final String KEY_SFX_OR_LayTile_City = "sound.sfx.or.layTile.city";
+ public static final String KEY_SFX_OR_LayTile_LastTileLaid = "sound.sfx.or.layTile.lastTileLaid";
public static final String KEY_SFX_OR_LayToken = "sound.sfx.or.layToken";
public static final String KEY_SFX_OR_SetRevenue = "sound.sfx.or.setRevenue";
public static final String KEY_SFX_OR_Decision_Payout = "sound.sfx.or.decision.payout";
diff --git a/rails/sound/SoundEventInterpreter.java b/rails/sound/SoundEventInterpreter.java
index 48a8df2..889ade6 100644
--- a/rails/sound/SoundEventInterpreter.java
+++ b/rails/sound/SoundEventInterpreter.java
@@ -105,10 +105,14 @@ public class SoundEventInterpreter {
LayTile lt = (LayTile)action;
if (lt.getLaidTile().getNumStations() == 0) {
//track upgrade
- player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_track);
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_Track);
} else {
//city upgrade
- player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_city);
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_City);
+ }
+ if (lt.getLaidTile().countFreeTiles() == 1) {
+ //last available tile is about to be laid
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_LastTileLaid);
}
} else if (action instanceof LayToken) {
@@ -194,6 +198,26 @@ public class SoundEventInterpreter {
});
}
+ //subscribe to changes to game over pending
+ if (gameManager.getGameOverPendingModel() != null) {
+ gameManager.getGameOverPendingModel().addObserver(
+ new Observer() {
+ private boolean gameOverPending = false;
+ public void update(Observable o, Object arg) {
+ if (o instanceof BooleanState) {
+ BooleanState s = (BooleanState)o;
+ if (!gameOverPending && s.booleanValue()) {
+ if (SoundConfig.isSFXEnabled()) {
+ player.playSFXByConfigKey (
+ SoundConfig.KEY_SFX_GEN_GameOverPending);
+ }
+ }
+ gameOverPending = s.booleanValue();
+ }
+ }
+ });
+ }
+
//subscribe to phase changes
if (gameManager.getPhaseManager() != null) {
gameManager.getPhaseManager().getCurrentPhaseModel().addObserver(
commit 2614a3132315acee7b4a2411314b26754accc5c9
Merge: 08f42f7 b16bcfb
Author: Frederick Weld <fre...@gm...>
Date: Sun Feb 5 07:28:05 2012 +0100
Exposed GameManager's GameOverPending BooleanState on interface
commit b16bcfb3f1d186b10fbe6fc6a8bae95019ad15bf
Author: Frederick Weld <fre...@gm...>
Date: Sun Feb 5 07:19:48 2012 +0100
Exposed GameManager's GameOverPending BooleanState on interface
diff --git a/LocalisedText.properties b/LocalisedText.properties
index 071d381..6aaa145 100644
--- a/LocalisedText.properties
+++ b/LocalisedText.properties
@@ -178,6 +178,7 @@ Config.infoText.sound.backgroundMusic=The only music file type supported is mp3.
Config.infoText.sound.backgroundMusic.stockRound=<html>Enter assignment of music files to phases.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax phaseName=complete file path<li>Default music is defined by omitting "phaseName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default music: <br><code>c:\SR-default.mp3</code><li>Set phase-dependent music and a default (for trains above 6): <br><code>2=c:\SR-2.mp3,3=c:\SR-3.mp3,4=c:\SR-4.mp3,5=c:\SR-5.mp3,6=c:\SR-6.mp3,c:\SR-D.mp3</code></ul> </html>
Config.infoText.sound.backgroundMusic.operatingRound=<html>Enter assignment of music files to phases.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax phaseName=complete file path<li>Default music is defined by omitting "phaseName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default music: <br><code>c:\OR-default.mp3</code><li>Set phase-dependent music and a default (for trains above 6): <br><code>2=c:\OR-2.mp3,3=c:\OR-3.mp3,4=c:\OR-4.mp3,5=c:\OR-5.mp3,6=c:\OR-6.mp3,c:\OR-D.mp3</code></ul> </html>
Config.infoText.sound.sfx=The only sound effects file type supported is mp3.
+Config.infoText.sound.sfx.gen.gameOverPending=<html>Sound effect is played in case of any event that triggers the end of the game. Examples:<ul><li>Bank is broken.<li>Share price reaches maximum (only game-end trigger for some 18xx variants).</ul></html>
Config.infoText.sound.sfx.gen.newCurrentPlayer=<html>Enter assignment of sound effect files to player names.<br>The assigned sound is played if the player becomes the active one - meaning, the user interface is responsive for this player's commands.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax playerName=complete file path<li>Default sound effect is defined by omitting "playerName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default sound effect: <br><code>c:\ChangeActivePlayer.mp3</code><li>Set player-dependent sound effect and a default (for all other players): <br><code>Tom=c:\ChangeActivePlayer_Tom.mp3,Sarah=c:\ChangeActivePlayer_Sarah.mp3,c:\ChangeActivePlayer_default.mp3</code></ul> </html>
Config.infoText.sound.sfx.or.buyTrain=<html>Enter assignment of sound effect files to train types.<ul><li>Separate the assignments by commas.<li>Each assignment has the syntax trainName=complete file path<li>Default sound effect is defined by omitting "trainName=" in the assignment.</ul><strong>Examples:</strong><ul><li>Set default sound effect: <br><code>c:\BuyTrain-default.mp3</code><li>Set train-dependent sound effect and a default (for trains above 6): <br><code>2=c:\BuyTrain-2.mp3,3=c:\BuyTrain-3.mp3,4=c:\BuyTrain-4.mp3,5=c:\BuyTrain-5.mp3,6=c:\BuyTrain-6.mp3,c:\BuyTrain-D.mp3</code></ul> </html>
Config.infoText.sound.sfx.or.setRevenue=<html><ul><li>Only the latter portion of this file is played.<ul><li>For an average revenue, the last third is played.</ul><li>The higher the company's revenue the longer this file is played.<ul><li>But the file is at most played once as a whole.</li></ul></html>
@@ -216,6 +217,7 @@ Config.label.sound.backgroundMusic.startRound=Start Round
Config.label.sound.backgroundMusic.stockRound=Stock Round (several files)
Config.label.sound.backgroundMusic.operatingRound=Operating Round (several files)
Config.label.sound.sfx=Sound Effects
+Config.label.sound.sfx.gen.gameOverPending=Imminent Game End
Config.label.sound.sfx.gen.newCurrentPlayer=Change of active player
Config.label.sound.sfx.gen.pass=Pass
Config.label.sound.sfx.gen.select=Select (hexes, click fields)
@@ -228,6 +230,7 @@ Config.label.sound.sfx.or.decision.split=Split Revenue
Config.label.sound.sfx.or.decision.withhold=Withhold Revenue
Config.label.sound.sfx.or.layTile.city=Lay Tile (city)
Config.label.sound.sfx.or.layTile.track=Lay Tile (track, town)
+Config.label.sound.sfx.or.layTile.lastTileLaid=Last available tile is laid
Config.label.sound.sfx.or.layToken=Lay Token
Config.label.sound.sfx.or.rotateTile=Rotate Tile
Config.label.sound.sfx.or.setRevenue=Set Revenue
diff --git a/data/Properties.xml b/data/Properties.xml
index 4802f74..da62099 100644
--- a/data/Properties.xml
+++ b/data/Properties.xml
@@ -77,6 +77,7 @@
<Property name="sound.sfx.gen.pass" type="FILE" />
<Property name="sound.sfx.gen.select" type="FILE" />
<Property name="sound.sfx.gen.newCurrentPlayer" type="STRING" />
+ <Property name="sound.sfx.gen.gameOverPending" type="FILE" />
<Property name="sound.sfx.str.bidStartItem" type="FILE" />
<Property name="sound.sfx.str.buyStartItem" type="FILE" />
<Property name="sound.sfx.sr.openingBell" type="FILE" />
@@ -89,6 +90,7 @@
<Property name="sound.sfx.or.rotateTile" type="FILE" />
<Property name="sound.sfx.or.layTile.track" type="FILE" />
<Property name="sound.sfx.or.layTile.city" type="FILE" />
+ <Property name="sound.sfx.or.layTile.lastTileLaid" type="FILE" />
<Property name="sound.sfx.or.layToken" type="FILE" />
<Property name="sound.sfx.or.setRevenue" type="FILE" />
<Property name="sound.sfx.or.decision.payout" type="FILE" />
diff --git a/rails/game/GameManager.java b/rails/game/GameManager.java
index c4c2289..f35ed6a 100644
--- a/rails/game/GameManager.java
+++ b/rails/game/GameManager.java
@@ -1380,6 +1380,10 @@ public class GameManager implements ConfigurableComponentI, GameManagerI {
return gameOver.booleanValue();
}
+ public ModelObject getGameOverPendingModel() {
+ return gameOverPending;
+ }
+
public void setGameOverReportedUI(boolean b){
gameOverReportedUI = b;
}
diff --git a/rails/game/GameManagerI.java b/rails/game/GameManagerI.java
index f098de6..06b404c 100644
--- a/rails/game/GameManagerI.java
+++ b/rails/game/GameManagerI.java
@@ -80,6 +80,8 @@ public interface GameManagerI extends MoveableHolder, ConfigurableComponentI {
*/
public abstract boolean isGameOver();
+ public ModelObject getGameOverPendingModel();
+
public void setGameOverReportedUI(boolean b);
public boolean getGameOverReportedUI();
diff --git a/rails/sound/SoundConfig.java b/rails/sound/SoundConfig.java
index 6867ddf..5e3aa03 100644
--- a/rails/sound/SoundConfig.java
+++ b/rails/sound/SoundConfig.java
@@ -24,6 +24,7 @@ public class SoundConfig {
public static final String KEY_BGM_OperatingRound = "sound.backgroundMusic.operatingRound";
public static final String KEY_BGM_EndOfGameRound = "sound.backgroundMusic.endOfGameRound";
public static final String KEY_SFX_Enabled = "sound.sfx";
+ public static final String KEY_SFX_GEN_GameOverPending = "sound.sfx.gen.gameOverPending";
public static final String KEY_SFX_GEN_Pass = "sound.sfx.gen.pass";
public static final String KEY_SFX_GEN_Select = "sound.sfx.gen.select";
public static final String KEY_SFX_GEN_NewCurrentPlayer = "sound.sfx.gen.newCurrentPlayer";
@@ -37,8 +38,9 @@ public class SoundConfig {
public static final String KEY_SFX_SR_SellShare_NonPresident = "sound.sfx.sr.sellShare.nonPresident";
public static final String KEY_SFX_SR_CompanyFloats = "sound.sfx.sr.companyFloats";
public static final String KEY_SFX_OR_RotateTile = "sound.sfx.or.rotateTile";
- public static final String KEY_SFX_OR_LayTile_track = "sound.sfx.or.layTile.track";
- public static final String KEY_SFX_OR_LayTile_city = "sound.sfx.or.layTile.city";
+ public static final String KEY_SFX_OR_LayTile_Track = "sound.sfx.or.layTile.track";
+ public static final String KEY_SFX_OR_LayTile_City = "sound.sfx.or.layTile.city";
+ public static final String KEY_SFX_OR_LayTile_LastTileLaid = "sound.sfx.or.layTile.lastTileLaid";
public static final String KEY_SFX_OR_LayToken = "sound.sfx.or.layToken";
public static final String KEY_SFX_OR_SetRevenue = "sound.sfx.or.setRevenue";
public static final String KEY_SFX_OR_Decision_Payout = "sound.sfx.or.decision.payout";
diff --git a/rails/sound/SoundEventInterpreter.java b/rails/sound/SoundEventInterpreter.java
index 48a8df2..889ade6 100644
--- a/rails/sound/SoundEventInterpreter.java
+++ b/rails/sound/SoundEventInterpreter.java
@@ -105,10 +105,14 @@ public class SoundEventInterpreter {
LayTile lt = (LayTile)action;
if (lt.getLaidTile().getNumStations() == 0) {
//track upgrade
- player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_track);
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_Track);
} else {
//city upgrade
- player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_city);
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_City);
+ }
+ if (lt.getLaidTile().countFreeTiles() == 1) {
+ //last available tile is about to be laid
+ player.playSFXByConfigKey (SoundConfig.KEY_SFX_OR_LayTile_LastTileLaid);
}
} else if (action instanceof LayToken) {
@@ -194,6 +198,26 @@ public class SoundEventInterpreter {
});
}
+ //subscribe to changes to game over pending
+ if (gameManager.getGameOverPendingModel() != null) {
+ gameManager.getGameOverPendingModel().addObserver(
+ new Observer() {
+ private boolean gameOverPending = false;
+ public void update(Observable o, Object arg) {
+ if (o instanceof BooleanState) {
+ BooleanState s = (BooleanState)o;
+ if (!gameOverPending && s.booleanValue()) {
+ if (SoundConfig.isSFXEnabled()) {
+ player.playSFXByConfigKey (
+ SoundConfig.KEY_SFX_GEN_GameOverPending);
+ }
+ }
+ gameOverPending = s.booleanValue();
+ }
+ }
+ });
+ }
+
//subscribe to phase changes
if (gameManager.getPhaseManager() != null) {
gameManager.getPhaseManager().getCurrentPhaseModel().addObserver(
|