當前位置: 首頁>>代碼示例>>C#>>正文


C# Card.Reveal方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:Kamalisk,項目名稱:OCTGN,代碼行數:50,代碼來源:ClientHandler.cs

示例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);
     }
 }
開發者ID:kellyelton,項目名稱:octgnwlobby,代碼行數:46,代碼來源:ClientHandler.cs


注:本文中的Octgn.Play.Card.Reveal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。