本文整理汇总了C#中Octgn.Play.ControllableObject类的典型用法代码示例。如果您正苦于以下问题:C# ControllableObject类的具体用法?C# ControllableObject怎么用?C# ControllableObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControllableObject类属于Octgn.Play命名空间,在下文中一共展示了ControllableObject类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: TakeFrom
public void TakeFrom(ControllableObject obj, Player to)
{
obj.TakingControl(to);
}
示例3: DontTakeReq
public void DontTakeReq(ControllableObject id, Player to)
{
//Log.Info("[ProtOut] DontTakeReq");
if(Program.Client == null)return;
MemoryStream stream = new MemoryStream(512);
stream.Seek(4, SeekOrigin.Begin);
BinaryWriter writer = new BinaryWriter(stream);
if (Program.Client.Muted != 0)
writer.Write(Program.Client.Muted);
else
writer.Write(0);
writer.Write((byte)62);
writer.Write(id.Id);
writer.Write(to.Id);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例4: DontTake
public void DontTake(ControllableObject obj)
{
obj.DontTakeError();
}
示例5: TakeFromReq
public void TakeFromReq(ControllableObject id, Player from)
{
StringBuilder sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb, xmlSettings);
writer.WriteStartElement("TakeFromReq");
if (Script.ScriptEngine.CurrentScript != null && Script.ScriptEngine.CurrentScript.muted)
writer.WriteAttributeString("muted", Script.ScriptEngine.CurrentScript.GetUniqueId().ToString(CultureInfo.InvariantCulture));
else if (Program.Client.Muted != 0)
writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("id", id.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("from", from.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();
writer.Close();
Send(sb.ToString());
}
示例6: PassToReq
public void PassToReq(ControllableObject id, Player to, bool requested)
{
MemoryStream stream = new MemoryStream(512);
stream.Seek(4, SeekOrigin.Begin);
BinaryWriter writer = new BinaryWriter(stream);
if (Program.Client.Muted != 0)
writer.Write(Program.Client.Muted);
else
writer.Write(0);
writer.Write((byte)64);
writer.Write(id.Id);
writer.Write(to.Id);
writer.Write(requested);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例7: TakeFromReq
public void TakeFromReq(ControllableObject id, Player from)
{
if(Program.Client == null)return;
MemoryStream stream = new MemoryStream(512);
stream.Seek(4, SeekOrigin.Begin);
BinaryWriter writer = new BinaryWriter(stream);
if (Program.Client.Muted != 0)
writer.Write(Program.Client.Muted);
else
writer.Write(0);
writer.Write((byte)66);
writer.Write(id.Id);
writer.Write(from.Id);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例8: PassToReq
public void PassToReq(ControllableObject id, Player to, bool requested)
{
StringBuilder sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb, xmlSettings);
writer.WriteStartElement("PassToReq");
if(Program.Client.Muted != 0)
writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("id", id.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("to", to.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("requested", requested.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();
writer.Close();
Send(sb.ToString());
}
示例9: CopyControllersTo
// Give to the parameter the same controller as this object
internal void CopyControllersTo(ControllableObject other)
{
if (Controller == null) return;
other.Controller = Controller;
}
示例10: 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);
}
示例11: CopyControllersTo
// Give to the parameter the same controller as this object
internal void CopyControllersTo(ControllableObject other)
{
other.Controller = Controller;
}
示例12: TakeFromReq
public void TakeFromReq(ControllableObject id, Player from)
{
MemoryStream stream = new MemoryStream(512);
stream.Seek(4, SeekOrigin.Begin);
BinaryWriter writer = new BinaryWriter(stream);
if (Script.ScriptEngine.CurrentScript != null && Script.ScriptEngine.CurrentScript.muted)
writer.Write(Script.ScriptEngine.CurrentScript.GetUniqueId());
else if (Program.Client.Muted != 0)
writer.Write(Program.Client.Muted);
else
writer.Write(0);
writer.Write((byte)66);
writer.Write(id.Id);
writer.Write(from.Id);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例13: TakeFromReq
public void TakeFromReq(ControllableObject id, Player from)
{
var sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb, XmlSettings);
writer.WriteStartElement("TakeFromReq");
if (Program.Client.Muted != 0)
writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("id", id.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("from", from.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();
writer.Close();
Send(sb.ToString());
}