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
  #2  
Old 05-21-2012, 10:41 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

For example i use this in my dll:
Code:
using System.Collections.Generic;
using System.Globalization;
using maddox.game;
using maddox.game.world;

namespace COD
{
    public static class Message
    {
        static readonly IGamePlay GamePlay = Strategy.THIS.GamePlay;


        public static void ToChatbar(string msg, params object[] args)
        {
            GamePlay.gpLogServer(null, msg, args);
        }


        public static void ToChatbar(Player player, string msg, params object[] args)
        {
            if (player != null)
                GamePlay.gpLogServer(new[] { player }, msg, args);
        }


        public static void ToChatbar(int army, string msg, params object[] args)
        {
            var consignees = new List<Player>();

            if (GamePlay.gpPlayer() != null)
                consignees.Add(GamePlay.gpPlayer());
            if (GamePlay.gpRemotePlayers() != null)
                consignees.AddRange(GamePlay.gpRemotePlayers());

            if (army == -1)
                GamePlay.gpLogServer(null, msg, args);
            else if (consignees.Exists(item => item.Army() == army))
                GamePlay.gpLogServer(consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
        }


        public static void ToScreen(string msg, params object[] args)
        {
            GamePlay.gpHUDLogCenter(null, msg, args);
        }


        public static void ToScreen(Player player, string msg, params object[] args)
        {
            if (player != null)
                GamePlay.gpHUDLogCenter(new[] { player }, msg, args);
        }


        public static void ToScreen(int army, string msg, params object[] args)
        {
            var consignees = new List<Player>();

            if (GamePlay.gpPlayer() != null)
                consignees.Add(GamePlay.gpPlayer());
            if (GamePlay.gpRemotePlayers() != null)
                consignees.AddRange(GamePlay.gpRemotePlayers());

            if (army == -1)
                GamePlay.gpHUDLogCenter(null, msg, args);
            else if (consignees.Exists(item => item.Army() == army))
                GamePlay.gpHUDLogCenter(consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
        }
        

        public static void ToScreenCountDown(string message, string endMessage, int seconds)
        {
            string tmpMessage = message + " ";
            int count = 0;

            while (count < seconds)
            {
                Strategy.THIS.Timeout(count++, () =>
                {
                    ToScreen(tmpMessage + seconds--.ToString(CultureInfo.InvariantCulture));
                });
            }
            Strategy.THIS.Timeout(count, () => ToScreen(endMessage));
        }


        public static void ToScreenCountDown(Player player, string message, string endMessage, int seconds)
        {
            string tmpMessage = message + " ";
            int count = 0;

            while (count < seconds)
            {
                Strategy.THIS.Timeout(count++, () =>
                {
                    ToScreen(player, tmpMessage + seconds--.ToString(CultureInfo.InvariantCulture));
                });
            }
            Strategy.THIS.Timeout(count, () => ToScreen(player, endMessage));
        }


        public static void ToScreenCountDown(int army, string message, string endMessage, int seconds)
        {
            string tmpMessage = message + " ";
            int count = 0;

            while (count < seconds)
            {
                Strategy.THIS.Timeout(count++, () =>
                    {
                        ToScreen(army, tmpMessage + seconds--.ToString(CultureInfo.InvariantCulture));
                    });
                
            }
            Strategy.THIS.Timeout(count, () => ToScreen(army, endMessage));
        }

    }
}
In the script file i use

Code:
//$reference parts/core/COD.dll  //reference to my dll (Assembly)
using System;
using maddox.game;
using maddox.game.world;
using COD;  //My namespace

public class Mission : AMission
{

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

       Message.ToChatbar(player, "Welcome {0}", player);
       
        
    }
}
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 01:38 PM.


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