コード例 #1
0
        /// <summary>
        /// Tiles the at position.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns>A TileMaskCollection.</returns>
        public TileMaskCollection TilesAtPosition(int x, int y, int width, int height)
        {
            TileMaskCollection find = new TileMaskCollection(BytesPerColor)
            {
                tiles = tiles.Where((t) =>
                {
                    if (t.X + t.Width < x + 1)
                    {
                        return(false);
                    }
                    if (x + width < t.X + 1)
                    {
                        return(false);
                    }
                    if (t.Y + t.Height < y + 1)
                    {
                        return(false);
                    }
                    if (y + height < t.Y + 1)
                    {
                        return(false);
                    }

                    return(true);
                }).ToList()
            };

            find.Sort();
            find.UpdateContainer();
            return(find);
        }
コード例 #2
0
 /// <summary>
 /// Finds the by area.
 /// </summary>
 /// <param name="x">The x.</param>
 /// <param name="width">The width.</param>
 /// <param name="y">The y.</param>
 /// <param name="height">The height.</param>
 public TileMaskCollection FindByArea(int x, int y, int width, int height)
 {
     if (selection == null)
     {
         selection = new TileMaskCollection(BytesPerColor);
     }
     selection.tiles  = TilesAtPosition(x, y, width, height).tiles;
     selection.sorted = false;
     selection.UpdateContainer();
     OnSelectionChanged?.Invoke(this, selection);
     return(selection);
 }