C# Class KEngine.KResourceModule

Inheritance: UnityEngine.MonoBehaviour
Datei anzeigen Open project: mr-kelly/KEngine Class Usage Examples

Public Properties

Property Type Description
CustomGetResourcesPath Func,System
DocumentResourcesPath string
LoadByQueue bool
LogLevel int
Quality KResourceQuality
ResourcePathPriorityType KResourcePathPriorityType

Public Methods

Method Description
Collect ( ) : void
ContainsResourceUrl ( string resourceUrl ) : bool
GetAppDataPath ( ) : string

獲取app數據目錄,可寫,同Application.PersitentDataPath,但在windows平台時為了避免www類中文目錄無法讀取問題,單獨實現

GetAssetBundlePath ( string path ) : string

统一在字符串后加上.box, 取决于配置的AssetBundle后缀

GetBuildPlatformName ( ) : string

Different platform's assetBundles is incompatible. CosmosEngine put different platform's assetBundles in different folder. Here, get Platform name that represent the AssetBundles Folder.

GetFileProtocol ( ) : string

On Windows, file protocol has a strange rule that has one more slash

GetResourceFullPath ( string url, bool withFileProtocol, string &fullPath, bool isLog = true ) : GetResourceFullPathType

根据相对路径,获取到StreamingAssets完整路径,或Resources中的路径

GetResourceFullPath ( string url, bool withFileProtocol = true, bool isLog = true ) : string

完整路径,www加载

IsStreamingAssetsExists ( string path ) : bool

check file exists of streamingAssets. On Android will use plugin to do that.

LoadBundle ( string path, AssetFileLoader callback = null ) : AbstractResourceLoader

load asset bundle immediatly

LoadBundleAsync ( string path, AssetFileLoader callback = null ) : AbstractResourceLoader

Load Async Asset Bundle

LoadSyncFromStreamingAssets ( string path ) : byte[]

Load file from streamingAssets. On Android will use plugin to do that.

LogLoadTime ( string resType, string resPath, System begin ) : void
LogRequest ( string resType, string resPath ) : void
TryGetDocumentResourceUrl ( string url, bool withFileProtocol, string &newUrl ) : bool

可被WWW读取的Resource路径

TryGetInAppStreamingUrl ( string url, bool withFileProtocol, string &newUrl ) : bool

(not android ) only! Android资源不在目录! Editor返回文件系统目录,运行时返回StreamingAssets目录

Private Methods

Method Description
Awake ( ) : void
FileExistsWithDifferentCase ( string filePath ) : bool

大小写敏感地进行文件判断, Windows Only

InitResourcePath ( ) : void

Initialize the path of AssetBundles store place ( Maybe in PersitentDataPath or StreamingAssetsPath )

KResourceModule ( ) : System
Update ( ) : void

Method Details

Collect() public static method

public static Collect ( ) : void
return void

ContainsResourceUrl() public static method

public static ContainsResourceUrl ( string resourceUrl ) : bool
resourceUrl string
return bool

GetAppDataPath() public static method

獲取app數據目錄,可寫,同Application.PersitentDataPath,但在windows平台時為了避免www類中文目錄無法讀取問題,單獨實現
public static GetAppDataPath ( ) : string
return string

GetAssetBundlePath() public static method

统一在字符串后加上.box, 取决于配置的AssetBundle后缀
public static GetAssetBundlePath ( string path ) : string
path string
return string

GetBuildPlatformName() public static method

Different platform's assetBundles is incompatible. CosmosEngine put different platform's assetBundles in different folder. Here, get Platform name that represent the AssetBundles Folder.
public static GetBuildPlatformName ( ) : string
return string

GetFileProtocol() public static method

On Windows, file protocol has a strange rule that has one more slash
public static GetFileProtocol ( ) : string
return string

GetResourceFullPath() public static method

根据相对路径,获取到StreamingAssets完整路径,或Resources中的路径
public static GetResourceFullPath ( string url, bool withFileProtocol, string &fullPath, bool isLog = true ) : GetResourceFullPathType
url string
withFileProtocol bool
fullPath string
isLog bool
return GetResourceFullPathType

GetResourceFullPath() public static method

完整路径,www加载
public static GetResourceFullPath ( string url, bool withFileProtocol = true, bool isLog = true ) : string
url string
withFileProtocol bool 是否带有file://前缀
isLog bool
return string

IsStreamingAssetsExists() public static method

check file exists of streamingAssets. On Android will use plugin to do that.
public static IsStreamingAssetsExists ( string path ) : bool
path string relative path, when file is "file:///android_asset/test.txt", the pat is "test.txt"
return bool

LoadBundle() public static method

load asset bundle immediatly
public static LoadBundle ( string path, AssetFileLoader callback = null ) : AbstractResourceLoader
path string
callback AssetFileLoader
return AbstractResourceLoader

LoadBundleAsync() public static method

Load Async Asset Bundle
public static LoadBundleAsync ( string path, AssetFileLoader callback = null ) : AbstractResourceLoader
path string
callback AssetFileLoader cps style async
return AbstractResourceLoader

LoadSyncFromStreamingAssets() public static method

Load file from streamingAssets. On Android will use plugin to do that.
public static LoadSyncFromStreamingAssets ( string path ) : byte[]
path string relative path, when file is "file:///android_asset/test.txt", the pat is "test.txt"
return byte[]

LogLoadTime() public static method

public static LogLoadTime ( string resType, string resPath, System begin ) : void
resType string
resPath string
begin System
return void

LogRequest() public static method

public static LogRequest ( string resType, string resPath ) : void
resType string
resPath string
return void

TryGetDocumentResourceUrl() public static method

可被WWW读取的Resource路径
public static TryGetDocumentResourceUrl ( string url, bool withFileProtocol, string &newUrl ) : bool
url string
withFileProtocol bool 是否带有file://前缀
newUrl string
return bool

TryGetInAppStreamingUrl() public static method

(not android ) only! Android资源不在目录! Editor返回文件系统目录,运行时返回StreamingAssets目录
public static TryGetInAppStreamingUrl ( string url, bool withFileProtocol, string &newUrl ) : bool
url string
withFileProtocol bool 是否带有file://前缀
newUrl string
return bool

Property Details

CustomGetResourcesPath public_oe static_oe property

public static Func,System CustomGetResourcesPath
return Func,System

DocumentResourcesPath public_oe static_oe property

public static string DocumentResourcesPath
return string

LoadByQueue public_oe static_oe property

public static bool LoadByQueue
return bool

LogLevel public_oe static_oe property

public static int LogLevel
return int

Quality public_oe static_oe property

public static KResourceQuality Quality
return KResourceQuality

ResourcePathPriorityType public_oe static_oe property

是否優先找下載的資源?還是app本身資源優先. 优先下载的资源,即采用热更新的资源
public static KResourcePathPriorityType ResourcePathPriorityType
return KResourcePathPriorityType