mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 07:26:09 +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) | ||||||
|         [IgnoreDataMember] |  | ||||||
|         public List<HtmlNode> SpecialFeaturesNodes |  | ||||||
|         { |         { | ||||||
|             get |             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(); |                 var doc = new HtmlDocument(); | ||||||
|                 var nodes = new List<HtmlNode>(); |                 doc.LoadHtml(str); | ||||||
|                 foreach(var specialFeature in SpecialFeatures) |  | ||||||
|                 { |  | ||||||
|                     doc.LoadHtml(specialFeature); |  | ||||||
|                 nodes.Add(doc.DocumentNode); |                 nodes.Add(doc.DocumentNode); | ||||||
|             } |             } | ||||||
|             return nodes; |             return nodes; | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         public IEnumerable<string> SpecialFeatures { get; set; } | ||||||
|  |         [IgnoreDataMember] | ||||||
|  |         public IEnumerable<HtmlNode> SpecialFeaturesNodes | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return StringListToNodeList(SpecialFeatures); | ||||||
|  |             } | ||||||
|             set |             set | ||||||
|             { |             { | ||||||
|                 var specialFeatures = new List<string>(); |                 SpecialFeatures = NodeListToStringList(value); | ||||||
|                 foreach(var node in value) |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public IEnumerable<string> Actions { get; set; } | ||||||
|  |         [IgnoreDataMember] | ||||||
|  |         public IEnumerable<HtmlNode> ActionsNodes | ||||||
|         { |         { | ||||||
|                     specialFeatures.Add(node.OuterHtml); |             get | ||||||
|  |             { | ||||||
|  |                 return StringListToNodeList(Actions); | ||||||
|             } |             } | ||||||
|                 SpecialFeatures = specialFeatures; |             set | ||||||
|  |             { | ||||||
|  |                 Actions = NodeListToStringList(value); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         public IEnumerable<string> LegendaryActions { get; set; } | ||||||
|         [IgnoreDataMember] |         [IgnoreDataMember] | ||||||
|         public List<HtmlNode> Actions { get; set; } |         public IEnumerable<HtmlNode> LegendaryActionsNodes | ||||||
|         [IgnoreDataMember] |         { | ||||||
|         public List<HtmlNode> LegendaryActions { get; set; } |             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
	
	 Yan Maniez
						Yan Maniez