本文整理汇总了C#中Sanguosha.Core.Cards.Card.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Card.CopyFrom方法的具体用法?C# Card.CopyFrom怎么用?C# Card.CopyFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanguosha.Core.Cards.Card
的用法示例。
在下文中一共展示了Card.CopyFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public virtual void Run()
{
if (games.ContainsKey(Thread.CurrentThread))
{
throw new GameAlreadyStartedException();
}
else
{
games.Add(Thread.CurrentThread, this);
}
if (GameServer != null)
{
GameServer.Start();
Trace.Assert(Settings != null);
for (int i = 0; i < players.Count; i++)
{
GameServer.SendObject(i, Settings);
GameServer.SendObject(i, i);
GameServer.Flush(i);
}
}
availableCards = new List<CardHandler>();
foreach (Card c in OriginalCardSet)
{
bool typeCheck = false;
foreach (var type in availableCards)
{
if (type.GetType().Name.Equals(c.Type.GetType().Name))
{
typeCheck = true;
break;
}
}
if (!typeCheck)
{
availableCards.Add(c.Type);
}
}
foreach (var card in OriginalCardSet)
{
//you are client. everything is unknown
if (IsClient)
{
unknownCard = new Card();
unknownCard.Id = Card.UnknownCardId;
unknownCard.Rank = 0;
unknownCard.Suit = SuitType.None;
if (card.Type is Heroes.HeroCardHandler)
{
unknownCard.Type = new Heroes.UnknownHeroCardHandler();
unknownCard.Id = Card.UnknownHeroId;
}
else if (card.Type is RoleCardHandler)
{
unknownCard.Id = Card.UnknownRoleId;
unknownCard.Type = card.Type;
}
else
{
unknownCard.Type = new UnknownCardHandler();
}
}
//you are server.
else
{
unknownCard = new Card();
unknownCard.CopyFrom(card);
if (unknownCard.Type is Heroes.HeroCardHandler)
{
unknownCard.Type = (Heroes.HeroCardHandler)(unknownCard.Type as Heroes.HeroCardHandler).Clone();
}
}
cardSet.Add(unknownCard);
}
foreach (var trig in triggersToRegister)
{
RegisterTrigger(trig.key, trig.trigger);
}
InitTriggers();
try
{
NotificationProxy.NotifyGameStart();
Emit(GameEvent.GameStart, new GameEventArgs());
}
catch (GameOverException)
{
}
#if RELEASE
catch (Exception e)
{
Trace.TraceError(e.StackTrace);
}
#endif
if (GameServer != null)
//.........这里部分代码省略.........
示例2: _FindARoleCard
private Card _FindARoleCard(Role role)
{
foreach (var card in allRoleCards)
{
if ((card.Type as RoleCardHandler).Role == role && !usedRoleCards.Contains(card))
{
var c = new Card();
c.CopyFrom(card);
c.Place = new DeckPlace(null, RoleGame.RoleDeckType);
usedRoleCards.Add(card);
return c;
}
}
return null;
}
示例3: Run
public virtual void Run()
{
if (games.ContainsKey(Thread.CurrentThread))
{
throw new GameAlreadyStartedException();
}
else
{
games.Add(Thread.CurrentThread, this);
}
if (GameServer != null)
{
GameServer.Ready();
}
availableCards = new List<CardHandler>();
foreach (Card c in OriginalCardSet)
{
bool typeCheck = false;
foreach (var type in availableCards)
{
if (type.GetType().Name.Equals(c.Type.GetType().Name))
{
typeCheck = true;
break;
}
}
if (!typeCheck)
{
availableCards.Add(c.Type);
}
}
foreach (var card in OriginalCardSet)
{
//you are client. everything is unknown
if (IsClient)
{
unknownCard = new Card();
unknownCard.Id = Card.UnknownCardId;
unknownCard.Rank = 0;
unknownCard.Suit = SuitType.None;
if (card.Type is Heroes.HeroCardHandler)
{
unknownCard.Type = new Heroes.UnknownHeroCardHandler();
}
else
{
unknownCard.Type = new UnknownCardHandler();
}
}
//you are server.
else
{
unknownCard = new Card();
unknownCard.CopyFrom(card);
}
cardSet.Add(unknownCard);
}
foreach (var trig in triggersToRegister)
{
RegisterTrigger(trig.key, trig.trigger);
}
InitTriggers();
try
{
Emit(GameEvent.GameStart, new GameEventArgs());
}
catch (GameOverException)
{
Trace.TraceError("Game is over");
}
#if RELEASE
catch (Exception e)
{
Trace.TraceError(e.StackTrace);
}
#endif
Trace.TraceError("Game exited normally");
}