我希望检查schema
中的哪些字段设置为unique
,类似于通过indexes
获取schema
的{{1}}。可以在MyCollection.collection.getIndexes()
对象的某处找到此信息吗?
答案 0 :(得分:2)
试试这个:
static void MovePlayer(int playerNo, int distance, char direction)
{
Console.WriteLine("Making a move for " + players[playerNo].Name);
switch (direction)
{
case 'U':
// Moving the player up - need to decrease the value of Y
// because the origin is the top left hand corner of the board
players[playerNo].Y = players[playerNo].Y - distance;
// This might take us off the top of the board, so we need to
// wrap round
if (players[playerNo].Y < 0)
{
players[playerNo].Y = players[playerNo].Y + 8;
}
break;
case 'D': //down
players[playerNo].Y = players[playerNo].Y - distance;
// need to move down - increase Y
if (players[playerNo].Y > 0)
{
players[playerNo].Y = players[playerNo].Y - 8;
}
break;
case 'L':
players[playerNo].Y = players[playerNo].Y - distance;
break;
case 'R':
break;
}