netwar.settings
Class GameSettings
java.lang.Object
|
+--netwar.settings.GameSettings
- All Implemented Interfaces:
- java.io.Serializable
- public class GameSettings
- extends java.lang.Object
- implements java.io.Serializable
STRUCT style class used for network coordination.
Contains a single GlobalSettings, plus one PlayerSettings per player.
When a setting is changed, it is submitted to the server, and propogated to all clients.
The proper way to change a player's PlayerSettings, for example, is to alter
Netwar.netwar.pset (a PlayerSettings maintained for just this purpose) and then call:
Netwar.nc.clientBroadcastSettings(Netwar.nc.playerNumber, Netwar.netwar.pset, null);
- Author:
- Group N2 - Project Netwar, Daniel Grund
- See Also:
- Serialized Form
|
Constructor Summary |
GameSettings()
Creates a new instance of GameSettings |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
currentSettings
public static GameSettings currentSettings
- The current collection of settings. This is updated by the server.
playerCount
public int playerCount
- The number of players currently connected to the game. This is subject to change until startGame() is called.
global
public GlobalSettings global
- The GlobalSettings, which contains initialization data not specific to any one player.
players
public PlayerSettings[] players
- The PlayerSettings array, which contains the player-specific initialization data for each player.
GameSettings
public GameSettings()
- Creates a new instance of GameSettings
reviseSettings
public void reviseSettings(int pNumber,
PlayerSettings pset,
GlobalSettings gset)
- Alters this GameSettings by replacing player pNumber's settings, or if pNumber == 0, replaces the GlobalSettings.
This should only be called by the NetworkServer. This is part a thread-safing technique made
necessary by the fact that all players will alter GameSettings.currentSettings at least once.