public UndoDrawOperation( Player player, UndoState state, bool redo ) : base( player ) { State = state; Redo = redo; if( Redo ) { undoContext |= BlockChangeContext.Redone; } }
internal static void RaisePlayerPlacedBlockEvent(Player player, Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context) { var handler = PlacedBlock; if (handler != null) { handler(null, new PlayerPlacedBlockEventArgs(player, map, coords, oldBlock, newBlock, context)); } }
/// <summary> Initializes a new instance of UndoDrawOperation. </summary> /// <param name="player"> Player initiating this draw operation. May not be null. </param> /// <param name="state"> UndoState to work with. May not be null. </param> /// <param name="redo"> Whether state should be undone (false) or redone (true). </param> /// <exception cref="ArgumentNullException"> player or state is null </exception> public UndoDrawOperation([NotNull] Player player, [NotNull] UndoState state, bool redo) : base(player) { if (state == null) throw new ArgumentNullException("state"); State = state; Redo = redo; if (Redo) { undoContext |= BlockChangeContext.Redone; } }
internal PlayerPlacedBlockEventArgs([NotNull] Player player, [NotNull] Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context) { Player = player; Map = map ?? throw new ArgumentNullException(nameof(map)); Coords = coords; OldBlock = oldBlock; NewBlock = newBlock; Context = context; }
public UndoDrawOperation(Player player, UndoState state, bool redo) : base(player) { State = state; Redo = redo; if (Redo) { undoContext |= BlockChangeContext.Redone; } }
public BlockDBEntry( int timestamp, int playerID, short x, short y, short z, Block oldBlock, Block newBlock, BlockChangeContext flags ) { Timestamp = timestamp; PlayerID = playerID; X = x; Y = y; Z = z; OldBlock = oldBlock; NewBlock = newBlock; Context = flags; }
public BlockDBEntry(int timestamp, int playerId, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext flags) { Timestamp = timestamp; PlayerId = playerId; X = (short)coords.X; Y = (short)coords.Y; Z = (short)coords.Z; OldBlock = oldBlock; NewBlock = newBlock; Context = flags; }
public BlockDBEntry(int timestamp, int playerID, short x, short y, short z, Block oldBlock, Block newBlock, BlockChangeContext flags) { Timestamp = timestamp; PlayerID = playerID; X = x; Y = y; Z = z; OldBlock = oldBlock; NewBlock = newBlock; Context = flags; }
public BlockDBEntry(int timestamp, int playerID, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext flags) { Timestamp = timestamp; PlayerID = playerID; X = (short)coords.X; Y = (short)coords.Y; Z = (short)coords.Z; OldBlock = oldBlock; NewBlock = newBlock; Context = flags; }
/// <summary> Initializes a new instance of UndoDrawOperation. </summary> /// <param name="player"> Player initiating this draw operation. May not be null. </param> /// <param name="state"> UndoState to work with. May not be null. </param> /// <param name="redo"> Whether state should be undone (false) or redone (true). </param> /// <exception cref="ArgumentNullException"> player or state is null </exception> public UndoDrawOperation([NotNull] Player player, [NotNull] UndoState state, bool redo) : base(player) { if (state == null) { throw new ArgumentNullException("state"); } State = state; Redo = redo; if (Redo) { undoContext |= BlockChangeContext.Redone; } }
internal PlayerPlacingBlockEventArgs([NotNull] Player player, [NotNull] Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context, CanPlaceResult result) { if (map == null) { throw new ArgumentNullException("map"); } Player = player; Map = map; Coords = coords; OldBlock = oldBlock; NewBlock = newBlock; Context = context; Result = result; }
private static void DrawOneBlock(Player player, Map map, Block drawBlock, Vector3I coord, BlockChangeContext context, ref int blocks, ref int blocksDenied, fCraft.Drawing.UndoState undoState) { if (map == null) { return; } if (player == null) { throw new ArgumentNullException("player"); } if (!map.InBounds(coord)) { return; } Block block = map.GetBlock(coord); if (block == drawBlock) { return; } if (player.CanPlace(map, coord, drawBlock, context) != CanPlaceResult.Allowed) { blocksDenied++; return; } map.QueueUpdate(new BlockUpdate(null, coord, drawBlock)); Player.RaisePlayerPlacedBlockEvent(player, map, coord, block, drawBlock, context); if (!undoState.IsTooLargeToUndo) { if (!undoState.Add(coord, block)) { player.Message("NOTE: This draw command is too massive to undo."); player.LastDrawOp = null; } } blocks++; }
static void DrawOneBlock( [NotNull] Player player, [NotNull] Map map, Block drawBlock, Vector3I coord, BlockChangeContext context, ref int blocks, ref int blocksDenied, UndoState undoState ) { if( player == null ) throw new ArgumentNullException( "player" ); if( !map.InBounds( coord ) ) return; Block block = map.GetBlock( coord ); if( block == drawBlock ) return; if( player.CanPlace( map, coord, drawBlock, context ) != CanPlaceResult.Allowed ) { blocksDenied++; return; } map.QueueUpdate( new BlockUpdate( null, coord, drawBlock ) ); Player.RaisePlayerPlacedBlockEvent( player, map, coord, block, drawBlock, context ); if( !undoState.IsTooLargeToUndo ) { if( !undoState.Add( coord, block ) ) { player.MessageNow( "NOTE: This draw command is too massive to undo." ); player.LastDrawOp = null; } } blocks++; }
internal PlayerPlacingBlockEventArgs([NotNull] Player player, [NotNull] Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context, CanPlaceResult result) : base(player, map, coords, oldBlock, newBlock, context) { Result = result; }
public static void RaisePlayerPlacedBlockEvent(Player player, Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context) { var handler = PlacedBlock; if (handler != null) { handler(null, new PlayerPlacedBlockEventArgs(player, map, coords, oldBlock, newBlock, context)); } }
internal static void RaisePlayerPlacedBlockEvent( Player player, Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context ) { var e = new PlayerPlacedBlockEventArgs( player, map, coords, oldBlock, newBlock, context ); PlacedBlockEvent.Raise( e ); }
internal PlayerPlacingBlockEventArgs( [NotNull] Player player, [NotNull] Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context, CanPlaceResult result ) : base( player, map, coords, oldBlock, newBlock, context ) { Result = result; }
internal PlayerPlacedBlockEventArgs( [NotNull] Player player, [NotNull] Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context ) { if( map == null ) throw new ArgumentNullException( "map" ); Player = player; Map = map; Coords = coords; OldBlock = oldBlock; NewBlock = newBlock; Context = context; }
internal static void RaisePlayerPlacedBlockEvent(Player player, Map map, Vector3I coords, Block oldBlock, Block newBlock, BlockChangeContext context) { var e = new PlayerPlacedBlockEventArgs(player, map, coords, oldBlock, newBlock, context); PlacedBlockEvent.Raise(e); }