示例#1
0
        private void cursorMoveInput(Vector2 delta, Boolean precise = false)
        {
            if (!tryMoveTileView(delta))
            {
                return;
            }
            Vector2 position = this.GetTileCursorPosition();
            Vector2 tile     = this.GetViewingTile();
            String? name     = TileInfo.getNameAtTile(tile);

            if (name == null)
            {
                // Report if a tile is empty or blocked if there is nothing on it
                if (TileInfo.isCollidingAtTile((int)tile.X, (int)tile.Y))
                {
                    name = "blocked";
                }
                else
                {
                    name = "empty";
                }
            }
            if (precise)
            {
                MainClass.ScreenReader.Say($"{name}, {position.X}, {position.Y}", true);
            }
            else
            {
                MainClass.ScreenReader.Say($"{name}, {(int)(position.X / Game1.tileSize)}, {(int)(position.Y / Game1.tileSize)}", true);
            }
        }
示例#2
0
        public void run(bool manuallyTriggered = false, bool playersPosition = false)
        {
            try
            {
                Vector2 tile;

                #region Get Tile
                int x, y;
                if (!playersPosition)
                {
                    // Grab tile
                    tile = CurrentPlayer.FacingTile;
                }
                else
                {
                    // Player's standing tile
                    tile = CurrentPlayer.Position;
                }
                x = (int)tile.X;
                y = (int)tile.Y;
                #endregion

                if (Context.IsPlayerFree)
                {
                    if (!manuallyTriggered && prevTile != tile)
                    {
                        if (MainClass.ScreenReader != null)
                        {
                            MainClass.ScreenReader.PrevTextTile = " ";
                        }
                    }

                    bool isColliding = TileInfo.isCollidingAtTile(x, y);

                    (string?name, string?category)info = TileInfo.getNameWithCategoryNameAtTile(tile);

                    #region Narrate toSpeak
                    if (info.name != null)
                    {
                        if (MainClass.ScreenReader != null)
                        {
                            if (manuallyTriggered)
                            {
                                MainClass.ScreenReader.Say($"{info.name}, Category: {info.category}", true);
                            }
                            else
                            {
                                MainClass.ScreenReader.SayWithTileQuery(info.name, x, y, true);
                            }
                        }
                    }
                    #endregion

                    #region Play colliding sound effect
                    if (isColliding && prevTile != tile)
                    {
                        Game1.playSound("colliding");
                    }
                    #endregion

                    if (!manuallyTriggered)
                    {
                        prevTile = tile;
                    }
                }
            }
            catch (Exception e)
            {
                MainClass.ErrorLog($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}");
            }
        }