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


C# Event.Name方法代码示例

本文整理汇总了C#中Event.Name方法的典型用法代码示例。如果您正苦于以下问题:C# Event.Name方法的具体用法?C# Event.Name怎么用?C# Event.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event.Name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayDraculaAlly

 /// <summary>
 /// Resolves the situation when Dracula plays an Ally card
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="eventPlayedByDracula">The Ally Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayDraculaAlly(GameState game, Event eventPlayedByDracula, DecisionMaker logic)
 {
     Console.WriteLine("Dracula drew ally {0}", eventPlayedByDracula.Name());
     Event allyToKeep;
     if (game.DraculaAlly == null)
     {
         allyToKeep = eventPlayedByDracula;
     }
     else
     {
         game.EventDiscard.Add(game.DraculaAlly);
         allyToKeep = logic.ChooseAllyToKeep(game, game.DraculaAlly.Event, eventPlayedByDracula);
     }
     game.DraculaAlly = game.EventDiscard.Find(card => card.Event == allyToKeep);
     game.EventDiscard.Remove(game.DraculaAlly);
     Console.WriteLine("{0} kept", allyToKeep.Name());
     game.Dracula.EncounterHandSize = game.DraculaAlly.Event == Event.DraculasBrides ? 7 : 5;
     game.Dracula.EventHandSize = game.DraculaAlly.Event == Event.ImmanuelHildesheim ? 6 : 4;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:25,代码来源:Program.cs

示例2: DraculaIsPlayingDevilishPowerToCancelEvent

 /// <summary>
 /// Determines if Dracula is playing Devilish Power to cancel an Event played by a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="eventBeingPlayedNow">The Event being played now</param>
 /// <param name="eventInitiallyPlayed">The Event initially played at the beginning of this exchange</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Devilish Power</returns>
 private static bool DraculaIsPlayingDevilishPowerToCancelEvent(GameState game, Event eventBeingPlayedNow,
     Event eventInitiallyPlayed, DecisionMaker logic, HunterPlayer hunterPlayingEvent)
 {
     if (logic.ChooseToCancelEventWithDevilishPower(game, eventBeingPlayedNow, eventInitiallyPlayed, hunterPlayingEvent))
     {
         Console.WriteLine("Dracula is playing Devilish Power to cancel {0}", eventBeingPlayedNow.Name());
         game.Dracula.DiscardEvent(Event.DevilishPower, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.DevilishPower, eventInitiallyPlayed, logic) > 0)
         {
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:23,代码来源:Program.cs

示例3: HunterPlayingGoodLuckToCancelDraculaEvent

 /// <summary>
 /// Determines if a Hunter is playing Good Luck to cancel an Event played by Dracula
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="draculaEventBeingPlayed">The Event being played now</param>
 /// <param name="eventInitiallyPlayed">The Event initially played at the beginning of this exchange</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>An int corresponding to the Hunter playing Good Luck, 0 if none</returns>
 private static int HunterPlayingGoodLuckToCancelDraculaEvent(GameState game, Event draculaEventBeingPlayed, Event eventInitiallyPlayed, DecisionMaker logic)
 {
     Console.WriteLine(
         "Will anyone play Good Luck to cancel {0}? 0= Nobody, {1}= {2}, {3}= {4}, {5}= {6}, {7}= {8}",
         draculaEventBeingPlayed.Name(), (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(),
         (int)Hunter.DrSeward, Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(),
         (int)Hunter.MinaHarker, Hunter.MinaHarker.Name());
     var answer = -1;
     while (answer == -1)
     {
         if (int.TryParse(Console.ReadLine(), out answer))
         {
             if (answer < 0 || answer > 4)
             {
                 answer = -1;
             }
         }
     }
     if (answer > 0)
     {
         game.Hunters[answer].DiscardEvent(game, Event.GoodLuck);
         if (DraculaIsPlayingDevilishPowerToCancelEvent(game, Event.GoodLuck, eventInitiallyPlayed, logic, game.Hunters[answer]))
         {
             game.Dracula.DiscardEvent(Event.DevilishPower, game.EventDiscard);
             return 0;
         }
     }
     return answer;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:37,代码来源:Program.cs


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