Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavioral Patterns ----Command Pattern-----Example3 #3

Open
pbsmart opened this issue Aug 29, 2019 · 2 comments
Open

Behavioral Patterns ----Command Pattern-----Example3 #3

pbsmart opened this issue Aug 29, 2019 · 2 comments

Comments

@pbsmart
Copy link

pbsmart commented Aug 29, 2019

这个例子写的有Bug 一旦UnDo后 进行新的命令就就会出现Bug 原因是UnDo后 再进行Command 没有清除之前的Comand

@pbsmart
Copy link
Author

pbsmart commented Aug 29, 2019

可以把添加命令代码改为

MoveCommand moveCommand = new MoveCommand(moveCommandReciever, direction, moveDistance, objectToMove);
        moveCommand.Execute();
        commands.Insert(currentCommandNum,moveCommand);
        currentCommandNum++;
        while (commands.Count>currentCommandNum)
        {
            commands.RemoveAt(commands.Count - 1);
        }

@lsjsoft
Copy link

lsjsoft commented Dec 22, 2021

大佬,快回来改bug了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants