(558678b4c) SerializableProperty names can be translated (the tags are "ClassName.PropertyName", e.g. "LightComponent.LightColor")
This commit is contained in:
@@ -294,7 +294,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
string displayName = property.GetAttribute<Editable>().DisplayName;
|
string propertyName = (entity.GetType().Name + "." + property.PropertyInfo.Name).ToLowerInvariant();
|
||||||
|
string displayName = TextManager.Get(propertyName, returnNull: true) ?? property.GetAttribute<Editable>().DisplayName;
|
||||||
if (displayName == null)
|
if (displayName == null)
|
||||||
{
|
{
|
||||||
displayName = property.Name.FormatCamelCaseWithSpaces();
|
displayName = property.Name.FormatCamelCaseWithSpaces();
|
||||||
|
|||||||
@@ -341,33 +341,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
if (subElement.Name.ToString().ToLowerInvariant() == "keymapping")
|
||||||
{
|
{
|
||||||
case "keymapping":
|
LoadKeyBinds(subElement);
|
||||||
foreach (XAttribute attribute in subElement.Attributes())
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType))
|
|
||||||
{
|
|
||||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
|
|
||||||
{
|
|
||||||
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
|
||||||
{
|
|
||||||
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckBindings(bool useDefaults)
|
public void CheckBindings(bool useDefaults)
|
||||||
{
|
{
|
||||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||||
{
|
{
|
||||||
@@ -981,6 +963,55 @@ namespace Barotrauma
|
|||||||
|
|
||||||
selectedContentPackagePaths = new HashSet<string>();
|
selectedContentPackagePaths = new HashSet<string>();
|
||||||
|
|
||||||
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
|
{
|
||||||
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "keymapping":
|
||||||
|
LoadKeyBinds(subElement);
|
||||||
|
break;
|
||||||
|
case "gameplay":
|
||||||
|
jobPreferences = new List<string>();
|
||||||
|
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
|
||||||
|
{
|
||||||
|
string jobIdentifier = ele.GetAttributeString("identifier", "");
|
||||||
|
if (string.IsNullOrEmpty(jobIdentifier)) continue;
|
||||||
|
jobPreferences.Add(jobIdentifier);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "player":
|
||||||
|
defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName);
|
||||||
|
CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex);
|
||||||
|
if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g))
|
||||||
|
{
|
||||||
|
CharacterGender = g;
|
||||||
|
}
|
||||||
|
if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r))
|
||||||
|
{
|
||||||
|
CharacterRace = r;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CharacterRace = Race.White;
|
||||||
|
}
|
||||||
|
CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex);
|
||||||
|
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex);
|
||||||
|
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex);
|
||||||
|
CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex);
|
||||||
|
break;
|
||||||
|
case "tutorials":
|
||||||
|
foreach (XElement tutorialElement in subElement.Elements())
|
||||||
|
{
|
||||||
|
CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", ""));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnsavedSettings = false;
|
||||||
|
|
||||||
|
selectedContentPackagePaths = new HashSet<string>();
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
gSettings = new XElement("graphicssettings");
|
gSettings = new XElement("graphicssettings");
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ namespace Barotrauma
|
|||||||
public readonly AttributeCollection Attributes;
|
public readonly AttributeCollection Attributes;
|
||||||
public readonly Type PropertyType;
|
public readonly Type PropertyType;
|
||||||
|
|
||||||
|
public PropertyInfo PropertyInfo
|
||||||
|
{
|
||||||
|
get { return propertyInfo; }
|
||||||
|
}
|
||||||
|
|
||||||
public SerializableProperty(PropertyDescriptor property, object obj)
|
public SerializableProperty(PropertyDescriptor property, object obj)
|
||||||
{
|
{
|
||||||
Name = property.Name;
|
Name = property.Name;
|
||||||
|
|||||||
Reference in New Issue
Block a user