我已经为此工作了一段时间,但一直停留在这一点上,我想不出一种方法来计算董事会中的分数...
因此,首先,这是构成案例的代码的一部分,在这些案例中,我的令牌位于:
class Case:Control
{
public Point Position { get; set; }
/// <summary>
/// Creates the dimensions for the cases
/// </summary>
public Case()
{
MaximumSize = new Size(50, 50);
MinimumSize = new Size(50, 50);
}
/// <summary>
/// Creates the background for the cases
/// </summary>
public enum DifferentCase
{
Dark,
Pale,
Brown
}
/// <summary>
/// Creates the tokens
/// </summary>
public enum Token
{
Nothing,
White,
Black
}
public DifferentCase ColorCase { get; set; }
public Token ColorToken { get; set; }
public bool IsBlack { get; set; }
那些是我的令牌,我尝试使用一种方法来计算有多少令牌是黑色的,有多少令牌是白色的:
private void CheckPoints(Case cases)
{
foreach (Case case_ in cases.Controls)
{
if (case_.ColorToken == Case.Token.Black)
{
_player1Points++;
lbl_player1Points.Text = _player1Points.ToString();
}
else if (case_.ColorToken == Case.Token.White)
{
_player2Points++;
lbl_player2Points.Text = _player2Points.ToString();
}
}
}
但是,当我尝试以如下方式调用该方法时:例如CheckPoints(),如果我单击这些情况,它会告诉我“没有与'frm_othello的所需形式参数“ cases”相对应的参数”。 .CheckPoints(Case)'“
我不知道我在该方法中放入的代码是否好,也不知道为什么不能调用该方法。
HUX布斯
相关分类