Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Chunks.Plugins.PluginResource Class Reference

Base class for types that can be loaded from a plugin as a resource. More...

Inheritance diagram for Chunks.Plugins.PluginResource:
Chunks.Audio.SoundEffect Chunks.Geometry.Block Chunks.Geometry.Surface Chunks.Graphics.LightingSettings Chunks.Graphics.Model Chunks.Graphics.Sprite Chunks.Graphics.Texture

Public Member Functions

override string ToString ()
 Returns the fully qualified name of this resource. More...
 

Public Attributes

bool IsValid => Plugin == null || Plugin.IsLoaded
 

Protected Member Functions

 PluginResource ()
 
void AssertIsValid ()
 
virtual void OnInitialize ()
 
virtual void OnReadDefinition (JToken token, string directory)
 When overridden in an inheriting class, handles reading information about the resource from a json token. Base implementation populates any properties decorated with a JsonPropertyAttribute. More...
 
ResourceName GetResourceName (JToken token)
 Converts a json token to a resource name, associating it with the current namespace. Only valid from within OnReadDefinition. More...
 
ResourceName GetResourceName (JToken token, ResourceName @default)
 Converts a json token to a resource name, associating it with the current namespace. Only valid from within OnReadDefinition. If the token is null, default is used. More...
 

Properties

Plugin Plugin [get]
 Plugin this resource was loaded from. More...
 
ResourceName Name [get]
 Name of this resource. More...
 

Detailed Description

Base class for types that can be loaded from a plugin as a resource.

Constructor & Destructor Documentation

Chunks.Plugins.PluginResource.PluginResource ( )
protected

Member Function Documentation

void Chunks.Plugins.PluginResource.AssertIsValid ( )
protected
ResourceName Chunks.Plugins.PluginResource.GetResourceName ( JToken  token)
protected

Converts a json token to a resource name, associating it with the current namespace. Only valid from within OnReadDefinition.

Parameters
tokenToken to convert to a resource name
ResourceName Chunks.Plugins.PluginResource.GetResourceName ( JToken  token,
ResourceName default 
)
protected

Converts a json token to a resource name, associating it with the current namespace. Only valid from within OnReadDefinition. If the token is null, default is used.

Parameters
tokenToken to convert to a resource name
defaultResource name to use if the token is null
virtual void Chunks.Plugins.PluginResource.OnInitialize ( )
protectedvirtual
virtual void Chunks.Plugins.PluginResource.OnReadDefinition ( JToken  token,
string  directory 
)
protectedvirtual

When overridden in an inheriting class, handles reading information about the resource from a json token. Base implementation populates any properties decorated with a JsonPropertyAttribute.

Parameters
tokenToken to load the resource from
directoryLocation of the loaded json file's parent directory

Reimplemented in Chunks.Graphics.Texture, Chunks.Geometry.Block, Chunks.Geometry.Surface, Chunks.Audio.SoundEffect, and Chunks.Graphics.Model.

override string Chunks.Plugins.PluginResource.ToString ( )

Returns the fully qualified name of this resource.

Member Data Documentation

bool Chunks.Plugins.PluginResource.IsValid => Plugin == null || Plugin.IsLoaded

Property Documentation

ResourceName Chunks.Plugins.PluginResource.Name
get

Name of this resource.

Plugin Chunks.Plugins.PluginResource.Plugin
get

Plugin this resource was loaded from.


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