iso读取本地文件
parent
3e2c1b7588
commit
6784ab2f03
|
|
@ -337,6 +337,13 @@ public class VerCheck : MonoBehaviour
|
||||||
}
|
}
|
||||||
string copyVersionPath = Path.Combine(Application.streamingAssetsPath, "version.txt");
|
string copyVersionPath = Path.Combine(Application.streamingAssetsPath, "version.txt");
|
||||||
|
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
if (File.Exists(copyVersionPath))
|
||||||
|
{
|
||||||
|
string copyVersionString = File.ReadAllText(copyVersionPath).Trim();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if UNITY_ANDROID
|
||||||
UnityWebRequest copyRequest = UnityWebRequest.Get(copyVersionPath);
|
UnityWebRequest copyRequest = UnityWebRequest.Get(copyVersionPath);
|
||||||
yield return copyRequest.SendWebRequest();
|
yield return copyRequest.SendWebRequest();
|
||||||
|
|
||||||
|
|
@ -349,13 +356,22 @@ public class VerCheck : MonoBehaviour
|
||||||
});
|
});
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string copyVersionString = copyRequest.downloadHandler.text.Trim();
|
string copyVersionString = copyRequest.downloadHandler.text.Trim();
|
||||||
|
#endif
|
||||||
bool isSame = copyVersionString.Equals(server_version.ToString());
|
bool isSame = copyVersionString.Equals(server_version.ToString());
|
||||||
if (isSame)
|
if (isSame)
|
||||||
{
|
{
|
||||||
viewBtn_showWait.title = "正在解压资源...";
|
viewBtn_showWait.title = "正在解压资源...";
|
||||||
string copyZipPath = Path.Combine(Application.streamingAssetsPath, "Pack.byte");
|
string copyZipPath = Path.Combine(Application.streamingAssetsPath, "Pack.byte");
|
||||||
|
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
if (File.Exists(copyZipPath))
|
||||||
|
{
|
||||||
|
byte[] zipData = File.ReadAllBytes(copyZipPath);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if UNITY_ANDROID
|
||||||
UnityWebRequest copyZipRequest = UnityWebRequest.Get(copyZipPath);
|
UnityWebRequest copyZipRequest = UnityWebRequest.Get(copyZipPath);
|
||||||
yield return copyZipRequest.SendWebRequest();
|
yield return copyZipRequest.SendWebRequest();
|
||||||
|
|
||||||
|
|
@ -369,6 +385,7 @@ public class VerCheck : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] zipData = copyZipRequest.downloadHandler.data;
|
byte[] zipData = copyZipRequest.downloadHandler.data;
|
||||||
|
#endif
|
||||||
string zipString = Path.Combine(Application.persistentDataPath, "Pack.byte");
|
string zipString = Path.Combine(Application.persistentDataPath, "Pack.byte");
|
||||||
File.WriteAllBytes(zipString, zipData);
|
File.WriteAllBytes(zipString, zipData);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue