Show / Hide Table of Contents

Class SpriteManager

Class for managing loading and caching Sprites from png files.

Inheritance
System.Object
SpriteManager
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ItemChanger.Internal
Assembly: ItemChanger.dll
Syntax
public class SpriteManager

Constructors

| Improve this Doc View Source

SpriteManager(Assembly, String)

Creates a SpriteManager to lazily load and cache Sprites from the embedded png files in the specified assembly.
Only filepaths with the matching prefix are considered, and the prefix is removed to determine sprite names (e.g. "ItemChangerMod.Resources." is the prefix for Instance).
Images will be loaded with default Bilinear filter mode and 100 pixels per unit.

Declaration
public SpriteManager(Assembly a, string resourcePrefix)
Parameters
Type Name Description
System.Reflection.Assembly a
System.String resourcePrefix
| Improve this Doc View Source

SpriteManager(Assembly, String, SpriteManager.Info)

Creates a SpriteManager to lazily load and cache Sprites from the embedded png files in the specified assembly.
Only filepaths with the matching prefix are considered, and the prefix is removed to determine sprite names (e.g. "ItemChangerMod.Resources." is the prefix for Instance).

Declaration
public SpriteManager(Assembly a, string resourcePrefix, SpriteManager.Info info)
Parameters
Type Name Description
System.Reflection.Assembly a
System.String resourcePrefix
SpriteManager.Info info

Properties

| Improve this Doc View Source

Instance

The SpriteManager with access to embedded ItemChanger pngs, constructed with the ItemChanger assembly and prefix "ItemChanger.Resources."

Declaration
public static SpriteManager Instance { get; }
Property Value
Type Description
SpriteManager

Methods

| Improve this Doc View Source

GetSprite(String)

Fetches the Sprite with the specified name. If it has not yet been loaded, loads it from embedded resources and caches the result.
The name is the path of the image as an embedded resource, with the SpriteManager prefix and file extension removed.
For example, the image at "ItemChanger.Resources.ShopIcons.Geo.png" has key "ShopIcons.Geo" in SpriteManager.Instance.

Declaration
public Sprite GetSprite(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
Sprite
| Improve this Doc View Source

Load(Stream, FilterMode)

Loads a sprite from the png file passed as a stream.

Declaration
public static Sprite Load(Stream data, FilterMode filterMode = null)
Parameters
Type Name Description
Stream data
FilterMode filterMode
Returns
Type Description
Sprite
| Improve this Doc View Source

Load(Byte[], FilterMode)

Loads a sprite from the png file passed as a byte array.

Declaration
public static Sprite Load(byte[] data, FilterMode filterMode)
Parameters
Type Name Description
System.Byte[] data
FilterMode filterMode
Returns
Type Description
Sprite
| Improve this Doc View Source

Load(Byte[], FilterMode, Single)

Declaration
public static Sprite Load(byte[] data, FilterMode filterMode, float pixelsPerUnit)
Parameters
Type Name Description
System.Byte[] data
FilterMode filterMode
System.Single pixelsPerUnit
Returns
Type Description
Sprite

Extension Methods

Extensions.Yield<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX