internal SpritePartDrawInfo(ISpritePart spritePart, int typeId, int frame, string imagePath, Thickness2I margin, Point2I size) { TypeId = typeId; ImagePath = imagePath; Margin = margin; Size = size; }
/// <summary> /// Tries to get the sprite part with the specified Id in the category. /// </summary> /// <param name="id">The Id of the sprite part to get.</param> /// <param name="value">The output sprite part if one was found, otherwise null.</param> /// <returns>True if an sprite part with the Id was found, otherwise null.</returns> public bool TryGetValue(int id, out ISpritePart part) { part = List.Find(p => p.Id == id); return(part != null); }
/// <summary> /// Gets the sprite part with the specified Id in the category. /// </summary> /// <param name="id">The Id of the sprite part to get.</param> /// <returns>The sprite part with the specified Id.</returns> public ISpritePart Get(int id) { ISpritePart part = List.Find(p => p.Id == id); return(part ?? throw new KeyNotFoundException($"Could not find key \"{id}\"!")); }