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


C# ControllableObject.PassControlTo方法代码示例

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


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

示例1: PassTo

 public void PassTo(Player who, ControllableObject obj, Player player, bool requested)
 {
     // Ignore message that we sent in the first place
     if (who != Player.LocalPlayer)
         obj.PassControlTo(player, who, false, requested);
 }
开发者ID:Kamalisk,项目名称:OCTGN,代码行数:6,代码来源:ClientHandler.cs

示例2: PassTo

 /// <summary>Completely remove all aliases from a group, e.g. before performing a shuffle.</summary>
 /// <param name="group">The group to remove all aliases from.</param>
 //public void UnaliasGrp(Group group)
 //{
 //    // Get the group
 //    Pile g = group as Pile;
 //    if (g == null)
 //    { Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.NonGame, "[UnaliasGrp] Group is not a pile."); return; }
 //    // Collect aliases which we p
 //    List<int> cards = new List<int>(g.Count);
 //    List<ulong> types = new List<ulong>(g.Count);
 //    bool hasAlias = false;
 //    foreach (Card t in g)
 //    {
 //        CardIdentity ci = t.Type;
 //        if (ci == null) continue; //Hack, should this ever be null? Sometimes it happens for whatever reason.
 //        if (!ci.Alias) continue;
 //        hasAlias = true;
 //        if (ci.MySecret)
 //        { cards.Add(t.Id); types.Add(ci.Key); }
 //    }
 //    // Unalias cards that we know (if any)
 //    if (cards.Count > 0)
 //        Program.Client.Rpc.Unalias(cards.ToArray(), types.ToArray());
 //    // If there are no alias, we may be ready to shuffle
 //    if (!hasAlias && g.WantToShuffle)
 //    { g.DoShuffle(); return; }
 //    // Mark the group for shuffling
 //    g.PreparingShuffle = true;
 //    // Notify the user
 //    Program.TracePlayerEvent(group.Owner, "{0} is being prepared for shuffle.", g);
 //    // Check for null because the chat can currently be muted (e.g. during a Mulligan scripted action)
 //    if (Program.LastChatTrace != null)
 //        g.ShuffledTrace += (new ShuffleTraceChatHandler { Line = Program.LastChatTrace }).ReplaceText;
 //}
 /// <summary>Unalias some Cards, e.g. before a shuffle</summary>
 /// <param name="card">An array containing the Card ids to unalias.</param>
 /// <param name="type">An array containing the corresponding revealed CardIdentity ids.</param>
 //public void Unalias(int[] card, ulong[] type)
 //{
 //    if (card.Length != type.Length)
 //    { Program.TraceWarning("[Unalias] Card and type lengths don't match."); return; }
 //    Pile g = null;
 //    List<int> cards = new List<int>(card.Length);
 //    List<ulong> types = new List<ulong>(card.Length);
 //    for (int i = 0; i < card.Length; i++)
 //    {
 //        Card c = Card.Find(card[i]);
 //        if (c == null)
 //        { Program.TraceWarning("[Unalias] Card not found."); continue; }
 //        if (g == null) g = c.Group as Pile;
 //        else if (g != c.Group)
 //        { Program.TraceWarning("[Unalias] Not all cards belong to the same group!"); continue; }
 //        // Check nobody cheated
 //        if (!c.Type.MySecret)
 //        {
 //            if (c.Type.Key != Crypto.ModExp(type[i]))
 //                Program.TraceWarning("[Unalias] Card identity doesn't match.");
 //        }
 //        // Substitue the card's identity
 //        CardIdentity ci = CardIdentity.Find((int)type[i]);
 //        if (ci == null)
 //        { Program.TraceWarning("[Unalias] Card identity not found."); continue; }
 //        CardIdentity.Delete(c.Type.Id); c.Type = ci;
 //        // Propagate unaliasing
 //        if (ci.Alias && ci.MySecret)
 //            cards.Add(c.Id); types.Add(ci.Key);
 //    }
 //    if (cards.Count > 0)
 //        Program.Client.Rpc.Unalias(cards.ToArray(), types.ToArray());
 //    if (g == null) return;
 //    if (!g.PreparingShuffle)
 //    { Program.TraceWarning("[Unalias] Cards revealed are not in a group prepared for shuffle."); return; }
 //    // If all cards are now revealed, one can proceed to shuffling
 //    if (!g.WantToShuffle) return;
 //    bool done = false;
 //    for (int i = 0; !done && i < g.Count; i++)
 //        done = g[i].Type.Alias;
 //    if (!done)
 //        g.DoShuffle();
 //}
 public void PassTo(Player who, ControllableObject obj, Player player, bool requested)
 {
     // Ignore message that we sent in the first place
     if (who != Player.LocalPlayer)
         obj.PassControlTo(player, who, false, requested);
     if (obj is Card)
        Program.GameEngine.EventProxy.OnCardControllerChanged_3_1_0_2((Card)obj, who, player);
 }
开发者ID:octgn,项目名称:OCTGN,代码行数:89,代码来源:ClientHandler.cs


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