Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 12-10-2011, 09:34 PM
Octocat Octocat is offline
Approved Member
 
Join Date: Dec 2011
Posts: 22
Default

Another solution, based on the example above

Code:
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");  
  }
}
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.