Вот такой вариант использует Кодиак
http://forum.1cpublishing.eu/showpos...74&postcount=2
For example i use this in my dll:
Код:
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
Код:
//$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);
}
}
Это то, что нужно, кажется. Что вот эта строчка значит:
Код:
static readonly IGamePlay GamePlay = Strategy.THIS.GamePlay;