Baldi's Basics Plus Glue API
Modding API for Baldi's Basics Plus
Loading...
Searching...
No Matches
BBPGlue.API.BBPAssetLoader Class Referencesealed

Utility for loading and registering assets like sprites, audio clips, and sound objects. More...

Public Member Functions

void Clear ()
 Clears all registered assets from the loader.
BBPSoundObjectCreateSound (string id, AudioClip clip, string key="", string soundType="Effect", float volume=1f, bool subtitle=false)
 Creates a sound object from an AudioClip and registers it under the given identifier.
object? CreateSoundObject (AudioClip clip, string key="", string soundType="Effect", float volume=1f, bool subtitle=false)
 Creates a raw sound object from the given AudioClip and parameters.
AudioClip? GetAudioClip (string id)
 Retrieves a registered audio clip by identifier.
BBPSoundObjectGetSound (string id)
 Retrieves a registered sound object by identifier.
Sprite? GetSprite (string id)
 Retrieves a registered sprite by identifier.
IEnumerator LoadAudioClip (string id, string path, AudioType audioType, Action< AudioClip?> callback)
 Asynchronously loads an audio clip from the given path and registers it under the provided id.
IEnumerator LoadAudioClip (string path, AudioType audioType, Action< AudioClip?> callback)
 Asynchronously loads an audio clip from a file path.
Sprite? LoadSprite (string id, string path, float pixelsPerUnit=100f)
 Loads a sprite from disk and registers it under the given identifier.
Sprite? LoadSprite (string path, float pixelsPerUnit=100f)
 Loads a sprite from a file path.
void RegisterAudioClip (string id, AudioClip clip)
 Registers an audio clip with the given identifier.
void RegisterSound (string id, BBPSoundObject sound)
 Registers a sound object with the given identifier.
void RegisterSprite (string id, Sprite sprite)
 Registers a sprite with the given identifier.
bool RemoveAudioClip (string id)
 Removes a registered audio clip by identifier.
bool RemoveSound (string id)
 Removes a registered sound by identifier.
bool RemoveSprite (string id)
 Removes a registered sprite by identifier.

Properties

IReadOnlyDictionary< string, AudioClip > AudioClips [get]
 Gets a read-only view of registered audio clips.
IReadOnlyDictionary< string, BBPSoundObjectSounds [get]
 Gets a read-only view of registered sound objects.
IReadOnlyDictionary< string, Sprite > Sprites [get]
 Gets a read-only view of registered sprites.

Detailed Description

Utility for loading and registering assets like sprites, audio clips, and sound objects.

Member Function Documentation

◆ Clear()

void BBPGlue.API.BBPAssetLoader.Clear ( )

Clears all registered assets from the loader.

◆ CreateSound()

BBPSoundObject? BBPGlue.API.BBPAssetLoader.CreateSound ( string id,
AudioClip clip,
string key = "",
string soundType = "Effect",
float volume = 1f,
bool subtitle = false )

Creates a sound object from an AudioClip and registers it under the given identifier.

Parameters
idThe identifier to register the created sound under.
clipThe audio clip to use for the sound.
keyAn optional key identifying the sound.
soundTypeThe sound type as string (e.g., "Effect").
volumeVolume multiplier for the sound.
subtitleWhether the sound should show subtitles.
Returns
The created BBPSoundObject if successful; otherwise null.

◆ CreateSoundObject()

object? BBPGlue.API.BBPAssetLoader.CreateSoundObject ( AudioClip clip,
string key = "",
string soundType = "Effect",
float volume = 1f,
bool subtitle = false )

Creates a raw sound object from the given AudioClip and parameters.

Parameters
clipThe audio clip to use.
keyAn optional key identifying the sound.
soundTypeThe sound type as a string.
volumeVolume multiplier for the sound.
subtitleWhether the sound should display subtitles.
Returns
The raw sound object if creation succeeded; otherwise null.

◆ GetAudioClip()

AudioClip? BBPGlue.API.BBPAssetLoader.GetAudioClip ( string id)

Retrieves a registered audio clip by identifier.

Parameters
idThe identifier of the audio clip.
Returns
The AudioClip if found; otherwise null.

◆ GetSound()

BBPSoundObject? BBPGlue.API.BBPAssetLoader.GetSound ( string id)

Retrieves a registered sound object by identifier.

Parameters
idThe identifier of the sound.
Returns
The BBPSoundObject if found; otherwise null.

◆ GetSprite()

Sprite? BBPGlue.API.BBPAssetLoader.GetSprite ( string id)

Retrieves a registered sprite by identifier.

Parameters
idThe identifier of the sprite.
Returns
The Sprite if found; otherwise null.

◆ LoadAudioClip() [1/2]

IEnumerator BBPGlue.API.BBPAssetLoader.LoadAudioClip ( string id,
string path,
AudioType audioType,
Action< AudioClip?> callback )

Asynchronously loads an audio clip from the given path and registers it under the provided id.

Parameters
idThe identifier to register the loaded clip under.
pathThe filesystem path to the audio file.
audioTypeThe audio type to use when loading.
callbackCallback invoked with the loaded AudioClip, or null on failure.

◆ LoadAudioClip() [2/2]

IEnumerator BBPGlue.API.BBPAssetLoader.LoadAudioClip ( string path,
AudioType audioType,
Action< AudioClip?> callback )

Asynchronously loads an audio clip from a file path.

Parameters
pathThe filesystem path to the audio file.
audioTypeThe audio type to use when loading.
callbackCallback invoked with the loaded AudioClip, or null on failure.

◆ LoadSprite() [1/2]

Sprite? BBPGlue.API.BBPAssetLoader.LoadSprite ( string id,
string path,
float pixelsPerUnit = 100f )

Loads a sprite from disk and registers it under the given identifier.

Parameters
idThe identifier to register the loaded sprite under.
pathThe filesystem path to the image file.
pixelsPerUnitPixels per unit for the created sprite.
Returns
The loaded Sprite if successful; otherwise null.

◆ LoadSprite() [2/2]

Sprite? BBPGlue.API.BBPAssetLoader.LoadSprite ( string path,
float pixelsPerUnit = 100f )

Loads a sprite from a file path.

Parameters
pathThe filesystem path to the image file.
pixelsPerUnitPixels per unit used when creating the sprite.
Returns
The created Sprite if loading succeeded; otherwise null.

◆ RegisterAudioClip()

void BBPGlue.API.BBPAssetLoader.RegisterAudioClip ( string id,
AudioClip clip )

Registers an audio clip with the given identifier.

Parameters
idThe identifier for the audio clip.
clipThe audio clip to register.

◆ RegisterSound()

void BBPGlue.API.BBPAssetLoader.RegisterSound ( string id,
BBPSoundObject sound )

Registers a sound object with the given identifier.

Parameters
idThe identifier for the sound.
soundThe sound object to register.

◆ RegisterSprite()

void BBPGlue.API.BBPAssetLoader.RegisterSprite ( string id,
Sprite sprite )

Registers a sprite with the given identifier.

Parameters
idThe identifier for the sprite.
spriteThe sprite to register.

◆ RemoveAudioClip()

bool BBPGlue.API.BBPAssetLoader.RemoveAudioClip ( string id)

Removes a registered audio clip by identifier.

Parameters
idThe identifier of the audio clip to remove.
Returns
True if the audio clip was removed; otherwise false.

◆ RemoveSound()

bool BBPGlue.API.BBPAssetLoader.RemoveSound ( string id)

Removes a registered sound by identifier.

Parameters
idThe identifier of the sound to remove.
Returns
True if the sound was removed; otherwise false.

◆ RemoveSprite()

bool BBPGlue.API.BBPAssetLoader.RemoveSprite ( string id)

Removes a registered sprite by identifier.

Parameters
idThe identifier of the sprite to remove.
Returns
True if the sprite was removed; otherwise false.

Property Documentation

◆ AudioClips

IReadOnlyDictionary<string, AudioClip> BBPGlue.API.BBPAssetLoader.AudioClips
get

Gets a read-only view of registered audio clips.

◆ Sounds

IReadOnlyDictionary<string, BBPSoundObject> BBPGlue.API.BBPAssetLoader.Sounds
get

Gets a read-only view of registered sound objects.

◆ Sprites

IReadOnlyDictionary<string, Sprite> BBPGlue.API.BBPAssetLoader.Sprites
get

Gets a read-only view of registered sprites.


The documentation for this class was generated from the following file: