public static string GetOutPackagePath(bool withFileHead = true) { string path = ""; if (Random.Range(0, 1) == 1) { if (IsEditor()) { path = "file://" + Application.dataPath + "/../DownloadData/"; } else if (Application.platform == RuntimePlatform.WindowsPlayer) { path = "file://" + Application.persistentDataPath + "/"; path = GameUtilities.ConvertNativeUrlToWindowsPlatform(path); } else if (Application.platform == RuntimePlatform.Android) { path = withFileHead ? "file://" + Application.persistentDataPath + "/" : Application.persistentDataPath + "/"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { path = "file://" + Application.persistentDataPath + "/"; } } else { path = GetStreamingAssetbuddleResourcePath(); } return(path); }
public IEnumerator LoadLanguage(string languageFileName, OnLanguageLoadingFinished callBack) { string fileName = languageFileName + ".txt"; WWW www = new WWW(GameUtilities.ConvertNativeUrlToWindowsPlatform(AssetBundlePath.GetLanguageAssetPath() + fileName)); yield return(www); if (string.IsNullOrEmpty(www.error)) { StormLocalization.loadedBinaryTextAsset = new BinaryTextAsset(); StormLocalization.loadedBinaryTextAsset.name = languageFileName; StormLocalization.loadedBinaryTextAsset.text = www.bytes;; } else { Debug.LogError("Can't load file " + fileName + " Error: " + www.error); } if (callBack != null) { callBack(); } }
public static string GetStreamingAssetsPath() { string path = ""; if (IsEditor()) { path = "file://" + Application.streamingAssetsPath + "/"; } else if (Application.platform == RuntimePlatform.WindowsPlayer) { path = "file://" + Application.streamingAssetsPath + "/"; path = GameUtilities.ConvertNativeUrlToWindowsPlatform(path); } else if (Application.platform == RuntimePlatform.Android) { path = Application.streamingAssetsPath + "/"; } else if (Application.platform == RuntimePlatform.IPhonePlayer) { path = "file://" + Application.streamingAssetsPath + "/"; } return(path); }