Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
GameDatabase Class Reference

A singleton class which parses the game directory for config files and files of various types. It creates a simple url access for these files and configs so they can be used in the game scripts. Contains the main instance of GameSettings. More...

Inheritance diagram for GameDatabase:
LoadingSystem

Classes

class  TextureInfo
 

Public Member Functions

List< AudioClip > AudioClipNameContains (string nameContains)
 Returns a list of the elements which name contains the parameter More...
 
bool ExistsAudioClip (string url)
 Tests for existance AudioClip of given url More...
 
bool ExistsConfigNode (string url)
 Tests existance of ConfigNode of given url More...
 
bool ExistsModel (string url)
 Tests existance of model (GameObject) of given url More...
 
bool ExistsShader (string url)
 Tests for existance Shader of given url More...
 
bool ExistsTexture (string url)
 Tests for existance of Texture2D of given url More...
 
List< TextureInfoGetAllTexturesInFolder (string folderURL)
 Retrieves a list of TextureInfo that are contained within this folder (with trailing /) More...
 
List< TextureInfoGetAllTexturesInFolderType (string folderName, bool caseInsensitive=false)
 Retrieves a list of TextureInfo that are contained within folders of given name More...
 
AudioClip GetAudioClip (string url)
 Retrieves AudioClip of given url. Returns null if not found. More...
 
UrlDir.UrlFile GetAudioFile (string url)
 Retrieves AudioClip of given url. Returns null if not found. More...
 
ConfigNode GetConfigNode (string url)
 Retrieves ConfigNode of given url. Returns null if not found. More...
 
ConfigNode[] GetConfigNodes (string typeName)
 Retrieves all ConfigNodes of the given type name. Returns empty array if none found. More...
 
ConfigNode[] GetConfigNodes (string baseUrl, string typeName)
 Returns all ConfigNodes in a given url heirarchy of given type name. Returns empty array if none found. More...
 
UrlDir.UrlConfig[] GetConfigs (string typeName)
 Returns all UrlConfig objects of given type name. Returns empty array if none found. More...
 
ConfigNode GetMergedConfigNodes (string nodeName, bool mergeChildren=false)
 Merge all the root config nodes with the given name into a single one. More...
 
GameObject GetModel (string url)
 Retrieves model (GameObject) of given url. Returns null if not found. More...
 
UrlDir.UrlFile GetModelFile (string url)
 Retrieves model (GameObject) of given url. Returns null if not found. More...
 
UrlDir.UrlFile GetModelFile (GameObject modelPrefab)
 Retrieves model (GameObject) of given url. Returns null if not found. More...
 
GameObject GetModelIn (string url)
 Retrieves first model (GameObject) in a given url directory. Returns null if not found. More...
 
GameObject GetModelPrefab (string url)
 Retrieves model (GameObject) of given url. Returns null if not found. More...
 
GameObject GetModelPrefabIn (string url)
 Retrieves first model (GameObject) in a given url directory. Returns null if not found. More...
 
Shader GetShader (string url)
 Retrieves Shader of given url. Returns null if not found. More...
 
Texture2D GetTexture (string url, bool asNormalMap)
 Retrieves Texture2D of given url. Returns null if not found. More...
 
UrlDir.UrlFile GetTextureFile (string url)
 Retrieves file of given url. Returns null if not found. More...
 
Texture2D GetTextureIn (string url, string textureName, bool asNormalMap)
 Retrieves Texture in a given url directory with given name. Returns null if not found. More...
 
TextureInfo GetTextureInfo (string url)
 Retrieves Texture2D of given url. Returns null if not found. More...
 
TextureInfo GetTextureInfoIn (string url, string textureName)
 Retrieves Texture in a given url directory with given name. Returns null if not found. More...
 
override bool IsReady ()
 
void LoadEmpty ()
 Initialized the Database in an empty state, so it is active but doesn't start off the loading process. More...
 
override float ProgressFraction ()
 
override string ProgressTitle ()
 
bool RemoveAudioClip (string url)
 Removes audio of given url. returns true if successful, false if not found More...
 
bool RemoveModel (string url)
 Removes Model of given url. returns true if successful, false if not found More...
 
bool RemoveShader (string url)
 Removes audio of given url. returns true if successful, false if not found More...
 
bool RemoveTexture (string url)
 Removes Texture of given url. returns true if successful, false if not found More...
 
bool ReplaceTexture (string url, TextureInfo newTex)
 Removes Texture of given url. returns true if successful, false if not found More...
 
override void StartLoad ()
 
override string ToString ()
 
- Public Member Functions inherited from LoadingSystem
virtual float LoadWeight ()
 

Static Public Member Functions

static Texture2D BitmapToUnityNormalMap (Texture2D tex)
 
static void CompileConfig (ConfigNode node)
 
static void LoadLoaderInfo (ConfigNode node, Dictionary< string, bool > dest)
 
static void SaveLoaderInfo (ConfigNode node, Dictionary< string, bool > dest)
 
static void UpdateLoaderInfo (Dictionary< string, bool > dest)
 

Public Attributes

List< AudioClip > databaseAudio = new List<AudioClip>()
 
List< UrlDir.UrlFiledatabaseAudioFiles = new List<UrlDir.UrlFile>()
 
List< GameObject > databaseModel = new List<GameObject>()
 
List< UrlDir.UrlFiledatabaseModelFiles = new List<UrlDir.UrlFile>()
 
List< Shader > databaseShaders = new List<Shader>()
 the url root node More...
 
List< TextureInfodatabaseTexture = new List<TextureInfo>()
 

Properties

static string EnvironmentInfo [get]
 
Experience.ExperienceSystemConfig ExperienceConfigs [get]
 
static GameDatabase Instance [get]
 GameDatabase singleton instance More...
 
static bool Modded [get]
 
string PluginDataFolder [get]
 
bool Recompile [get, set]
 
bool RecompileModels [get, set]
 
UrlDir root [get]
 
string settingsFileName [get]
 The filename for the settings file More...
 

Detailed Description

A singleton class which parses the game directory for config files and files of various types. It creates a simple url access for these files and configs so they can be used in the game scripts. Contains the main instance of GameSettings.

Member Function Documentation

List<AudioClip> GameDatabase.AudioClipNameContains ( string  nameContains)
inline

Returns a list of the elements which name contains the parameter

Parameters
nameContains
Returns
static Texture2D GameDatabase.BitmapToUnityNormalMap ( Texture2D  tex)
inlinestatic
static void GameDatabase.CompileConfig ( ConfigNode  node)
inlinestatic
bool GameDatabase.ExistsAudioClip ( string  url)
inline

Tests for existance AudioClip of given url

bool GameDatabase.ExistsConfigNode ( string  url)
inline

Tests existance of ConfigNode of given url

bool GameDatabase.ExistsModel ( string  url)
inline

Tests existance of model (GameObject) of given url

bool GameDatabase.ExistsShader ( string  url)
inline

Tests for existance Shader of given url

bool GameDatabase.ExistsTexture ( string  url)
inline

Tests for existance of Texture2D of given url

List<TextureInfo> GameDatabase.GetAllTexturesInFolder ( string  folderURL)
inline

Retrieves a list of TextureInfo that are contained within this folder (with trailing /)

List<TextureInfo> GameDatabase.GetAllTexturesInFolderType ( string  folderName,
bool  caseInsensitive = false 
)
inline

Retrieves a list of TextureInfo that are contained within folders of given name

AudioClip GameDatabase.GetAudioClip ( string  url)
inline

Retrieves AudioClip of given url. Returns null if not found.

UrlDir.UrlFile GameDatabase.GetAudioFile ( string  url)
inline

Retrieves AudioClip of given url. Returns null if not found.

ConfigNode GameDatabase.GetConfigNode ( string  url)
inline

Retrieves ConfigNode of given url. Returns null if not found.

ConfigNode [] GameDatabase.GetConfigNodes ( string  typeName)
inline

Retrieves all ConfigNodes of the given type name. Returns empty array if none found.

ConfigNode [] GameDatabase.GetConfigNodes ( string  baseUrl,
string  typeName 
)
inline

Returns all ConfigNodes in a given url heirarchy of given type name. Returns empty array if none found.

UrlDir.UrlConfig [] GameDatabase.GetConfigs ( string  typeName)
inline

Returns all UrlConfig objects of given type name. Returns empty array if none found.

ConfigNode GameDatabase.GetMergedConfigNodes ( string  nodeName,
bool  mergeChildren = false 
)
inline

Merge all the root config nodes with the given name into a single one.

Parameters
nodeNameName of the config node(s) to merge.
mergeChildrenWhether child nodes should also be merged.
Returns
GameObject GameDatabase.GetModel ( string  url)
inline

Retrieves model (GameObject) of given url. Returns null if not found.

UrlDir.UrlFile GameDatabase.GetModelFile ( string  url)
inline

Retrieves model (GameObject) of given url. Returns null if not found.

UrlDir.UrlFile GameDatabase.GetModelFile ( GameObject  modelPrefab)
inline

Retrieves model (GameObject) of given url. Returns null if not found.

GameObject GameDatabase.GetModelIn ( string  url)
inline

Retrieves first model (GameObject) in a given url directory. Returns null if not found.

GameObject GameDatabase.GetModelPrefab ( string  url)
inline

Retrieves model (GameObject) of given url. Returns null if not found.

GameObject GameDatabase.GetModelPrefabIn ( string  url)
inline

Retrieves first model (GameObject) in a given url directory. Returns null if not found.

Shader GameDatabase.GetShader ( string  url)
inline

Retrieves Shader of given url. Returns null if not found.

Texture2D GameDatabase.GetTexture ( string  url,
bool  asNormalMap 
)
inline

Retrieves Texture2D of given url. Returns null if not found.

UrlDir.UrlFile GameDatabase.GetTextureFile ( string  url)
inline

Retrieves file of given url. Returns null if not found.

Texture2D GameDatabase.GetTextureIn ( string  url,
string  textureName,
bool  asNormalMap 
)
inline

Retrieves Texture in a given url directory with given name. Returns null if not found.

TextureInfo GameDatabase.GetTextureInfo ( string  url)
inline

Retrieves Texture2D of given url. Returns null if not found.

TextureInfo GameDatabase.GetTextureInfoIn ( string  url,
string  textureName 
)
inline

Retrieves Texture in a given url directory with given name. Returns null if not found.

override bool GameDatabase.IsReady ( )
inlinevirtual

Reimplemented from LoadingSystem.

void GameDatabase.LoadEmpty ( )
inline

Initialized the Database in an empty state, so it is active but doesn't start off the loading process.

< create the directory structure

static void GameDatabase.LoadLoaderInfo ( ConfigNode  node,
Dictionary< string, bool >  dest 
)
inlinestatic
override float GameDatabase.ProgressFraction ( )
inlinevirtual

Reimplemented from LoadingSystem.

override string GameDatabase.ProgressTitle ( )
inlinevirtual

Reimplemented from LoadingSystem.

bool GameDatabase.RemoveAudioClip ( string  url)
inline

Removes audio of given url. returns true if successful, false if not found

bool GameDatabase.RemoveModel ( string  url)
inline

Removes Model of given url. returns true if successful, false if not found

bool GameDatabase.RemoveShader ( string  url)
inline

Removes audio of given url. returns true if successful, false if not found

bool GameDatabase.RemoveTexture ( string  url)
inline

Removes Texture of given url. returns true if successful, false if not found

bool GameDatabase.ReplaceTexture ( string  url,
TextureInfo  newTex 
)
inline

Removes Texture of given url. returns true if successful, false if not found

static void GameDatabase.SaveLoaderInfo ( ConfigNode  node,
Dictionary< string, bool >  dest 
)
inlinestatic
override void GameDatabase.StartLoad ( )
inlinevirtual

Reimplemented from LoadingSystem.

override string GameDatabase.ToString ( )
inline
static void GameDatabase.UpdateLoaderInfo ( Dictionary< string, bool >  dest)
inlinestatic

Member Data Documentation

List<AudioClip> GameDatabase.databaseAudio = new List<AudioClip>()
List<UrlDir.UrlFile> GameDatabase.databaseAudioFiles = new List<UrlDir.UrlFile>()
List<GameObject> GameDatabase.databaseModel = new List<GameObject>()
List<UrlDir.UrlFile> GameDatabase.databaseModelFiles = new List<UrlDir.UrlFile>()
List<Shader> GameDatabase.databaseShaders = new List<Shader>()

the url root node

List<TextureInfo> GameDatabase.databaseTexture = new List<TextureInfo>()

Property Documentation

string GameDatabase.EnvironmentInfo
staticget
Experience.ExperienceSystemConfig GameDatabase.ExperienceConfigs
get
GameDatabase GameDatabase.Instance
staticget

GameDatabase singleton instance

bool GameDatabase.Modded
staticget
string GameDatabase.PluginDataFolder
get
bool GameDatabase.Recompile
getset
bool GameDatabase.RecompileModels
getset
UrlDir GameDatabase.root
get
string GameDatabase.settingsFileName
get

The filename for the settings file


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