コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
ファイル: DeltaChange.cs プロジェクト: Ribtoks/Queem
        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;
        }
コード例 #3
0
ファイル: DeltaChange.cs プロジェクト: uri65/Queem
        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;
        }
コード例 #4
0
        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;
                }
            }
        }