mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Monstres encore
This commit is contained in:
parent
df542b3108
commit
fd82b9fa51
2 changed files with 60 additions and 24 deletions
|
|
@ -77,14 +77,14 @@
|
||||||
|
|
||||||
<skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/>
|
<skia:SKCanvasView PaintSurface="PaintRedBar" HorizontalOptions="FillAndExpand" HeightRequest="8"/>
|
||||||
|
|
||||||
<Label FormattedText="{Binding Item.SpecialFeatures, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" />
|
<Label FormattedText="{Binding Item.SpecialFeaturesNodes, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.SpecialFeatures, Converter={StaticResource NullToFalseConverter}}" />
|
||||||
|
|
||||||
<Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
|
<Label Text="Actions" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
|
||||||
<Label FormattedText="{Binding Item.Actions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
|
<Label FormattedText="{Binding Item.ActionsNodes, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.Actions, Converter={StaticResource NullToFalseConverter}}" />
|
||||||
|
|
||||||
<Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
|
<Label Text="Actions légendaires" Style="{StaticResource Key=subsubsection}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
|
||||||
<Label FormattedText="{Binding Item.LegendaryActions, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
|
<Label FormattedText="{Binding Item.LegendaryActionsNodes, Converter={StaticResource HtmlNodesToFormattedStringConverter}}" IsVisible="{Binding Item.LegendaryActions, Converter={StaticResource NullToFalseConverter}}" />
|
||||||
<!--<ListView ItemsSource="{Binding Item.SpecialFeatures}">
|
<!--<ListView ItemsSource="{Binding Item.SpecialFeaturesNodes}">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Label BindingContext="{Binding}" FormattedText="{Binding Converter={StaticResource HtmlNodeToFormattedStringConverter}}" />
|
<Label BindingContext="{Binding}" FormattedText="{Binding Converter={StaticResource HtmlNodeToFormattedStringConverter}}" />
|
||||||
|
|
|
||||||
|
|
@ -50,35 +50,71 @@ namespace AideDeJeuLib.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> SpecialFeatures { get; set; }
|
private IEnumerable<string> NodeListToStringList(IEnumerable<HtmlNode> nodes)
|
||||||
|
{
|
||||||
|
if (nodes == null) return null;
|
||||||
|
var strings = new List<string>();
|
||||||
|
foreach (var node in nodes)
|
||||||
|
{
|
||||||
|
strings.Add(node.OuterHtml);
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<HtmlNode> StringListToNodeList(IEnumerable<string> strings)
|
||||||
|
{
|
||||||
|
if (strings == null) return null;
|
||||||
|
var nodes = new List<HtmlNode>();
|
||||||
|
foreach (var str in strings)
|
||||||
|
{
|
||||||
|
var doc = new HtmlDocument();
|
||||||
|
doc.LoadHtml(str);
|
||||||
|
nodes.Add(doc.DocumentNode);
|
||||||
|
}
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> SpecialFeatures { get; set; }
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public List<HtmlNode> SpecialFeaturesNodes
|
public IEnumerable<HtmlNode> SpecialFeaturesNodes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var doc = new HtmlDocument();
|
return StringListToNodeList(SpecialFeatures);
|
||||||
var nodes = new List<HtmlNode>();
|
|
||||||
foreach(var specialFeature in SpecialFeatures)
|
|
||||||
{
|
|
||||||
doc.LoadHtml(specialFeature);
|
|
||||||
nodes.Add(doc.DocumentNode);
|
|
||||||
}
|
|
||||||
return nodes;
|
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var specialFeatures = new List<string>();
|
SpecialFeatures = NodeListToStringList(value);
|
||||||
foreach(var node in value)
|
|
||||||
{
|
|
||||||
specialFeatures.Add(node.OuterHtml);
|
|
||||||
}
|
|
||||||
SpecialFeatures = specialFeatures;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> Actions { get; set; }
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public List<HtmlNode> Actions { get; set; }
|
public IEnumerable<HtmlNode> ActionsNodes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return StringListToNodeList(Actions);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Actions = NodeListToStringList(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> LegendaryActions { get; set; }
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public List<HtmlNode> LegendaryActions { get; set; }
|
public IEnumerable<HtmlNode> LegendaryActionsNodes
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return StringListToNodeList(LegendaryActions);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
LegendaryActions = NodeListToStringList(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ParseHtml()
|
public void ParseHtml()
|
||||||
|
|
@ -203,8 +239,8 @@ namespace AideDeJeuLib.Monsters
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SpecialFeaturesNodes = specialFeatures;
|
this.SpecialFeaturesNodes = specialFeatures;
|
||||||
this.Actions = actions;
|
this.ActionsNodes = actions;
|
||||||
this.LegendaryActions = legendaryActions;
|
this.LegendaryActionsNodes = legendaryActions;
|
||||||
|
|
||||||
var divDescription = divBloc?.SelectSingleNode("div[contains(@class,'description')]");
|
var divDescription = divBloc?.SelectSingleNode("div[contains(@class,'description')]");
|
||||||
this.Description = divDescription?.InnerText;
|
this.Description = divDescription?.InnerText;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue