【资源加载】IOS资源加载增加前缀:file://
parent
808efb6764
commit
8f272916c5
|
@ -131,8 +131,13 @@ namespace ResMgr {
|
|||
}
|
||||
public IEnumerator LoadTextureFromStream(string name, LuaFunction luaFunction)
|
||||
{
|
||||
XDebug.Log.l(Application.streamingAssetsPath + "/Res/" + name + ".png");
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/"+ name + ".png");
|
||||
|
||||
string filePath = Application.streamingAssetsPath + "/Res/" + name + ".png";
|
||||
#if UNITY_IOS
|
||||
filePath = "file://" + filePath;
|
||||
#endif
|
||||
XDebug.Log.l(filePath);
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(filePath);
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
|
@ -158,8 +163,12 @@ namespace ResMgr {
|
|||
}
|
||||
public IEnumerator LoadTextFromStream(string name, LuaFunction luaFunction)
|
||||
{
|
||||
XDebug.Log.l(Application.streamingAssetsPath + "/Res/" + name + ".txt");
|
||||
UnityWebRequest www = UnityWebRequest.Get(Application.streamingAssetsPath + "/Res/" + name + ".txt");
|
||||
string filePath = Application.streamingAssetsPath + "/Res/" + name + ".txt";
|
||||
#if UNITY_IOS
|
||||
filePath = "file://" + filePath;
|
||||
#endif
|
||||
XDebug.Log.l(filePath);
|
||||
UnityWebRequest www = UnityWebRequest.Get(filePath);
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
|
|
|
@ -39,8 +39,13 @@ namespace GameLogic
|
|||
|
||||
public IEnumerator LoadFromStream(Action<Sprite> act)
|
||||
{
|
||||
XDebug.Log.l(Application.streamingAssetsPath + "/Res/PackConfig.txt");
|
||||
UnityWebRequest uwr = UnityWebRequest.Get(Application.streamingAssetsPath + "/Res/PackConfig.txt");
|
||||
|
||||
string filePath = Application.streamingAssetsPath + "/Res/PackConfig.txt";
|
||||
#if UNITY_IOS
|
||||
filePath = "file://" + filePath;
|
||||
#endif
|
||||
XDebug.Log.l(filePath);
|
||||
UnityWebRequest uwr = UnityWebRequest.Get(filePath);
|
||||
yield return uwr.SendWebRequest();
|
||||
if (uwr.isNetworkError || uwr.isHttpError)
|
||||
{
|
||||
|
@ -54,8 +59,11 @@ namespace GameLogic
|
|||
{
|
||||
Hashtable table = MiniJSON.jsonDecode(uwr.downloadHandler.text) as Hashtable;
|
||||
string bgName = table["UpdatePanelBG"] as string;
|
||||
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(Application.streamingAssetsPath + "/Res/" + bgName + ".png");
|
||||
string texPath = Application.streamingAssetsPath + "/Res/" + bgName + ".png";
|
||||
#if UNITY_IOS
|
||||
texPath = "file://" + texPath;
|
||||
#endif
|
||||
UnityWebRequest www = UnityWebRequestTexture.GetTexture(texPath);
|
||||
yield return www.SendWebRequest();
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue