Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/Myra/Graphics2D/TextureAtlases/TextureRegionAtlas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,7 @@ public string ToXml()
/// <returns></returns>
public static TextureRegionAtlas Load(string data, Func<string, Texture2D> textureGetter)
{
bool isXml;
try
{
var xDoc = XDocument.Parse(data);
isXml = true;
}
catch (Exception)
{
isXml = false;
}

if (isXml)
if (data.StartsWith("<") && data.EndsWith(">"))
{
return FromXml(data, textureGetter);
}
Expand Down
5 changes: 4 additions & 1 deletion src/Myra/Graphics2D/UI/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ internal void UpdateSelectedItem()
{
InternalChild.Text = item.Text;
InternalChild.TextColor = item.Color ?? _listBox.ListBoxStyle.ListItemStyle.LabelStyle.TextColor;
((ImageTextButton)item.Widget).IsPressed = true;
if (item.Widget != null)
{
((ImageTextButton)item.Widget).IsPressed = true;
}
}
else
{
Expand Down
15 changes: 15 additions & 0 deletions src/Myra/Graphics2D/UI/ImageTextButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ public enum TextPositionEnum
private readonly Label _label;
private TextPositionEnum _textPosition;


private string _l18nText;
public string L18nTextKey
{
get
{
return _l18nText;
}
set
{
_l18nText = value;
Text = Project.Localize?.Invoke(value) ?? value;
}
}

[Category("Appearance")]
[DefaultValue(null)]
public string Text
Expand Down
14 changes: 14 additions & 0 deletions src/Myra/Graphics2D/UI/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ public int VerticalSpacing
}
}

private string _l18nText;
public string L18nTextKey
{
get
{
return _l18nText;
}
set
{
_l18nText = value;
Text = Project.Localize?.Invoke(value) ?? value;
}
}

[Category("Appearance")]
[DefaultValue(null)]
public string Text
Expand Down
Loading