private FindRemovedMarker ( System.Guid lId, string name ) : Octgn.Play.Marker | ||
lId | System.Guid | |
name | string | |
Résultat | Octgn.Play.Marker |
public void TransferMarker(Player player, Card from, Card to, Guid id, string name, ushort count, ushort oldCount, bool isScriptChange) { var marker = from.FindMarker(id, name); if (player == null) { Program.GameMess.Warning("Inconsistent state. Cannot transfer marker to unknown player."); return; } if (player != Player.LocalPlayer) { if (marker == null) { Program.GameMess.Warning("Inconsistent state. Marker not found on card."); return; } if (marker.Count != oldCount) { Program.GameMess.Warning("Inconsistent state. Missing markers to remove"); } } var newMarker = to.FindMarker(id, name); var toOldCount = 0; if (newMarker != null) { toOldCount = newMarker.Count - 1; } var fromNewCount = oldCount - count; var toNewCount = toOldCount + count; if (player != Player.LocalPlayer) { from.RemoveMarker(marker, count); to.AddMarker(marker.Model, count); } Program.GameMess.PlayerEvent(player, "moves {0} {1} marker(s) from {2} to {3}", count, name, from, to); if (marker == null) { marker = from.FindRemovedMarker(id, name); } if (marker != null) { if (isScriptChange == false) { Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_0( from, marker.Model.ModelString(), oldCount, fromNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_0( to, marker.Model.ModelString(), toOldCount, toNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_1( from, marker.Model.ModelString(), oldCount, fromNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_1( to, marker.Model.ModelString(), toOldCount, toNewCount, isScriptChange); } Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_2( from, marker.Model.Name, marker.Model.Id.ToString(), oldCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_2( to, marker.Model.Name, marker.Model.Id.ToString(), toOldCount, isScriptChange); } }
public void TransferMarker(Player player, Card from, Card to, Guid id, string name, ushort count, ushort oldCount, bool isScriptChange) { Marker marker = from.FindMarker(id, name); if (player == null) { Program.GameMess.Warning("Inconsistent state. Cannot transfer marker to unknown player."); return; } if (player != Player.LocalPlayer) { if (marker == null) { Program.GameMess.Warning("Inconsistent state. Marker not found on card."); return; } if (marker.Count != oldCount) Program.GameMess.Warning("Inconsistent state. Missing markers to remove"); } Marker newMarker = to.FindMarker(id, name); int toOldCount = 0; if (newMarker != null) toOldCount = newMarker.Count - 1; int fromNewCount = oldCount - count; int toNewCount = toOldCount + count; if (player != Player.LocalPlayer) { from.RemoveMarker(marker, count); to.AddMarker(marker.Model, count); } Program.GameMess.PlayerEvent(player, "moves {0} {1} marker(s) from {2} to {3}", count, name, from, to); if (marker == null) { marker = from.FindRemovedMarker(id, name); } if (marker != null) { if (isScriptChange == false) { Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_0( from, marker.Model.ModelString(), oldCount, fromNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_0( to, marker.Model.ModelString(), toOldCount, toNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_1( from, marker.Model.ModelString(), oldCount, fromNewCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_1( to, marker.Model.ModelString(), toOldCount, toNewCount, isScriptChange); } Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_2( from, marker.Model.Name, marker.Model.Id.ToString(), oldCount, isScriptChange); Program.GameEngine.EventProxy.OnMarkerChanged_3_1_0_2( to, marker.Model.Name, marker.Model.Id.ToString(), toOldCount, isScriptChange); } }