本文整理汇总了C#中Octgn.Play.Card.Reveal方法的典型用法代码示例。如果您正苦于以下问题:C# Card.Reveal方法的具体用法?C# Card.Reveal怎么用?C# Card.Reveal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octgn.Play.Card
的用法示例。
在下文中一共展示了Card.Reveal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reveal
/// <summary>Reveal one card's identity</summary>
/// <param name="card">The card, whose identity is revealed</param>
/// <param name="revealed">Either the salted CardIdentity id (in the case of an alias), or the salted, condensed Card GUID.</param>
/// <param name="guid"> </param>
public void Reveal(Card card, ulong revealed, Guid guid)
{
// Save old id
CardIdentity oldType = card.Type;
// Check if the card is rightfully revealed
if (!card.Type.Revealing)
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "Someone tries to reveal a card which is not visible to everybody.");
// Check if we can trust other clients
if (!card.Type.MySecret)
{
if (guid != Guid.Empty && (uint)revealed != guid.Condense())
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "[Reveal] Alias and id aren't the same. One client is buggy or tries to cheat.");
if (Crypto.ModExp(revealed) != card.Type.Key)
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "[Reveal] Card identity doesn't match. One client is buggy or tries to cheat.");
}
else
card.Type.MySecret = false;
// Reveal an alias
if (guid == Guid.Empty)
{
// Find the new type
CardIdentity newId = CardIdentity.Find((int)revealed);
// HACK: it is unclear to me how the CardIdentity could not be found and newId ends up null
// see this bug report: https://octgn.16bugs.com/projects/3602/bugs/192070
// for now I'm just doing nothing (supposing that it means the type was already revealed).
if (newId == null) { card.Reveal(); return; }
// Possibly copy the model, if it was known and isn't anymore
// (possible when the alias has beeen locally revealed)
if (newId.Model == null) newId.Model = card.Type.Model;
// Set the new type
card.Type = newId;
// Delete the old identity
CardIdentity.Delete(oldType.Id);
// Possibly reveal the alias further
card.Reveal();
// Raise a notification
oldType.OnRevealed(newId);
}
// Reveal a card's type
else if (card.Type.Model == null)
{
card.SetModel(Program.GameEngine.Definition.GetCardById(guid));
// Raise a notification
oldType.OnRevealed(oldType);
}
}
示例2: Reveal
/// <summary>Reveal one card's identity</summary>
/// <param name="card">The card, whose identity is revealed</param>
/// <param name="revealed">Either the salted CardIdentity id (in the case of an alias), or the salted, condensed Card GUID.</param>
/// <param name="id">If the revealed identity is a model, the non-condensed CardModel guid. Otherwise this parameter should be Guid.Empty.</param>
public void Reveal(Card card, ulong revealed, Guid guid)
{
// Save old id
CardIdentity oldType = card.Type;
// Check if the card is rightfully revealed
if (!card.Type.revealing)
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "Someone tries to reveal a card which is not visible to everybody.");
// Check if we can trust other clients
if (!card.Type.mySecret)
{
if (guid != Guid.Empty && (uint)revealed != guid.Condense())
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "[Reveal] Alias and id aren't the same. One client is buggy or tries to cheat.");
if (Crypto.ModExp(revealed) != card.Type.key)
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "[Reveal] Card identity doesn't match. One client is buggy or tries to cheat.");
}
else
card.Type.mySecret = false;
// Reveal an alias
if (guid == Guid.Empty)
{
// Find the new type
CardIdentity newId = CardIdentity.Find((int)revealed);
// Possibly copy the model, if it was known and isn't anymore
// (possible when the alias has beeen locally revealed)
if (newId.model == null) newId.model = card.Type.model;
// Set the new type
card.Type = newId;
// Delete the old identity
CardIdentity.Delete(oldType.id);
// Possibly reveal the alias further
card.Reveal();
// Raise a notification
oldType.OnRevealed(newId);
}
// Reveal a card's type
else if (card.Type.model == null)
{
card.SetModel(Database.GetCardById(guid));
// Raise a notification
oldType.OnRevealed(oldType);
}
}