public static bool GetFile(string file, out string dstfile, out int offset) { #if UNITY_EDITOR || UNITY_IPHONE || UNITY_STANDALONE dstfile = ResourcesPath.streamingAssetsPath + file; if (!File.Exists(dstfile)) { dstfile = string.Empty; offset = 0; Debug.LogError(string.Format("StreamingAssetLoad.GetFile({0}) not exist!", dstfile)); return(false); } offset = 0; return(true); #elif UNITY_ANDROID // 安卓平台的,数据存储在apk包当中 Init(); ZipFile.PartialInputStream stream = ApkFile.FindFileStream("assets/" + file) as ZipFile.PartialInputStream; if (stream == null) { dstfile = string.Empty; offset = 0; return(false); } else { dstfile = ResourcesPath.dataPath; offset = (int)stream.StartPos; return(true); } #endif }
public static bool GetFile(string file, out string dstfile, out int offset) { #if UNITY_EDITOR || UNITY_IPHONE || UNITY_STANDALONE_WIN dstfile = file; offset = 0; return(false); #elif UNITY_ANDROID // 安卓平台的,数据存储在obb包当中 Init(); ZipFile.PartialInputStream stream = ApkFile.FindFileStream(file) as ZipFile.PartialInputStream; if (stream == null) { dstfile = string.Empty; offset = 0; return(false); } else { dstfile = Application.dataPath; offset = (int)stream.Position; return(true); } #endif }