LuaSTG-x Core API
lstg::ResourceMgr Class Reference

Public Member Functions

function addResourcePack (local pack, local override)
 
function cacheLocalFile (local fpath)
 
function cacheLocalFileAsync (local fpath, local callback)
 
function clear ()
 
function clearLocalFileCache ()
 
function extractFile (local filePath, local targetPath)
 
function getBufferFromFile (local filePath)
 
function getGlobalImageScaleFactor ()
 
function getInstance ()
 
function getResourcePack (local packPath)
 
function getResourcePacks ()
 
function getStringFromFile (local filePath)
 
function getStringFromLocalFile (local fpath)
 
function isFileOrDirectoryExist (local fpath)
 
function isLocalFileCached (local fpath)
 
function isResourcePackLoaded (local packPath)
 
function listCachedLocalFiles ()
 
function loadLocalFileAndCache (local fpath)
 
function loadResourcePack (local fullPath, local password)
 
function removeLocalFileCache (local fpath)
 
function setGlobalImageScaleFactor (local v)
 
function unloadAllResourcePacks ()
 
function unloadResourcePack (local path)
 

Member Function Documentation

◆ addResourcePack()

function addResourcePack ( local  pack,
local  override 
)
Parameters
packlstg.ResourcePack
overrideboolean
Returns
lstg.ResourceMgr

◆ cacheLocalFile()

function cacheLocalFile ( local  fpath)
Parameters
fpathstring
Returns
boolean

◆ cacheLocalFileAsync()

function cacheLocalFileAsync ( local  fpath,
local  callback 
)
Parameters
fpathstring
callbackfun()
Returns
lstg.ResourceMgr

◆ clear()

function clear ( )

Unload all ResourcePacks, clear local file caches, reset globalImageScaleFactor.

Returns
lstg.ResourceMgr

◆ clearLocalFileCache()

function clearLocalFileCache ( )

◆ extractFile()

function extractFile ( local  filePath,
local  targetPath 
)

Extract data in pack into a file

param filePath The file path

param targetPath The full path to the file you want to save data

return If it's successed

Parameters
filePathstring
targetPathstring
Returns
boolean

◆ getBufferFromFile()

function getBufferFromFile ( local  filePath)
Parameters
filePathstring
Returns
lstg.Buffer

◆ getGlobalImageScaleFactor()

function getGlobalImageScaleFactor ( )
Returns
number

◆ getInstance()

function getInstance ( )

◆ getResourcePack()

function getResourcePack ( local  packPath)
Parameters
packPathstring
Returns
lstg.ResourcePack

◆ getResourcePacks()

function getResourcePacks ( )

Gives a vector of all ResourcePacks in priority order (higher in front).

Returns
lstg.ResourcePack[]

◆ getStringFromFile()

function getStringFromFile ( local  filePath)
Parameters
filePathstring
Returns
string

◆ getStringFromLocalFile()

function getStringFromLocalFile ( local  fpath)
Parameters
fpathstring
Returns
string

◆ isFileOrDirectoryExist()

function isFileOrDirectoryExist ( local  fpath)

Returns if the file path exists in any ResourcePack.

Parameters
fpathstring
Returns
boolean

◆ isLocalFileCached()

function isLocalFileCached ( local  fpath)
Parameters
fpathstring
Returns
boolean

◆ isResourcePackLoaded()

function isResourcePackLoaded ( local  packPath)
Parameters
packPathstring
Returns
boolean

◆ listCachedLocalFiles()

function listCachedLocalFiles ( )
Returns
string[]

◆ loadLocalFileAndCache()

function loadLocalFileAndCache ( local  fpath)
Parameters
fpathstring
Returns
lstg.Buffer

◆ loadResourcePack()

function loadResourcePack ( local  fullPath,
local  password 
)
Parameters
fullPathstring
passwordstring
Returns
lstg.ResourcePack

◆ removeLocalFileCache()

function removeLocalFileCache ( local  fpath)
Parameters
fpathstring
Returns
boolean

◆ setGlobalImageScaleFactor()

function setGlobalImageScaleFactor ( local  v)
Parameters
vnumber
Returns
lstg.ResourceMgr

◆ unloadAllResourcePacks()

function unloadAllResourcePacks ( )

◆ unloadResourcePack()

function unloadResourcePack ( local  path)
Parameters
pathstring
Returns
boolean

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