public static void ReadPersistentData(string _file , OnReadDataSuccessDelegate _onSuccess , OnErrorDelegate _onError) { if (string.IsNullOrEmpty(_file)) { _onError("file is null"); return; } CoroutineMgr.Start(readPersistentData(_file, _onSuccess, _onError)); }
private static IEnumerator readPersistentData(string _file, OnReadDataSuccessDelegate _onSuccess, OnErrorDelegate _onError) { string path = Path.Combine(VRXX.Platform.GetPersistentDataPath(), _file); Log.Debug("ResourceMgr", "read data [{0}] from [{1}]", _file, path); WWW www = new WWW(path); yield return(www); if (www.error != null) { _onError(www.error); yield break; } _onSuccess(www.bytes); }