コード例 #1
0
	/** 
	 * Constructor of the AudioFilesSettings class.
	 * 
	 * The constructor of the AudioFilesSettings class accepts
	 * the game name, players' settings and menu settings and 
	 * sets up the audio  files' settings for the specified game. 
	 * 
	 * @param gameName - the name of the game to be played (string)
	 * @param playersSettings - the settings for the players
	 * @param menuSetting - the settings for menu
	 * @throw Exception - rethrows all catched exceptions after print their message to debug log
	 * @author Konstantinos Drossos
	 */
	public AudioFilesSettings(string gameName, string playerSetting, string menuSetting) {

		AudioXMLDocument gameSettings = new AudioXMLDocument() ;

		try { 
			gameSettings.LoadSettingsXML(gameName); 
		} catch (Exception e) { Debug.Log (e.Message); throw e; }

		this.initialiseLists ();

		try { 
			this.nOfPlayers_max = gameSettings.MaximumPlayers;
			this.nOfPlayers_min = gameSettings.MinimumPlayers;
			this.audioSettingsForPlayers = gameSettings.getAudioSettingsOf ("players");
			this.audioSettingsForMenu = gameSettings.getAudioSettingsOf ("menu");
		} catch (Exception e) { Debug.Log (e.Message); throw e; }

		this.currentAudioSettingForMenu = menuSetting;
		this.currentAudioSettingForPlayer = playerSetting;

        try {
			foreach (int playerIndx in Enumerable.Range(0, this.nOfPlayers_max) ) {
				this.audioFilesForPlayer.Add ( gameSettings.getFilesForPlayer(playerIndx, playerSetting) );
			}

			this.audioFilesForMenu = gameSettings.getFilesForMenu(menuSetting);
		} catch (Exception e) { Debug.Log (e.Message); throw e; }

		this.gameName = gameName;
	}
コード例 #2
0
	/**
	 * Changes the current settings for menu.
	 * 
	 * This public method changes the current sound settings 
	 * for menu.
	 * 
	 * @param newSettings - the name of the new settings (string)
	 * @author Konstantinos Drossos
	 */
	public void changeSettingsForMenu (string newSettings) {
		AudioXMLDocument gameSettings = new AudioXMLDocument() ;
		gameSettings.LoadSettingsXML (this.gameName);

		this.audioFilesForMenu = gameSettings.getFilesForMenu(newSettings);
		this.currentAudioSettingForMenu = newSettings;
	}
コード例 #3
0
	/**
	 * Changes the current settings for a player.
	 * 
	 * This public method changes the current sound settings
	 * a specified player.
	 * 
	 * @param playerIndex - the index of the specified player (int)
	 * @param newSettings - the name of the new settings (string)
	 * @author Konstantinos Drossos
	 */
	public void changeSettingsForPlayer(int playerIndex, string newSettings) {

		AudioXMLDocument gameSettings = new AudioXMLDocument() ;
		gameSettings.LoadSettingsXML (this.gameName);

		this.audioFilesForPlayer [playerIndex].Clear ();
		this.audioFilesForPlayer [playerIndex] = gameSettings.getFilesForPlayer (playerIndex, newSettings);
		this.currentAudioSettingForPlayer = newSettings;
	}