我正在制作一个迷宫,我希望在玩家完成第 1 级(在表单 1 中)时启用我的“第 2 级”按钮(在主表单中)。所以我该怎么做?
问问题
101 次
1 回答
2
Create a new event on the LevelForm, such as:
public event Action LevelCompleted;
Fire that event when the level is completed:
//run this code as soon as you know the level is completed
if(LevelCompleted != null)
LevelCompleted();
Then have the main form subscribe to that event and do...whatever, when the level is completed:
level1Form.LevelCompleted += () => level2Button.Enabled = true;
于 2013-04-19T18:46:24.167 回答