本文整理汇总了C#中Polarsoft.Diplomacy.Daide.TokenMessage.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TokenMessage.Add方法的具体用法?C# TokenMessage.Add怎么用?C# TokenMessage.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polarsoft.Diplomacy.Daide.TokenMessage
的用法示例。
在下文中一共展示了TokenMessage.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubmitOrders
/// <summary>Submits the <see cref="CurrentOrders"/> to the server.
/// </summary>
protected void SubmitOrders()
{
if( this.orders.Count == 0 )
{
return;
}
TokenMessage msg = new TokenMessage(Token.SUB);
foreach( Order order in this.orders )
{
TokenMessage msgOrder = new TokenMessage();
//object[] parameters = order.GetOrderParameters();
switch (order.OrderType)
{
case OrderType.Build :
{
BuildOrder o = order as BuildOrder;
//Debug.Assert(parameters.Length == 0);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.BLD );
break;
}
case OrderType.Convey :
{
ConveyOrder o = order as ConveyOrder;
//Debug.Assert(parameters.Length == 2);
//Debug.Assert(parameters[0] is Unit);
//Debug.Assert(parameters[1] is Location);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.CVY );
msgOrder.Add( Util.ToOrderFormat(o.ConveyedUnit).MessageEnclosed );
msgOrder.Add( Token.CTO );
msgOrder.Add( Util.ToOrderFormat(o.TargetProvince) );
break;
}
case OrderType.Disband :
{
DisbandOrder o = order as DisbandOrder;
//Debug.Assert(parameters.Length == 0);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.DSB );
break;
}
case OrderType.Hold :
{
HoldOrder o = order as HoldOrder;
//Debug.Assert(parameters.Length == 0);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.HLD );
break;
}
case OrderType.Move :
{
MoveOrder o = order as MoveOrder;
//Debug.Assert(parameters.Length == 1);
//Debug.Assert(parameters[0] is Location);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.MTO );
msgOrder.Add( Util.ToOrderFormat(o.TargetLocation) );
break;
}
case OrderType.MoveByConvoy :
{
MoveByConvoyOrder o = order as MoveByConvoyOrder;
//Debug.Assert(parameters.Length == 1);
//Debug.Assert(parameters[0] is Route);
//Route route = parameters[0] as Route;
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.CTO );
msgOrder.Add( Util.ToOrderFormat(o.Route.End) );
msgOrder.Add( Token.VIA );
TokenMessage via = new TokenMessage();
foreach (Province province in o.Route.Via.Provinces)
{
via.Add( Util.ToOrderFormat(province) );
}
msgOrder.Add( via.MessageEnclosed );
break;
}
case OrderType.Remove :
{
RemoveOrder o = order as RemoveOrder;
//Debug.Assert(parameters.Length == 0);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
msgOrder.Add( Token.REM );
break;
}
case OrderType.Retreat :
{
RetreatOrder o = order as RetreatOrder;
//Debug.Assert(parameters.Length == 1);
//Debug.Assert(parameters[0] is Location);
msgOrder.Add( Util.ToOrderFormat(o.Unit).MessageEnclosed );
//.........这里部分代码省略.........