修复web平台txt类型的文件加载bug

This commit is contained in:
shenjianxing 2024-12-23 12:02:28 +08:00
parent f070adfade
commit 89231a48d8
3 changed files with 4 additions and 13 deletions

View File

@ -22,7 +22,7 @@ namespace QFramework
private string mFullPath; private string mFullPath;
private string mHashCode; private string mHashCode;
private object mRawAsset; private object mRawAsset;
public string text;
UnityWebRequest request; UnityWebRequest request;
public static LocalTextRes Allocate(string name) public static LocalTextRes Allocate(string name)
{ {
@ -181,7 +181,7 @@ namespace QFramework
else else
{ {
// Convert the downloaded data to an AudioClip // Convert the downloaded data to an AudioClip
mAsset = new StringAsset(request.downloadHandler.text); text = request.downloadHandler.text;
} }
if (RefCount <= 0) if (RefCount <= 0)
@ -267,12 +267,3 @@ namespace QFramework
*/ */
} }
} }
public class StringAsset : ScriptableObject
{
public string text;
public StringAsset(string text)
{
this.text = text;
}
}

View File

@ -48,7 +48,7 @@ namespace QFramework
{ {
if (success) if (success)
{ {
string xmlStr = res.Asset.As<StringAsset>().text; string xmlStr = res.As<LocalTextRes>().text;
if (string.IsNullOrEmpty(xmlStr) == false) if (string.IsNullOrEmpty(xmlStr) == false)
{ {
// ¼ÓÔØXML // ¼ÓÔØXML

View File

@ -23,7 +23,7 @@ public class Launch : MonoBehaviour
{ {
if (success) if (success)
{ {
Global.Instance.appData = XmlParser.ParseXml(res.Asset.As<StringAsset>().text); Global.Instance.appData = XmlParser.ParseXml(res.As<LocalTextRes>().text);
} }
}); });