本文整理汇总了C#中IGame.NewArenaCard方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.NewArenaCard方法的具体用法?C# IGame.NewArenaCard怎么用?C# IGame.NewArenaCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.NewArenaCard方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public void Handle(string logLine, IHsGameState gameState, IGame game)
{
var match = HsLogReaderConstants.ExistingHeroRegex.Match(logLine);
if(match.Success)
game.NewArenaDeck(match.Groups["id"].Value);
else
{
match = HsLogReaderConstants.ExistingCardRegex.Match(logLine);
if(match.Success)
{
try
{
game.NewArenaCard(match.Groups["id"].Value);
}
catch(Exception ex)
{
Logger.WriteLine("Error adding arena card: " + ex, "ArenaHandler");
}
}
else
{
match = HsLogReaderConstants.NewChoiceRegex.Match(logLine);
if(match.Success)
{
if(Database.GetHeroNameFromId(match.Groups["id"].Value, false) != null)
game.NewArenaDeck(match.Groups["id"].Value);
else
{
var cardId = match.Groups["id"].Value;
var timeSinceLastChoice = DateTime.Now.Subtract(_lastChoice).Milliseconds;
if(_lastChoiceId == cardId && timeSinceLastChoice < 1000)
{
Logger.WriteLine(string.Format("Card with the same ID ({0}) was chosen less {1} ms ago. Ignoring.", cardId, timeSinceLastChoice));
return;
}
try
{
game.NewArenaCard(cardId);
}
catch(Exception ex)
{
Logger.WriteLine("Error adding arena card: " + ex, "ArenaHandler");
}
_lastChoice = DateTime.Now;
_lastChoiceId = cardId;
}
}
}
}
}
示例2: Handle
public void Handle(string logLine, IHsGameState gameState, IGame game)
{
var match = ExistingHeroRegex.Match(logLine);
if(match.Success)
game.NewArenaDeck(match.Groups["id"].Value);
else
{
match = ExistingCardRegex.Match(logLine);
if(match.Success)
{
try
{
game.NewArenaCard(match.Groups["id"].Value);
}
catch(Exception ex)
{
Log.Error("Error adding arena card: " + ex);
}
}
else
{
match = NewChoiceRegex.Match(logLine);
if(!match.Success)
return;
if(Database.GetHeroNameFromId(match.Groups["id"].Value, false) != null)
game.NewArenaDeck(match.Groups["id"].Value);
else
{
var cardId = match.Groups["id"].Value;
var timeSinceLastChoice = DateTime.Now.Subtract(_lastChoice).TotalMilliseconds;
if(_lastChoiceId == cardId && timeSinceLastChoice < 1000)
{
Log.Warn($"Card with the same ID ({cardId}) was chosen less {timeSinceLastChoice} ms ago. Ignoring.");
return;
}
try
{
game.NewArenaCard(cardId);
}
catch(Exception ex)
{
Log.Error("Error adding arena card: " + ex);
}
_lastChoice = DateTime.Now;
_lastChoiceId = cardId;
}
}
}
}