mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-29 22:45:44 +00:00 
			
		
		
		
	Sub items en yaml
This commit is contained in:
		
							parent
							
								
									515cf7cdb4
								
							
						
					
					
						commit
						b6f6461007
					
				
					 8 changed files with 170 additions and 5 deletions
				
			
		|  | @ -1,12 +1,78 @@ | ||||||
| namespace AideDeJeuLib | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using YamlDotNet.Serialization; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeuLib | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|     public class BackgroundItem : Item |     public class BackgroundItem : Items | ||||||
|     { |     { | ||||||
|         public string SkillProficiencies { get; set; } |         public string SkillProficiencies { get; set; } | ||||||
|         public string MasteredTools { get; set; } |         public string MasteredTools { get; set; } | ||||||
|         public string MasteredLanguages { get; set; } |         public string MasteredLanguages { get; set; } | ||||||
|         public string Equipment { get; set; } |         public string Equipment { get; set; } | ||||||
| 
 | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public FeatureItem Feature | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<FeatureItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public BackgroundSpecialtyItem Specialty | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<BackgroundSpecialtyItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public PersonalityTraitItem PersonalityTraits | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<PersonalityTraitItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public PersonalityIdealItem Ideal | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<PersonalityIdealItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public PersonalityLinkItem Bond | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<PersonalityLinkItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public PersonalityDefectItem Flaw | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<PersonalityDefectItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public IEnumerable<SubBackgroundItem> SubBackgrounds | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChildren<SubBackgroundItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,6 +1,62 @@ | ||||||
| namespace AideDeJeuLib | using System.Collections.Generic; | ||||||
|  | using YamlDotNet.Serialization; | ||||||
|  | 
 | ||||||
|  | namespace AideDeJeuLib | ||||||
| { | { | ||||||
|     public class ClassItem : Item |     public class ClassItem : Item | ||||||
|     { |     { | ||||||
|  |         [YamlMember] | ||||||
|  |         public ClassHitPointsItem HitPoints | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<ClassHitPointsItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public ClassProficienciesItem Proficiencies | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<ClassProficienciesItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public ClassEquipmentItem Equipment | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<ClassEquipmentItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public ClassEvolutionItem Evolution | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<ClassEvolutionItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public IEnumerable<ClassFeatureItem> Features | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChildren<ClassFeatureItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public IEnumerable<SubClassItem> SubClasses | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChildren<SubClassItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -97,6 +97,17 @@ namespace AideDeJeuLib | ||||||
|             _Items.Add(item); |             _Items.Add(item); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         public virtual T GetChild<T>() where T : class | ||||||
|  |         { | ||||||
|  |             return _Items.Where(i => i is T).FirstOrDefault() as T; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public virtual IEnumerable<T> GetChildren<T>() where T : class | ||||||
|  |         { | ||||||
|  |             var items = _Items.Where(i => i is T).ToArray().Select(i => i as T).ToList(); | ||||||
|  |             return items.Count > 0 ? items : null; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         //public void Clear() |         //public void Clear() | ||||||
|         //{ |         //{ | ||||||
|         //    _Items.Clear(); |         //    _Items.Clear(); | ||||||
|  | @ -137,6 +148,7 @@ namespace AideDeJeuLib | ||||||
| 
 | 
 | ||||||
|         [DataMember(Name = "Item_Name", Order = 3)] |         [DataMember(Name = "Item_Name", Order = 3)] | ||||||
|         [Indexed] |         [Indexed] | ||||||
|  |         [YamlMember(Alias = "title")] | ||||||
|         public virtual string Name { get; set; } |         public virtual string Name { get; set; } | ||||||
| 
 | 
 | ||||||
|         [YamlIgnore] |         [YamlIgnore] | ||||||
|  | @ -621,5 +633,15 @@ namespace AideDeJeuLib | ||||||
|             return matrix; |             return matrix; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         [YamlIgnore] | ||||||
|  |         public string Folder | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return null; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -51,5 +51,15 @@ namespace AideDeJeuLib | ||||||
|                 return Expand(AvailableSkills); |                 return Expand(AvailableSkills); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public OriginFeatureItem Feature | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChild<OriginFeatureItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,6 @@ | ||||||
| using System.Runtime.Serialization; | using System.Collections.Generic; | ||||||
|  | using System.Runtime.Serialization; | ||||||
|  | using YamlDotNet.Serialization; | ||||||
| 
 | 
 | ||||||
| namespace AideDeJeuLib | namespace AideDeJeuLib | ||||||
| { | { | ||||||
|  | @ -79,5 +81,13 @@ namespace AideDeJeuLib | ||||||
|         [DataMember] |         [DataMember] | ||||||
|         public virtual string Languages { get; set; } |         public virtual string Languages { get; set; } | ||||||
| 
 | 
 | ||||||
|  |         [YamlMember] | ||||||
|  |         public IEnumerable<SubRaceItem> SubRaces | ||||||
|  |         { | ||||||
|  |             get | ||||||
|  |             { | ||||||
|  |                 return GetChildren<SubRaceItem>(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -121,6 +121,7 @@ namespace AideDeJeu.ViewModels | ||||||
|                                                 currentItem.Markdown += $"\n\n{new String('#', altlevel)} _[{altname}]({link})_"; |                                                 currentItem.Markdown += $"\n\n{new String('#', altlevel)} _[{altname}]({link})_"; | ||||||
|                                             } |                                             } | ||||||
|                                             currentItem.Markdown += "\n\n"; |                                             currentItem.Markdown += "\n\n"; | ||||||
|  |                                             currentItem.AddChild(subItem); | ||||||
|                                         } |                                         } | ||||||
|                                         else |                                         else | ||||||
|                                         { |                                         { | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										2
									
								
								JoA
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								JoA
									
										
									
									
									
								
							|  | @ -1 +1 @@ | ||||||
| Subproject commit e0cb48ecef71df11dc85b44fcffc99a9a8d5391f | Subproject commit c626772a0de392952e44ed86ef394e52cf1a2d1a | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez