Можно еще вот так:
Код:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
/// <summary>
/// Returns a list of all users
/// </summary>
private List<Player> GetPlayers()
{
var result = new List<Player>();
if (GamePlay.gpRemotePlayers() != null)
{
result.AddRange(GamePlay.gpRemotePlayers());
}
if (GamePlay.gpPlayer() != null)
{
result.Add(GamePlay.gpPlayer());
}
return result;
}
/// <summary>
/// Returns a list of all users of specified army
/// </summary>
private List<Player> GetPlayers(int army)
{
return (army < 0) ? GetPlayers() : GetPlayers().FindAll(player => player.Army().Equals(army));
}
/// <summary>
/// Sends a message to the screens of all users of specified army
/// </summary>
private void BroadcastScreenMessage(int army, string format, params object[] args)
{
GamePlay.gpHUDLogCenter(GetPlayers(army).ToArray(), format, args);
}
/// <summary>
/// Sends a message to the logs of all users of specified army
/// </summary>
private void BroadcastLogMessage(int army, string format, params object[] args)
{
GamePlay.gpLogServer(GetPlayers(army).ToArray(), format, args);
}
public override void OnBattleStarted()
{
base.OnBattleStarted();
BroadcastScreenMessage(1, "Your army color: {0}, your side: {1}", "Red", "Allies");
BroadcastScreenMessage(2, "Your army color: {0}, your side: {1}", "Blue", "Axis");
BroadcastLogMessage(1, "Big group of german {0} heading to {1}.", "Bombers", "London");
BroadcastLogMessage(2, "Group of our {0} need to cover in their raid to {1}, rendezvous point at sector {2}.", "Heinkels", "London", "G9");
}
}