当前位置: 首页>>代码示例>>C#>>正文


C# Daide.TokenMessage类代码示例

本文整理汇总了C#中Polarsoft.Diplomacy.Daide.TokenMessage的典型用法代码示例。如果您正苦于以下问题:C# TokenMessage类的具体用法?C# TokenMessage怎么用?C# TokenMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TokenMessage类属于Polarsoft.Diplomacy.Daide命名空间,在下文中一共展示了TokenMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessOFF

 protected override void ProcessOFF(TokenMessage msg)
 {
     base.ProcessOFF(msg);
     this.parent.Invoke( new VoidDelegate( delegate
     {
         this.parent.Close();
     }));
 }
开发者ID:evandrix,项目名称:DAIDE10,代码行数:8,代码来源:ConsBot.cs

示例2: CreateMapFromMDF

 public static void CreateMapFromMDF(TokenMessage msg, Game game)
 {
     TokenMessage msgProvinces = msg.SubMessages[2];
     TokenMessage msgSupplyCenterProvinces = msgProvinces.SubMessages[0];
     foreach(TokenMessage message in msgSupplyCenterProvinces.SubMessages)
     {
         for (int index = 1; index < message.SubMessages.Count; ++index)
         {
             Province province = GetProvince(message.SubMessages[index].Tokens[0], game);
             foreach(Token powerToken in message.SubMessages[0].Tokens)
             {
                 Power power = GetPower(powerToken, game);
                 if (power != null)
                 {
                     power.HomeProvinces.Add(province);
                 }
             }
         }
     }
     //Adjacencies
     TokenMessage msgAdjacencies = msg.SubMessages[3];
     foreach(TokenMessage msgAdjacency in msgAdjacencies.SubMessages)
     {
         Province fromProvince = game.Map.Provinces[msgAdjacency.Tokens[0].ToString()];
         for (int index = 1; index < msgAdjacency.SubMessages.Count; ++index)
         {
             TokenMessage msgUnitAndAdj = msgAdjacency.SubMessages[index];
             Location fromLocation;
             UnitType unitType;
             if (msgUnitAndAdj.SubMessages.Count == 0)
             {
                 fromLocation = GetOrCreateLocation(fromProvince, msgUnitAndAdj);
                 unitType = GetUnitType(msgUnitAndAdj.Tokens[0]);
             }
             else
             {
                 fromLocation = GetOrCreateLocation(fromProvince, msgUnitAndAdj.SubMessages[0]);
                 unitType = GetUnitType(msgUnitAndAdj.SubMessages[0].Tokens[0]);
             }
             for (int ii = 1; ii < msgUnitAndAdj.SubMessages.Count; ++ii)
             {
                 Location toLocation = GetOrCreateLocation(unitType, msgUnitAndAdj.SubMessages[ii], game);
                 Trace.WriteLineIf(mySwitch.Enabled,
                     string.Format(CultureInfo.InvariantCulture,
                     ErrorMessages.Util_Trace_NewAdjacency,
                     fromLocation.ToString(), toLocation.ToString()),
                         traceCategory);
                 fromLocation.AdjacentLocations.Add(toLocation);
             }
         }
     }
     game.Map.FinalSetup();
 }
开发者ID:evandrix,项目名称:DAIDE10,代码行数:53,代码来源:Util.cs

示例3: ProcessNOW

 protected override void ProcessNOW(TokenMessage msg)
 {
     switch( this.Game.Turn.Phase )
     {
         case Phase.Spring:
             OrderMoves();
             break;
         case Phase.Summer:
             OrderRetreats();
             break;
         case Phase.Fall:
             OrderMoves();
             break;
         case Phase.Autumn:
             OrderRetreats();
             break;
         case Phase.Winter:
             OrderBuildsAndDisbands();
             break;
     }
     SubmitOrders();
 }
开发者ID:evandrix,项目名称:DAIDE10,代码行数:22,代码来源:ConsBot.cs

示例4: 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 );
//.........这里部分代码省略.........
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:101,代码来源:BaseBot.cs

示例5: ProcessYES_Unexpected

 /// <summary>Processes an unexpected YES message.
 /// The default version sends the message to the log.
 /// </summary>
 /// <param name="msg">The YES message.</param>
 /// <param name="confirmedMessage">The message that was unexpected.</param>
 protected virtual void ProcessYES_Unexpected(TokenMessage msg, TokenMessage confirmedMessage)
 {
     Trace.WriteLineIf(baseBotSwitch.Enabled,
         string.Format(CultureInfo.InvariantCulture,
         ErrorMessages.Basebot_Trace_UnexpectedMessage,
         "YES", msg.ToString()), traceCategory);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:12,代码来源:BaseBot.cs

示例6: ProcessTME

 /// <summary>Processes a TME message (Indicates the number of seconds until the next deadline).
 /// The default version does nothing.
 /// </summary>
 /// <param name="msg">The TME message.</param>
 protected virtual void ProcessTME(TokenMessage msg)
 {
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:7,代码来源:BaseBot.cs

示例7: ProcessSVE

 /// <summary>Processes a SVE message (Save the game).
 /// The default version does responds with a YES message (but does not save the game).
 /// </summary>
 /// <param name="msg">The SVE message.</param>
 protected virtual void ProcessSVE(TokenMessage msg)
 {
     this.connection.Send(Token.YES & msg);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:8,代码来源:BaseBot.cs

示例8: ProcessREJ_Unexpected

 /// <summary>Processes an unexpected REJ message.
 /// The default version sends the message to the log.
 /// </summary>
 /// <param name="msg">The REJ message.</param>
 /// <param name="rejectMessage">The message that was unexpected.</param>
 protected virtual void ProcessREJ_Unexpected(TokenMessage msg, TokenMessage rejectMessage)
 {
     Trace.WriteLineIf( baseBotSwitch.Enabled,
         string.Format(CultureInfo.InvariantCulture,
         ErrorMessages.Basebot_Trace_UnexpectedMessage,
         "REJ", msg.ToString()), traceCategory);
     Debug.Assert(false);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:13,代码来源:BaseBot.cs

示例9: ProcessOFF

 /// <summary>Processes an OFF message (Turn off).
 /// The default version sets the <see cref="EndOfGameCause"/> to <see cref="FinishingCause.Off"/>.
 /// </summary>
 /// <param name="msg">The OFF message.</param>
 protected virtual void ProcessOFF(TokenMessage msg)
 {
     this.finishingCause = FinishingCause.Off;
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:8,代码来源:BaseBot.cs

示例10: PreProcessSCO

 private void PreProcessSCO(TokenMessage msg)
 {
     Util.UpdateGameFromSCO(msg, this.game);
     ProcessSCO(msg);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:5,代码来源:BaseBot.cs

示例11: PreProcessREJ_NOT

 private void PreProcessREJ_NOT(TokenMessage msg, TokenMessage rejectMessage)
 {
     Token command = rejectMessage.SubMessages[1].Tokens[0];
     switch( command.ToString().ToUpper(CultureInfo.InvariantCulture) )
     {
         case "DRW":
             ProcessREJ_NOT_DRW(msg, rejectMessage);
             break;
         case "GOF":
             ProcessREJ_NOT_GOF(msg, rejectMessage);
             break;
         default:
             ProcessREJ_NOT_Unexpected(msg, rejectMessage);
             break;
     }
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:16,代码来源:BaseBot.cs

示例12: PreProcessREJ

 private void PreProcessREJ(TokenMessage msg)
 {
     TokenMessage rejectMessage = msg.SubMessages[1];
     switch( rejectMessage.Tokens[0].ToString().ToUpper(CultureInfo.InvariantCulture) )
     {
         case "ADM":
             ProcessREJ_ADM(msg, rejectMessage);
             break;
         case "DRW":
             ProcessREJ_DRW(msg, rejectMessage);
             break;
         case "GOF":
             ProcessREJ_GOF(msg, rejectMessage);
             break;
         case "HLO":
             ProcessREJ_HLO(msg, rejectMessage);
             break;
         case "HST":
             ProcessREJ_HST(msg, rejectMessage);
             break;
         case "IAM":
             ProcessREJ_IAM(msg, rejectMessage);
             break;
         case "NME":
             ProcessREJ_NME(msg, rejectMessage);
             break;
         case "NOT":
             PreProcessREJ_NOT(msg, rejectMessage);
             break;
         case "NOW":
             ProcessREJ_NOW(msg, rejectMessage);
             break;
         case "ORD":
             ProcessREJ_ORD(msg, rejectMessage);
             break;
         case "SCO":
             ProcessREJ_SCO(msg, rejectMessage);
             break;
         case "SND":
             ProcessREJ_SND(msg, rejectMessage);
             break;
         case "SUB":
             ProcessREJ_SUB(msg, rejectMessage);
             break;
         case "TME":
             ProcessREJ_TME(msg, rejectMessage);
             break;
         default:
             ProcessREJ_Unexpected(msg, rejectMessage);
             break;
     }
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:52,代码来源:BaseBot.cs

示例13: PreProcessOUT

 private void PreProcessOUT(TokenMessage msg)
 {
     //TODO: Press check.
     ProcessOUT(msg);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:5,代码来源:BaseBot.cs

示例14: PreProcessORD

 private void PreProcessORD(TokenMessage msg)
 {
     //Util.UpdateGameFromORD(msg, this.game);
     ProcessORD(msg);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:5,代码来源:BaseBot.cs

示例15: PreProcessNOW

 private void PreProcessNOW(TokenMessage msg)
 {
     BeforeNewTurn();
     Util.UpdateGameFromNOW(msg, this.game);
     this.orders.Clear();
     ProcessNOW(msg);
 }
开发者ID:trojanguard25,项目名称:diplomacy,代码行数:7,代码来源:BaseBot.cs


注:本文中的Polarsoft.Diplomacy.Daide.TokenMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。