Fixed error with new localization location
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RothenburgAR.Common
|
||||
{
|
||||
@@ -77,7 +77,18 @@ namespace RothenburgAR.Common
|
||||
TextEntryType type = TextElement.GetTextEntryTypeFromString(typeStr);
|
||||
var valueStr = xmlNode.Attributes["value"].Value;
|
||||
if (type == TextEntryType.File)
|
||||
valueStr = valueStr;
|
||||
{
|
||||
var file = Resources.Load<TextAsset>(valueStr);
|
||||
if (file != null)
|
||||
{
|
||||
valueStr = file.text;
|
||||
type = TextEntryType.Inline;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueStr = Path.Combine(basePath, valueStr);
|
||||
}
|
||||
}
|
||||
textElement.AddTextElement(langCode, type, valueStr);
|
||||
}
|
||||
return textElement;
|
||||
@@ -104,15 +115,13 @@ namespace RothenburgAR.Common
|
||||
if (Type == TextEntryType.Inline)
|
||||
return Value;
|
||||
|
||||
// Attention:
|
||||
// if there should be performance issues, here could be a nice place to add caching
|
||||
var file = Resources.Load<TextAsset>(Value);
|
||||
|
||||
// If it is no inline text, we need to have a file path as "value".
|
||||
if (file == null)
|
||||
if (!File.Exists(Value))
|
||||
throw new FileNotFoundException();
|
||||
|
||||
return file.text;
|
||||
// Attention:
|
||||
// if there should be performance issues, here could be a nice place to add caching
|
||||
return File.ReadAllText(Value, System.Text.Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user