本文整理汇总了C#中Direction.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.ToString方法的具体用法?C# Direction.ToString怎么用?C# Direction.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_next_point_in_direction
public IPoint get_next_point_in_direction(Direction direction)
{
if (direction is UpLeft) return new IsometricPoint(_left + 1, _right);
if (direction is UpRight) return new IsometricPoint(_left , _right + 1);
if (direction is DownLeft) return new IsometricPoint(_left - 1, _right);
if (direction is DownRight) return new IsometricPoint(_left, _right - 1);
throw new NotImplementedException(direction.ToString() + " is not a valid dimension");
}
示例2: get_next_point_in_direction
public IPoint get_next_point_in_direction(Direction direction)
{
if (direction is WhiteManLeftDirection) return new DraughtsPoint(_left + 1, _right);
if (direction is WhiteManRightDirection) return new DraughtsPoint(_left, _right + 1);
if (direction is BlackManLeftDirection) return new DraughtsPoint(_left - 1, _right);
if (direction is BlackManRightDirection) return new DraughtsPoint(_left, _right - 1);
throw new NotImplementedException(direction.ToString() + " is not a valid dimension");
}
示例3: PrepareForConnection
public void PrepareForConnection (string remoteProtocolInfo, string peerConnectionManager, int peerConnectionID, Direction direction, out string connectionID, out string aVTransportID, out string rcsID)
{
if (!CanPrepareForConnection) throw new NotImplementedException ();
Dictionary<string, string> in_arguments = new Dictionary<string, string> (4);
in_arguments.Add ("RemoteProtocolInfo", remoteProtocolInfo);
in_arguments.Add ("PeerConnectionManager", peerConnectionManager);
in_arguments.Add ("PeerConnectionID", peerConnectionID.ToString ());
in_arguments.Add ("Direction", direction.ToString ());
var action_result = controller.Actions["PrepareForConnection"].Invoke (in_arguments);
connectionID = action_result["ConnectionID"];
aVTransportID = action_result["AVTransportID"];
rcsID = action_result["RcsID"];
}
示例4: Get
public async Task<ResponseWrapper<PullRequest>> Get(string projectKey, string repositorySlug, RequestOptions options = null, Direction direction = Direction.INCOMING,
PullRequestState state = PullRequestState.OPEN, bool withAttributes = true, bool withProperties = true)
{
string requestUrl = UrlBuilder.ToRestApiUrl(string.Format(PULL_REQUEST, projectKey, repositorySlug))
.WithOptions(options)
.WithQueryParam("direction", direction.ToString())
.WithQueryParam("state", state.ToString())
.WithQueryParam("withAttributes", withAttributes.ToString())
.WithQueryParam("withProperties", withProperties.ToString());
var pr = await _httpWorker.GetAsync<ResponseWrapper<PullRequest>>(requestUrl).ConfigureAwait(false);
return pr;
}
示例5: clearNodeConnectionDirection
void clearNodeConnectionDirection(NodeScript ns, Direction d)
{
int x = ns.posX;
int y = ns.posY;
if (d == Direction.SOUTH)
{
y--;
if (!nodeMaster.isSpaceFree(x, y))
{
clearNodeConnectionDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.NORTH);
}
return;
}
else if (d == Direction.WEST)
{
x--;
if (!nodeMaster.isSpaceFree(x, y))
{
clearNodeConnectionDirection(nodeMaster.getNode(x, y).GetComponent<NodeScript>(), Direction.EAST);
}
return;
}
if (ns.connection[(int)d] != null)
{
if ((int)d % 2 == 0) {
GameObject con = null;
try
{
con = ns.gameObject.transform.FindChild("Conduit_" + d.ToString()).gameObject; //TODO fix naughty code
}
catch { }
if (con != null)
{
DestroyImmediate(con);
}
}
else
{
}
ns.connection[(int)d].GetComponent<NodeScript>().connection[(int)oppositeDirection(d)] = null;
ns.connection[(int)d] = null;
}
}
示例6: MovePlayer
public void MovePlayer(Direction dir, bool MovedByHallway = false)
{
if (!MovedByHallway) {
Phase.IncrementMoveData("PawnMoved");
if (Phase.IsReceivingData)
Phase.SendMoveData("PawnMoved", PlayerIndex.ToString(), dir.ToString());
}
if (dir == Direction.Left)
this.Position.X--;
else if (dir == Direction.Right)
this.Position.X++;
else if (dir == Direction.Up)
this.Position.Y--;
else if (dir == Direction.Down)
this.Position.Y++;
}
示例7: Move
public void Move(Direction direction)
{
if (EnvironmentShape != null)
{
int newX = X;
int newY = Y;
switch (direction)
{
case Direction.Left:
newX--;
break;
case Direction.Down:
newY++;
break;
case Direction.Right:
newX++;
break;
case Direction.Up:
newY--;
break;
default:
throw new NotImplementedException(
string.Format(CultureInfo.InvariantCulture, "Move to {0} is not implemented", direction.ToString()));
}
if (IsPositionValid(Matrix, newX, newY))
{
X = newX;
Y = newY;
}
else if (direction == Direction.Down)
{
MergeIntoEnvironment();
int layersFilled = RemoveFilledLayers();
if (ReachedBottom != null)
{
ReachedBottom(this, new ReachedBottomEventArgs(layersFilled));
}
}
}
}
示例8: Move
public ScanResult Move(string charId, Direction direction)
{
var result = RunCommand("move", charId, direction.ToString().ToLowerInvariant());
var scanResult = result.ToObject<ScanResult>();
var success = result["success"];
if (success != null && success.HasValues)
{
var movedTo = success["movedto"];
if (movedTo != null)
{
scanResult.MoveSucceeded = true;
scanResult.MovedTo = new Position(movedTo.Value<int>("x"), movedTo.Value<int>("y"));
}
}
return scanResult;
}
示例9: Trade
public ApiTradeOrderResponseDTO Trade(PriceDTO price, Direction direction)
{
AccountInformationResponseDTO accountInfo = _client.AccountInformation.GetClientAndTradingAccount();
int tradingAccountId = GetTradingAccountId(_client, price.MarketId, accountInfo);
var request = new NewTradeOrderRequestDTO
{
MarketId = price.MarketId,
Direction = direction.ToString().ToLower(),
Quantity = Quantity,
BidPrice = price.Bid,
OfferPrice = price.Offer,
AuditId = price.AuditId,
TradingAccountId = tradingAccountId,
AutoRollover = false
};
ApiTradeOrderResponseDTO response = _client.TradesAndOrders.Trade(request);
return response;
}
示例10: FaceDirectionAsync
public async Task FaceDirectionAsync(Direction direction)
{
Direction = direction;
IDirectionalAnimation animation = CurrentDirectionalAnimation;
if (animation == null) return;
switch (direction)
{
case Direction.Down:
await faceDirectionAsync(Direction.Down, Direction.Up, Direction.Left, Direction.Right);
return;
case Direction.Up:
await faceDirectionAsync(Direction.Up, Direction.Down, Direction.Left, Direction.Right);
return;
case Direction.Left:
await faceDirectionAsync(Direction.Left, Direction.Down, Direction.Up, Direction.Right);
return;
case Direction.Right:
await faceDirectionAsync(Direction.Right, Direction.Down, Direction.Up, Direction.Left);
return;
case Direction.DownRight:
await faceDirectionAsync(Direction.DownRight, Direction.Right, Direction.Down, Direction.Up, Direction.Left);
return;
case Direction.DownLeft:
await faceDirectionAsync(Direction.DownLeft, Direction.Left, Direction.Down, Direction.Up, Direction.Right);
return;
case Direction.UpRight:
await faceDirectionAsync(Direction.UpRight, Direction.Right, Direction.Up, Direction.Down, Direction.Left);
return;
case Direction.UpLeft:
await faceDirectionAsync(Direction.UpLeft, Direction.Left, Direction.Up, Direction.Down, Direction.Right);
return;
default:
throw new NotSupportedException ("Direction is not supported: " + direction.ToString());
}
}
示例11: SetSide
public void SetSide(Direction direction, IMapSite side)
{
var index = direction.ToString();
_sides[index] = side;
}
示例12: Collapse
public virtual void Collapse(Direction direction)
{
this.SuspendScripting();
this.Collapsed = true;
this.ResumeScripting();
this.Call("collapse", direction.ToString().ToLowerInvariant());
}
示例13: DirectionalMove
/// <summary>
/// Moves the console cursor in the direction specified, by the
/// numbers specified
/// </summary>
protected void DirectionalMove(int[] nums, Direction dir)
{
foreach (int num in nums)
{
switch (dir)
{
case Direction.Up:
SetCursorUp(num);
break;
case Direction.Down:
SetCursorDown(num);
break;
case Direction.Left:
SetCursorBack(num);
break;
case Direction.Right:
SetCursorForward(num);
break;
case Direction.Invalid:
default:
Debug.WriteLine(string.Format("Unknown Cursor Movement: {0} Direction: {1}", "DirectionalMove", dir.ToString()));
break;
}
}
}
示例14: ClearToDirection
/// <summary>
/// Clear Console to the current position to the end of line
/// </summary>
protected virtual void ClearToDirection(Direction dir)
{
PositionTop = Console.CursorTop;
PositionLeft = Console.CursorLeft;
// capture current cursor positions.
int originalLeft = PositionLeft;
int originalTop = PositionTop;
switch (dir)
{
case Direction.Up:
// move the cursor to the top
SetCursorPosition(0, 0);
// Erase from the current line position to the top of the screen
for (int i = 0; i <= originalTop; i++)
{
for (int x = 0; x < Console.WindowWidth; x++)
{
Console.Write(" ");
}
SetCursorPosition(i, 0);
}
// set the cursor back to the original row
// reset the cursor left to the begining of the line
SetCursorPosition(originalTop, originalLeft);
break;
case Direction.Down:
// Erase from the current line position to the bottom of the screen
for (int i = originalTop; i <= Console.WindowHeight; i++)
{
Console.CursorLeft = 0;
for (int x = 0; x < Console.WindowWidth; x++)
{
Console.Write(" ");
}
SetCursorPosition(i, 0);
}
// set the cursor back to the original row
// reset the cursor left to the begining of the line
SetCursorPosition(originalTop, originalLeft);
break;
case Direction.Left:
// set cursor to begining of line
SetCursorPosition(originalTop, 0);
// shift cursor to known left position
for (int i = 0; i < PositionLeft; i++)
{
// overwrite with nothing (erase).
Console.Write(" ");
}
SetCursorPosition(originalTop, originalLeft);
break;
case Direction.Right:
// from current position to the width of the console,
// write nothing
for (int i = originalLeft; i <= Console.WindowWidth; i++)
{
Console.Write(" ");
}
// set the cursor back to origin.
SetCursorPosition(originalTop, originalLeft);
break;
case Direction.Invalid:
default:
Debug.WriteLine(string.Format("Unknown erase comamnd: {0} ", dir.ToString()));
break;
}
}
示例15: errorDisconnect
public void errorDisconnect(Direction direction, string reason)
{
if (this.clientState != ClientState.Disposing)
StarryboundServer.logError("[" + playerData.client + "] Dropped by parent " + direction.ToString() + " for " + reason);
doDisconnect(true);
}