iso读取本地文件

master
罗家炜 2025-09-12 02:47:38 +08:00
parent 3e2c1b7588
commit 6784ab2f03
1 changed files with 17 additions and 0 deletions

View File

@ -337,6 +337,13 @@ public class VerCheck : MonoBehaviour
}
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);
yield return copyRequest.SendWebRequest();
@ -349,13 +356,22 @@ public class VerCheck : MonoBehaviour
});
yield break;
}
string copyVersionString = copyRequest.downloadHandler.text.Trim();
#endif
bool isSame = copyVersionString.Equals(server_version.ToString());
if (isSame)
{
viewBtn_showWait.title = "正在解压资源...";
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);
yield return copyZipRequest.SendWebRequest();
@ -369,6 +385,7 @@ public class VerCheck : MonoBehaviour
}
byte[] zipData = copyZipRequest.downloadHandler.data;
#endif
string zipString = Path.Combine(Application.persistentDataPath, "Pack.byte");
File.WriteAllBytes(zipString, zipData);