public void AnimateCancelMove(DeltaChange dc, Move move) { this.OnMoveAnimationPreview(); this.SetupAnimationCount(move); var figureDiedItems = dc.Filter((ch) => (ch.Action == MoveAction.Deletion) && (ch.FigureColor != this.viewModel.CurrentPlayerColor) && (ch.Square == move.To)); Queem.Core.Figure figureDied = Queem.Core.Figure.Nobody; if (figureDiedItems.Count() > 0) figureDied = figureDiedItems.First().FigureType; while (dc.HasItems()) { var change = dc.PopLast(); switch (change.Action) { case MoveAction.Move: this.InnerAnimateMove(new Move(change.AdditionalSquare, change.Square), figureDied); break; case MoveAction.Creation: break; case MoveAction.Deletion: if (move.To != change.Square) this.viewModel.UpdateFigure(change.Square, change.FigureType, change.FigureColor); break; } } }
public DeltaChange(DeltaChange from) { int changesCount = from.changes.Length; this.changes = new Change[changesCount]; for (int i = 0; i < changesCount; ++i) this.changes[i] = new Change(from.changes[i]); this.lastIndex = from.lastIndex; }
public DeltaChange(DeltaChange from) { int changesCount = from.changes.Length; this.changes = new Change[changesCount]; for (int i = 0; i < changesCount; ++i) { this.changes[i] = new Change(from.changes[i]); } this.lastIndex = from.lastIndex; }
public void AnimateMove(DeltaChange dc, Move move) { this.OnMoveAnimationPreview(); this.SetupAnimationCount(move); while (dc.HasItems()) { var change = dc.PopLast(); switch(change.Action) { case MoveAction.Move: this.InnerAnimateMove(new Move(change.Square, change.AdditionalSquare), Queem.Core.Figure.Nobody); break; case MoveAction.Deletion: if (change.Square != move.To) // if not equal - passing capture this.viewModel.RemoveFigure(change.Square); break; case MoveAction.Creation: this.viewModel.UpdateFigure(change.Square, change.FigureType, change.FigureColor); break; } } }