C#如何在FreeCell游戏中同时移动两张卡? [英] C# How to move two cards at the same time in FreeCell game?

查看:114
本文介绍了C#如何在FreeCell游戏中同时移动两张卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个和标题一样的问题.

在我的程序中,有三个函数来处理每个控制动作.(ctrl_mousedown,ctrl_mousemove,ctrl_mouseup)
但是,它们一次只能处理一个控件.

现在,我不知道如何编写同时移动两个以上卡的函数.

请帮我解决这个问题.

谢谢!

Hi,

I have a questions just like the title.

In my program, there are three functions to handle each control action.(ctrl_mousedown, ctrl_mousemove, ctrl_mouseup)
But, they are only to handle one control in a time.

Now, I don''t know how to write the function moving more than two cards at the same time.

Please help me to solve this problem.

Thanks!

推荐答案

如果您尝试编写自己的游戏,那还不错.在MouseDown处理程序中,检查当前是否选择了任何内容.
如果是,请检查您是否在所选项目上-如果是,则这是移动的开始.
否则,请检查换档或控制是否已按下-如果已按下,则您正在将卡添加到所选列表中.如果不是,请在鼠标下方选择该卡,然后取消选择所有其他卡.

在鼠标上移/向上移动中检查是否在移动.
If you are trying to write your own game, then it''s not too bad. In your MouseDown handler, check if anything is currently selected.
If it is, check if you are over a selected item - if so, then this is the start of a move.
Otherwise, check if shift or control are down - if so, then you are adding cards to the selected list. If not, then select the card under the mouse, and deselect all the others.

In mouse move / up check if you are moving.


这篇关于C#如何在FreeCell游戏中同时移动两张卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆