fixed unity inventory and texts
This commit is contained in:
@@ -19,16 +19,28 @@ public class TextHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public static string getText(string key){
|
||||
key = key.Replace("(","").Replace(")","");
|
||||
bool hasLeftBracket = false;
|
||||
bool hasRightBracket = false;
|
||||
if(key.Contains("(")){
|
||||
hasLeftBracket = true;
|
||||
key = key.Replace("(","");
|
||||
}
|
||||
if(key.Contains(")")){
|
||||
hasRightBracket = true;
|
||||
key = key.Replace(")","");
|
||||
}
|
||||
|
||||
if(key[0].Equals(Char.ToUpperInvariant(key[0]))){
|
||||
key = Char.ToLowerInvariant(key[0]) + key.Substring(1);
|
||||
}
|
||||
|
||||
if(key.Contains("\r\n")){
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
string text = LocalizationSettings.StringDatabase.GetLocalizedString("MyTexts",key);
|
||||
if(hasLeftBracket){
|
||||
text = "(" + text;
|
||||
}
|
||||
if(hasRightBracket){
|
||||
text = text + ")";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user