本文整理汇总了C#中Octgn.Play.Card类的典型用法代码示例。如果您正苦于以下问题:C# Card类的具体用法?C# Card怎么用?C# Card使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Card类属于Octgn.Play命名空间,在下文中一共展示了Card类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMarkerReq
public void AddMarkerReq(Card card, Guid id, string name, ushort count, ushort origCount, bool isScriptChange)
{
//Log.Info("[ProtOut] AddMarkerReq");
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)59);
writer.Write(card.Id);
writer.Write(id.ToByteArray());
writer.Write(name);
writer.Write(count);
writer.Write(origCount);
writer.Write(isScriptChange);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例2: AddMarker
public void AddMarker(Player player, Card card, Guid id, string name, ushort count, ushort oldCount, bool isScriptChange)
{
DataNew.Entities.Marker model = Program.GameEngine.GetMarkerModel(id);
DefaultMarkerModel defaultMarkerModel = model as DefaultMarkerModel;
if (defaultMarkerModel != null)
(defaultMarkerModel).SetName(name);
Marker marker = card.FindMarker(id, name);
if (player != Player.LocalPlayer)
{
if (marker == null && oldCount != 0)
{
Program.GameMess.Warning("Inconsistent state. Cannot create a marker when that marker already exists.");
return;
}
if (marker != null && oldCount != marker.Count)
{
Program.GameMess.Warning("Inconsistent state. Marker count invalid.");
return;
}
card.AddMarker(model, count);
}
if (count != 0)
{
int newCount = oldCount + count;
Program.GameMess.PlayerEvent(player, "adds {0} {1} marker(s) on {2}", count, model.Name, card);
if (isScriptChange == false)
{
Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_0(card, model.ModelString(), oldCount, newCount, isScriptChange);
Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_1(card, model.ModelString(), oldCount, newCount, isScriptChange);
}
}
}
示例3: AddMarker
public void AddMarker(Player player, Card card, Guid id, string name, ushort count)
{
Data.MarkerModel model = Program.Game.GetMarkerModel(id);
if (model is DefaultMarkerModel)
((DefaultMarkerModel)model).SetName(name);
// Ignore markers created by oneself (already created for responsiveness issues)
if (player != Player.LocalPlayer)
card.AddMarker(model, count);
if (count != 0)
Program.Trace.TraceEvent(TraceEventType.Information, EventIds.Event | EventIds.PlayerFlag(player),
"{0} adds {1} {2} marker(s) on {3}", player, count, model, card);
}
示例4: AddMarkerReq
public void AddMarkerReq(Card card, Guid id, string name, ushort count)
{
StringBuilder sb = new StringBuilder();
XmlWriter writer = XmlWriter.Create(sb, xmlSettings);
writer.WriteStartElement("AddMarkerReq");
if(Program.Client.Muted != 0)
writer.WriteAttributeString("muted", Program.Client.Muted.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("card", card.Id.ToString(CultureInfo.InvariantCulture));
writer.WriteElementString("id", id.ToString());
writer.WriteElementString("name", name);
writer.WriteElementString("count", count.ToString(CultureInfo.InvariantCulture));
writer.WriteEndElement();
writer.Close();
Send(sb.ToString());
}
示例5: OnCardDoubleClick
public void OnCardDoubleClick(Card card, int mouseButton, string[] keysDown)
{
Log.Info("Firing event OnCardDoubleClick");
var args = new object[3];
args[0] = card;
args[1] = mouseButton;
args[2] = keysDown;
if(Program.GameEngine.Definition.Events.ContainsKey("OnCardDoubleClick"))
{
foreach(var e in Program.GameEngine.Definition.Events["OnCardDoubleClick"])
{
Log.InfoFormat("Firing event OnCardDoubleClick -> {0}",e.Name);
engine.ExecuteFunction(e.PythonFunction,card, mouseButton, keysDown);
}
}
}
示例6: CardSwitchTo
public void CardSwitchTo(Player player, Card card, string alternate)
{
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)87);
writer.Write(player.Id);
writer.Write(card.Id);
writer.Write(alternate);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例7: AddMarkerReq
public void AddMarkerReq(Card card, Guid id, string name, ushort count)
{
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)56);
writer.Write(card.Id);
writer.Write(id.ToByteArray());
writer.Write(name);
writer.Write(count);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例8: AnchorCard
public void AnchorCard(Card id, Player player, bool anchor)
{
//Log.Info("[ProtOut] AnchorCard");
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)97);
writer.Write(id.Id);
writer.Write(player.Id);
writer.Write(anchor);
writer.Flush(); writer.Seek(0, SeekOrigin.Begin);
writer.Write((int)stream.Length);
writer.Close();
Send(stream.ToArray());
}
示例9: CreateCard
/// <summary>Creates new Cards as well as the corresponding CardIdentities. All cards are created in the same group.</summary>
/// <param name="id">An array with the new CardIdentity ids.</param>
/// <param name="type">An array containing the corresponding CardModel guids (encrypted)</param>
/// <param name="group">The group, in which the cards are added.</param>
/// <seealso cref="CreateCard(int[], ulong[], Group[])"> to add cards to several groups</seealso>
public void CreateCard(int[] id, ulong[] type, Group group)
{
Player owner = Player.Find((byte)(id[0] >> 16));
if (owner == null)
{
Program.Trace.TraceEvent(TraceEventType.Warning, EventIds.Event, "[CreateCard] Player not found.");
return;
}
//var c = new Card(owner,id[0], type[0], Program.Game.Definition.CardDefinition, null, false);
var c = Card.Find(id[0]);
Program.TracePlayerEvent(owner, "{0} creates {1} {2} in {3}'s {4}", owner.Name, id.Length, c == null ? "card" : c.Name, group.Owner.Name,group.Name);
// Ignore cards created by oneself
if (owner == Player.LocalPlayer) return;
for (int i = 0; i < id.Length; i++)
{
//Card c = new Card(owner, id[i], type[i], Program.Game.Definition.CardDefinition, null, false);
//group.AddAt(c, group.Count);
var card = new Card(owner,id[i], type[i], null, false);
group.AddAt(card, group.Count);
}
}
示例10: Turn
public void Turn(Player player, Card card, bool up)
{
// Ignore the card we turned ourselves
if (player == Player.LocalPlayer)
{
card.MayBeConsideredFaceUp = false; // see comment on mayBeConsideredFaceUp
return;
}
new Turn(player, card, up).Do();
}
示例11: TargetArrow
public void TargetArrow(Player player, Card card, Card otherCard)
{
// Ignore the card we targeted ourselves
if (player == Player.LocalPlayer) return;
new Target(player, card, otherCard, true).Do();
}
示例12: Rotate
public void Rotate(Player player, Card card, CardOrientation rot)
{
// Ignore the moves we made ourselves
if (player == Player.LocalPlayer)
return;
new Rotate(player, card, rot).Do();
}
示例13: CardSwitchTo
public void CardSwitchTo(Player player, Card card, string alternate)
{
if(player.Id != Player.LocalPlayer.Id)
card.SwitchTo(player, alternate);
}
示例14: Peek
public void Peek(Player player, Card card)
{
if (!card.PeekingPlayers.Contains(player))
card.PeekingPlayers.Add(player);
card.RevealTo(Enumerable.Repeat(player, 1));
if (player != Player.LocalPlayer)
{
Program.TracePlayerEvent(player, "{0} peeks at a card ({1}).", player,
card.Group is Table ? "on table" : "in " + card.Group.FullName);
}
}
示例15: OnMarkerChanged_3_1_0_1
public void OnMarkerChanged_3_1_0_1(Card card, string markerName, int oldValue, int newValue, bool isScriptChange)
{
if(Player.LocalPlayer.Spectator)return;
if(MuteEvents)return;
if(gameEngine.Definition.ScriptVersion != C_3_1_0_1 )
return;
var thisVersion = Version.Parse("3.1.0.1");
dynamic args = new System.Dynamic.ExpandoObject();
if(thisVersion >= BASEOBJECTVERSION)
{
args.card = card;
args.markerName = markerName;
args.oldValue = oldValue;
args.newValue = newValue;
args.isScriptChange = isScriptChange;
}
foreach(var e in eventCache["OnMarkerChanged"])
{
if(thisVersion < BASEOBJECTVERSION)
engine.ExecuteFunction(e.PythonFunction,card, markerName, oldValue, newValue, isScriptChange);
else
{
engine.ExecuteFunction(e.PythonFunction, args);
}
}
}