Bricklayer.Client.World.Map.HandleInput C# (CSharp) Метод

HandleInput() приватный Метод

Handles input for the level, such as clicking blocks and selecting them
private HandleInput ( ) : void
Результат void
        private void HandleInput()
        {
            //Get positions
            Point MousePosition = new Point((int)MainCamera.Position.X + (int)Game.Input.MousePosition.X, (int)MainCamera.Position.Y + (int)Game.Input.MousePosition.Y);
            Point GridPosition = new Point(MousePosition.X / Tile.Width, MousePosition.Y / Tile.Height);

            //If LeftButton Clicked
            if (Game.Input.IsLeftClicked())
            {

            }
            //If RightButton Clicked
            if (Game.Input.IsRightClicked())
            {

            }
            //If LeftButton Down
            if (Game.Input.IsLeftDown())
            {
                //Place a tile
                BlockType block = SelectedBlock;
                if (MousePosition.X > MainCamera.Left && MousePosition.Y > MainCamera.Top && MousePosition.X < MainCamera.Right && MousePosition.Y < MainCamera.Bottom)
                {
                    //Find the layer
                    Layer layer = Game.Input.IsKeyDown(Keys.LeftShift) && (SelectedBlock.Layer == Layer.Background || SelectedBlock.Layer == Layer.All) ? Layer.Background : Layer.Foreground;
                    PlaceTile(GridPosition.X, GridPosition.Y, layer, block, true); //Place the tile
                }
            }
            //If RightButton Down
            if (Game.Input.IsRightDown())
            {

            }

            if (!(Bricklayer.Client.Interface.MainWindow.ScreenManager.Current as Bricklayer.Client.Interface.GameScreen).ChatBox.TextBox.Focused && !Game.IsMouseOnControl)
            {

                //Select block
                int key = Game.Input.GetDigitPressed();

                BlockType[] Foregrounds = BlockType.BlockList.Where(x => x.Layer == Layer.Foreground || x.Layer == Layer.All).ToArray<BlockType>();
                if (key < Foregrounds.Length && key > -1)
                    SelectedBlock = Foregrounds[key];
            }
        }