当前位置: 首页>>代码示例>>C#>>正文


C# Direction.ToString方法代码示例

本文整理汇总了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");
        }
开发者ID:JakeColtman,项目名称:Game,代码行数:9,代码来源:IsometricPoint.cs

示例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");
        }
开发者ID:JakeColtman,项目名称:Game,代码行数:9,代码来源:DraughtsPoint.cs

示例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"];
 }
开发者ID:pacificIT,项目名称:mono-upnp,代码行数:13,代码来源:ConnectionManagerController.cs

示例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;

        }
开发者ID:tybed7,项目名称:StashApiCSharp,代码行数:15,代码来源:PullRequests.cs

示例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;
        }
    }
开发者ID:Blaster391,项目名称:BogoGame,代码行数:47,代码来源:nodeEditor.cs

示例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++;
        }
开发者ID:BornToGrill,项目名称:A-Maze-ing_Simulator,代码行数:17,代码来源:Player.cs

示例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));
                    }
                }
            }
        }
开发者ID:ibratoev,项目名称:MEF.NET35,代码行数:45,代码来源:Shape.cs

示例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;
		}
开发者ID:CaptainJiNX,项目名称:Escape.From.NullReferenceException,代码行数:18,代码来源:ClientWrapper.cs

示例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;
        }
开发者ID:psrodriguez,项目名称:CIAPI.CS,代码行数:19,代码来源:Trader.cs

示例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());
			}
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:36,代码来源:AGSFaceDirectionBehavior.cs

示例11: SetSide

 public void SetSide(Direction direction, IMapSite side)
 {
     var index = direction.ToString();
     _sides[index] = side;
 }
开发者ID:AbstractStudent,项目名称:Patterns-GOF-,代码行数:5,代码来源:MazeModels.cs

示例12: Collapse

        public virtual void Collapse(Direction direction)
        {
            this.SuspendScripting();
            this.Collapsed = true;
            this.ResumeScripting();

            this.Call("collapse", direction.ToString().ToLowerInvariant());
        }
开发者ID:hh22333,项目名称:Ext.NET.Community,代码行数:8,代码来源:AbstractPanel.cs

示例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;
                }

            }
        }
开发者ID:silupher,项目名称:ChassisManager,代码行数:30,代码来源:Vt100Base.cs

示例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;
            }
        }
开发者ID:silupher,项目名称:ChassisManager,代码行数:75,代码来源:Vt100Base.cs

示例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);
 }
开发者ID:Gremlin13,项目名称:StarryboundServer,代码行数:6,代码来源:ClientThread.cs


注:本文中的Direction.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。