C# Class UnityRose.ResourceManager

This singleton class loads common resources into memory for quick access. Avoids having to reload certain resources that are almost always needed. For example ZSC files, every time a piece of armor is equipped or appears on another player. TODO: This class should be improved to cache most common equipment.
Mostrar archivo Open project: osROSE/UnityRose Class Usage Examples

Public Properties

Property Type Description
instance ResourceManager
stb_animation_list UnityRose.Formats.STB
stb_animation_type UnityRose.Formats.STB
stb_cap_list UnityRose.Formats.STB
stb_hair_list UnityRose.Formats.STB
stb_weapon_list UnityRose.Formats.STB
weapon_type_lookup WeaponType>.Dictionary
zmd_female UnityRose.Formats.ZMD
zmd_male UnityRose.Formats.ZMD
zsc_arms_female UnityRose.Formats.ZSC
zsc_arms_male UnityRose.Formats.ZSC
zsc_back UnityRose.Formats.ZSC
zsc_body_female UnityRose.Formats.ZSC
zsc_body_male UnityRose.Formats.ZSC
zsc_cap_female UnityRose.Formats.ZSC
zsc_cap_male UnityRose.Formats.ZSC
zsc_faceItem UnityRose.Formats.ZSC
zsc_face_female UnityRose.Formats.ZSC
zsc_face_male UnityRose.Formats.ZSC
zsc_foot_female UnityRose.Formats.ZSC
zsc_foot_male UnityRose.Formats.ZSC
zsc_hair_female UnityRose.Formats.ZSC
zsc_hair_male UnityRose.Formats.ZSC
zsc_subweapon UnityRose.Formats.ZSC
zsc_weapon UnityRose.Formats.ZSC

Public Methods

Method Description
GenerateAnimationAsset ( GenderType gender, RigType rig, String>.Dictionary zmoPaths ) : void
GenerateAnimationAsset ( GenderType gender, WeaponType weapon ) : void

Generate an animation prefab for the given gender and weapon

GenerateAnimationAssets ( ) : void

Loop through all weapon types for each gender and create an animation asset and all associated clips The animations and clips are placed in GameData/Animation

GetZMOPath ( WeaponType WeaponType, ActionType Action, GenderType Gender ) : string

Get Animation ZMO File path

LoadAnimations ( GameObject player, ZMD skeleton, WeaponType weapon, GenderType gender ) : void

Loads all animations for equiped weapon type. Used only in editor to generate prefabs

LoadClips ( GameObject skeleton, ZMD zmd, GenderType gender, RigType rig, String>.Dictionary zmoPaths ) : void
LoadClips ( GameObject skeleton, ZMD zmd, WeaponType weapon, GenderType gender ) : void

Loads all animations for given weapon type and gender. The clips are saved to Animation/{gender}/{weapon}/clips/{action}.anim Used only in editor to generate prefabs

cachedLoad ( string path ) : object

Checks the cache to see if the resource has already been loaded recently If found, returns the cached resource from memory (fast) If not found, loads the resource from file (slow) and caches the resource

getWeaponType ( int weaponID ) : WeaponType
getZSC ( GenderType gender, BodyPartType bodyPart ) : ZSC

Get the ZSC object associated with the given gender and bodyPart

loadBindPoses ( GameObject skeleton, GenderType gender, WeaponType weapon ) : BindPoses

Load bindposes and bones matrices from resources scriptable object

loadResource ( string path ) : object

Load a Rose Asset from text asset resource file to memory. Not cached.

loadSkeleton ( GenderType gender, RigType rig ) : GameObject
loadSkeleton ( GenderType gender, WeaponType weapon ) : GameObject

Load a skeleton game object from resources prefab

unloadResource ( UnityEngine resource ) : void

Private Methods

Method Description
ResourceManager ( ) : UnityEditor
getBoneNames ( Transform transforms ) : string[]

Method Details

GenerateAnimationAsset() public method

public GenerateAnimationAsset ( GenderType gender, RigType rig, String>.Dictionary zmoPaths ) : void
gender GenderType
rig RigType
zmoPaths String>.Dictionary
return void

GenerateAnimationAsset() public method

Generate an animation prefab for the given gender and weapon
public GenerateAnimationAsset ( GenderType gender, WeaponType weapon ) : void
gender GenderType
weapon WeaponType
return void

GenerateAnimationAssets() public method

Loop through all weapon types for each gender and create an animation asset and all associated clips The animations and clips are placed in GameData/Animation
public GenerateAnimationAssets ( ) : void
return void

GetZMOPath() public method

Get Animation ZMO File path
public GetZMOPath ( WeaponType WeaponType, ActionType Action, GenderType Gender ) : string
WeaponType WeaponType Equiped Weapon
Action ActionType
Gender GenderType Player Gender
return string

LoadAnimations() public method

Loads all animations for equiped weapon type. Used only in editor to generate prefabs
public LoadAnimations ( GameObject player, ZMD skeleton, WeaponType weapon, GenderType gender ) : void
player UnityEngine.GameObject
skeleton UnityRose.Formats.ZMD
weapon WeaponType
gender GenderType
return void

LoadClips() public method

public LoadClips ( GameObject skeleton, ZMD zmd, GenderType gender, RigType rig, String>.Dictionary zmoPaths ) : void
skeleton UnityEngine.GameObject
zmd UnityRose.Formats.ZMD
gender GenderType
rig RigType
zmoPaths String>.Dictionary
return void

LoadClips() public method

Loads all animations for given weapon type and gender. The clips are saved to Animation/{gender}/{weapon}/clips/{action}.anim Used only in editor to generate prefabs
public LoadClips ( GameObject skeleton, ZMD zmd, WeaponType weapon, GenderType gender ) : void
skeleton UnityEngine.GameObject
zmd UnityRose.Formats.ZMD
weapon WeaponType
gender GenderType
return void

cachedLoad() public method

Checks the cache to see if the resource has already been loaded recently If found, returns the cached resource from memory (fast) If not found, loads the resource from file (slow) and caches the resource
public cachedLoad ( string path ) : object
path string
return object

getWeaponType() public method

public getWeaponType ( int weaponID ) : WeaponType
weaponID int
return WeaponType

getZSC() public method

Get the ZSC object associated with the given gender and bodyPart
public getZSC ( GenderType gender, BodyPartType bodyPart ) : ZSC
gender GenderType
bodyPart BodyPartType
return UnityRose.Formats.ZSC

loadBindPoses() public method

Load bindposes and bones matrices from resources scriptable object
public loadBindPoses ( GameObject skeleton, GenderType gender, WeaponType weapon ) : BindPoses
skeleton UnityEngine.GameObject
gender GenderType
weapon WeaponType
return BindPoses

loadResource() public method

Load a Rose Asset from text asset resource file to memory. Not cached.
public loadResource ( string path ) : object
path string
return object

loadSkeleton() public method

public loadSkeleton ( GenderType gender, RigType rig ) : GameObject
gender GenderType
rig RigType
return UnityEngine.GameObject

loadSkeleton() public method

Load a skeleton game object from resources prefab
public loadSkeleton ( GenderType gender, WeaponType weapon ) : GameObject
gender GenderType
weapon WeaponType
return UnityEngine.GameObject

unloadResource() public method

public unloadResource ( UnityEngine resource ) : void
resource UnityEngine
return void

Property Details

instance public_oe static_oe property

public static ResourceManager,UnityRose instance
return ResourceManager

stb_animation_list public_oe property

public STB,UnityRose.Formats stb_animation_list
return UnityRose.Formats.STB

stb_animation_type public_oe property

public STB,UnityRose.Formats stb_animation_type
return UnityRose.Formats.STB

stb_cap_list public_oe property

public STB,UnityRose.Formats stb_cap_list
return UnityRose.Formats.STB

stb_hair_list public_oe property

public STB,UnityRose.Formats stb_hair_list
return UnityRose.Formats.STB

stb_weapon_list public_oe property

public STB,UnityRose.Formats stb_weapon_list
return UnityRose.Formats.STB

weapon_type_lookup public_oe static_oe property

public static Dictionary weapon_type_lookup
return WeaponType>.Dictionary

zmd_female public_oe property

public ZMD,UnityRose.Formats zmd_female
return UnityRose.Formats.ZMD

zmd_male public_oe property

public ZMD,UnityRose.Formats zmd_male
return UnityRose.Formats.ZMD

zsc_arms_female public_oe property

public ZSC,UnityRose.Formats zsc_arms_female
return UnityRose.Formats.ZSC

zsc_arms_male public_oe property

public ZSC,UnityRose.Formats zsc_arms_male
return UnityRose.Formats.ZSC

zsc_back public_oe property

public ZSC,UnityRose.Formats zsc_back
return UnityRose.Formats.ZSC

zsc_body_female public_oe property

public ZSC,UnityRose.Formats zsc_body_female
return UnityRose.Formats.ZSC

zsc_body_male public_oe property

public ZSC,UnityRose.Formats zsc_body_male
return UnityRose.Formats.ZSC

zsc_cap_female public_oe property

public ZSC,UnityRose.Formats zsc_cap_female
return UnityRose.Formats.ZSC

zsc_cap_male public_oe property

public ZSC,UnityRose.Formats zsc_cap_male
return UnityRose.Formats.ZSC

zsc_faceItem public_oe property

public ZSC,UnityRose.Formats zsc_faceItem
return UnityRose.Formats.ZSC

zsc_face_female public_oe property

public ZSC,UnityRose.Formats zsc_face_female
return UnityRose.Formats.ZSC

zsc_face_male public_oe property

public ZSC,UnityRose.Formats zsc_face_male
return UnityRose.Formats.ZSC

zsc_foot_female public_oe property

public ZSC,UnityRose.Formats zsc_foot_female
return UnityRose.Formats.ZSC

zsc_foot_male public_oe property

public ZSC,UnityRose.Formats zsc_foot_male
return UnityRose.Formats.ZSC

zsc_hair_female public_oe property

public ZSC,UnityRose.Formats zsc_hair_female
return UnityRose.Formats.ZSC

zsc_hair_male public_oe property

public ZSC,UnityRose.Formats zsc_hair_male
return UnityRose.Formats.ZSC

zsc_subweapon public_oe property

public ZSC,UnityRose.Formats zsc_subweapon
return UnityRose.Formats.ZSC

zsc_weapon public_oe property

public ZSC,UnityRose.Formats zsc_weapon
return UnityRose.Formats.ZSC