本文整理汇总了C#中MoveDirection.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MoveDirection.ToString方法的具体用法?C# MoveDirection.ToString怎么用?C# MoveDirection.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveDirection
的用法示例。
在下文中一共展示了MoveDirection.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveAccount
/// <summary>
/// アカウントの順序を変更します。
/// </summary>
public static void MoveAccount(string id, MoveDirection direction)
{
var info = Get(id);
if (info == null)
throw new ArgumentException("アカウント @" + id + " は存在しません。");
var idx = accounts.IndexOf(info);
if (idx < 0)
throw new InvalidOperationException();
switch (direction)
{
case MoveDirection.Up:
if (idx > 0)
{
accounts.RemoveAt(idx);
accounts.Insert(idx - 1, info);
}
break;
case MoveDirection.Down:
if (idx < accounts.Count - 1)
{
accounts.RemoveAt(idx);
accounts.Insert(idx + 1, info);
}
break;
default:
throw new ArgumentException("移動方向指定がちゃんちゃらおかしい :" + direction.ToString());
}
OnAccountsChanged(EventArgs.Empty);
}
示例2: MoveAccountElement
/// <summary>
/// アカウントの並び順を変更します。
/// </summary>
/// <param name="elem">対象アカウント</param>
/// <param name="dir">移動先</param>
public static void MoveAccountElement(string id, MoveDirection dir)
{
var elem = GetAccountElement(id);
if(elem==null)return;
var idx = accountModels.IndexOf(elem);
if (idx < 0) return;
switch (dir)
{
case MoveDirection.Up:
if (idx > 0)
{
accountModels.RemoveAt(idx);
accountModels.Insert(idx - 1, elem);
}
break;
case MoveDirection.Down:
if (idx < accountModels.Count - 1)
{
accountModels.RemoveAt(idx);
accountModels.Insert(idx + 1, elem);
}
break;
default:
throw new ArgumentException("移動方向指定がちゃんちゃらおかしい :" + dir.ToString());
}
AccountsChanged();
}
示例3: setAnimation
public void setAnimation(MoveDirection dir)
{
if (!_animations.ContainsKey(dir))
{
Logger.message(LogLevel.LOG_ERROR, "Animation for MoveDirection "+dir.ToString()+" is not assigned!");
}
else
{
_sprite.Play(_animations[dir]);
}
}
示例4: Calc
private static bool Calc(MoveDirection key)
{
_isMoved = false;
#region Calc
List<int> list = new List<int>();
if (key == MoveDirection.Up)
{
for (int col = 0; col < MATRIX_NUM; col++)
{
list = _dic.Where(item => item.Key.Item2 == col).OrderBy(item => item.Key.Item1).Select(item => item.Value).ToList();
list = CalcSingle(list);
for (int index = 0; index < MATRIX_NUM; index++)
{
_dic[new Tuple<int, int>(index, col)] = list[index];
}
}
}
else if (key == MoveDirection.Down)
{
for (int col = 0; col < MATRIX_NUM; col++)
{
list = _dic.Where(item => item.Key.Item2 == col).OrderByDescending(item => item.Key.Item1).Select(item => item.Value).ToList();
list = CalcSingle(list);
list.Reverse();
for (int index = 0; index < MATRIX_NUM; index++)
{
_dic[new Tuple<int, int>(index, col)] = list[index];
}
}
}
else if (key == MoveDirection.Left)
{
for (int row = 0; row < MATRIX_NUM; row++)
{
list = _dic.Where(item => item.Key.Item1 == row).OrderBy(item => item.Key.Item2).Select(item => item.Value).ToList();
list = CalcSingle(list);
for (int index = 0; index < MATRIX_NUM; index++)
{
_dic[new Tuple<int, int>(row, index)] = list[index];
}
}
}
else if (key == MoveDirection.Right)
{
for (int row = 0; row < MATRIX_NUM; row++)
{
list = _dic.Where(item => item.Key.Item1 == row).OrderByDescending(item => item.Key.Item2).Select(item => item.Value).ToList();
list = CalcSingle(list);
list.Reverse();
for (int index = 0; index < MATRIX_NUM; index++)
{
_dic[new Tuple<int, int>(row, index)] = list[index];
}
}
}
else
{
return true; //输入非法, 不做处理
}
#endregion
if (!_isMoved) //没有产生移动
return CheckCanContinue();
if (CheckHasHole())
{
var listEmpty = _dic.Where(item => item.Value == 0).Select(item => item.Key).ToList();
var tuple = listEmpty[_random.Next(listEmpty.Count)];
_dic[tuple] = FILL_VALUE;
_step++;
Console.WriteLine("===============" + key.ToString() + " Step:" + _step);
Print();
return CheckCanContinue();
}
else
{
return CheckHasNearSameValue();
}
}
示例5: IsLandingSquareEmpty
private Boolean IsLandingSquareEmpty(Byte startSquare, MoveDirection jumpDirection)
{
Boolean answer = false;
String start = startSquare.ToString() + jumpDirection.ToString().ToLower();
Byte landingSquare = JumpLandingSquareLookup[start];
UInt64 landingBitBoard = squareTable[landingSquare];
if ((emptySquares & landingBitBoard) != 0UL)
answer = true;
return answer;
}
示例6: CreateMoveFromJump
private Move CreateMoveFromJump(Byte index, MoveDirection direction)
{
String key = index.ToString() + direction.ToString().ToLower();
Byte landingSquare = JumpLandingSquareLookup[key];
Move move = new Move(index, landingSquare, true);
return move;
}
示例7: Move
public void Move(MoveDirection md)
{
Debug.Log (md.ToString () + " move.");
moveMade = false;
ResetMergedFlags ();
if (delay > 0)
StartCoroutine (MoveCoroutine (md));
else
{
for (int i =0; i< rows.Count; i++)
{
switch (md)
{
case MoveDirection.Down:
while (MakeOneMoveUpIndex(columns[i]))
{
moveMade = true;
}
break;
case MoveDirection.Left:
while (MakeOneMoveDownIndex(rows[i]))
{
moveMade =true;
}
break;
case MoveDirection.Right:
while (MakeOneMoveUpIndex(rows[i]))
{
moveMade =true;
}
break;
case MoveDirection.Up:
while (MakeOneMoveDownIndex(columns[i]))
{
moveMade =true;
}
break;
}
}
if (moveMade)
{
UpdateEmptyTiles ();
Generate ();
if (!CanMove())
{
GameOver();
}
}
}
}
示例8: Move
internal void Move(MoveDirection direction)
{
_playerProvider.DoSourceCommand(_source, "Move"+direction.ToString());
}