本文整理汇总了C#中Status.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Status.GetLength方法的具体用法?C# Status.GetLength怎么用?C# Status.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status.GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Back
public Back(Status[,] status, int x, int y)
{
this.State = status[x, y];
Point point;
if (this.State == Status.Blank) {
point = new Point(0, 0);
} else {
if (x == 0 && y == 0) {
point = new Point(2, 8);
} else if (x == status.GetLength(0) - 1 && y == 0) {
point = new Point(3, 8);
} else if (x == status.GetLength(0) - 1 && y == status.GetLength(1) - 1) {
point = new Point(0, 8);
} else if (x == 0 && y == status.GetLength(1) - 1) {
point = new Point(1, 8);
} else if (x == 0) {
if (status[x + 1, y] == Status.Wall) point = new Point(2, 9);
else point = new Point(2, 10);
} else if (y == 0) {
if (status[x, y + 1] == Status.Wall) point = new Point(3, 9);
else point = new Point(3, 10);
} else if (x == status.GetLength(0) - 1) {
if (status[x - 1, y] == Status.Wall) point = new Point(0, 9);
else point = new Point(0, 10);
} else if (y == status.GetLength(1) - 1) {
if (status[x, y - 1] == Status.Wall) point = new Point(1, 9);
else point = new Point(1, 10);
} else {
int walls = 0;
if (status[x - 1, y] == Status.Wall) walls++;
if (status[x, y - 1] == Status.Wall) walls++;
if (status[x + 1, y] == Status.Wall) walls++;
if (status[x, y + 1] == Status.Wall) walls++;
switch (walls) {
case 4:
point = new Point(0, 1);
break;
case 3:
if (status[x - 1, y] == Status.Blank) point = new Point(0, 2);
else if (status[x, y - 1] == Status.Blank) point = new Point(1, 2);
else if (status[x + 1, y] == Status.Blank) point = new Point(2, 2);
else point = new Point(3, 2);
break;
case 2:
if (status[x + 1, y] == Status.Wall && status[x, y + 1] == Status.Wall) point = new Point(0, 3);
else if (status[x, y + 1] == Status.Wall && status[x - 1, y] == Status.Wall) point = new Point(1, 3);
else if (status[x - 1, y] == Status.Wall && status[x, y - 1] == Status.Wall) point = new Point(2, 3);
else if (status[x, y - 1] == Status.Wall && status[x + 1, y] == Status.Wall) point = new Point(3, 3);
else if (status[x - 1, y] == Status.Wall && status[x + 1, y] == Status.Wall) point = new Point(0, 4);
else point = new Point(1, 4);
break;
case 1:
if (status[x + 1, y] == Status.Wall) point = new Point(0, 5);
else if (status[x, y + 1] == Status.Wall) point = new Point(1, 5);
else if (status[x - 1, y] == Status.Wall) point = new Point(2, 5);
else point = new Point(3, 5);
break;
default:
point = new Point(0, 6);
break;
}
}
}
this.ImageChip = new ImageChip(@"Images\back", point.X, point.Y);
}