1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-12-22 10:03:41 +00:00

Filtres sur casting time, range, duration

This commit is contained in:
Yan Maniez 2019-07-18 13:55:53 +02:00
parent 3164665221
commit 145c050d2d
8 changed files with 52 additions and 19 deletions

View file

@ -15,6 +15,9 @@ namespace AideDeJeuLib
public string Levels { get; set; }
public string Schools { get; set; }
public string Rituals { get; set; }
public string CastingTimes { get; set; }
public string Ranges { get; set; }
public string Durations { get; set; }
public string Sources { get; set; }
public override FilterViewModel GetNewFilterViewModel()
@ -24,6 +27,9 @@ namespace AideDeJeuLib
Split(Levels),
Split(Schools),
Split(Rituals),
Split(CastingTimes),
Split(Ranges),
Split(Durations),
Split(Sources)
);
}

View file

@ -85,6 +85,9 @@ namespace AideDeJeu.ViewModels.Library
MaxLevel,
School,
Ritual,
CastingTime,
Range,
Duration,
Source,
Category,
Type,
@ -194,6 +197,9 @@ namespace AideDeJeu.ViewModels.Library
new Filter() { Key = FilterKeys.MaxLevel, Name = "Niveau Maximum", KeyValues = Levels, _Index = 0 },
new Filter() { Key = FilterKeys.School, Name = "École", KeyValues = Schools, _Index = 0 },
new Filter() { Key = FilterKeys.Ritual, Name = "Rituel", KeyValues = Rituals, _Index = 0 },
new Filter() { Key = FilterKeys.CastingTime, Name = "Temps d'incantation", KeyValues = CastingTimes, _Index = 0 },
new Filter() { Key = FilterKeys.Range, Name = "Portée", KeyValues = Ranges, _Index = 0 },
new Filter() { Key = FilterKeys.Duration, Name = "Durée", KeyValues = Durations, _Index = 0 },
new Filter() { Key = FilterKeys.Source, Name = "Source", KeyValues = Sources, _Index = 0 },
};
RegisterFilters();
@ -210,6 +216,9 @@ namespace AideDeJeu.ViewModels.Library
List<KeyValuePair<string, string>> levels,
List<KeyValuePair<string, string>> schools,
List<KeyValuePair<string, string>> rituals,
List<KeyValuePair<string, string>> castingTimes,
List<KeyValuePair<string, string>> ranges,
List<KeyValuePair<string, string>> durations,
List<KeyValuePair<string, string>> sources)
{
this.Family = family;
@ -217,6 +226,9 @@ namespace AideDeJeu.ViewModels.Library
this.Levels = levels;
this.Schools = schools;
this.Rituals = rituals;
this.CastingTimes = castingTimes;
this.Ranges = ranges;
this.Durations = durations;
this.Sources = sources;
}
@ -235,6 +247,9 @@ namespace AideDeJeu.ViewModels.Library
var levelMax = LevelConverter(Filters.SingleOrDefault(filter => filter.Key == FilterKeys.MaxLevel).SelectedKey) ?? "9";
var school = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.School).SelectedKey ?? "";
var ritual = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Ritual).SelectedKey ?? "";
var castingTime = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.CastingTime).SelectedKey ?? "";
var range = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Range).SelectedKey ?? "";
var duration = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Duration).SelectedKey ?? "";
var source = Filters.SingleOrDefault(filter => filter.Key == FilterKeys.Source).SelectedKey ?? "";
try
{
@ -249,6 +264,9 @@ namespace AideDeJeu.ViewModels.Library
(spell.Source != null && spell.Source.Contains(source)) &&
(spell.Classes != null && spell.Classes.Contains(classe)) &&
(string.IsNullOrEmpty(ritual) || (spell.Ritual != null && spell.Ritual.Contains(ritual))) &&
(spell.CastingTime != null) && spell.CastingTime.Contains(castingTime) &&
(spell.Range != null) && spell.Range.Contains(range) &&
(spell.Duration != null) && spell.Duration.Contains(duration) &&
(
(Helpers.RemoveDiacritics(spell.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
(Helpers.RemoveDiacritics(spell.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
@ -274,6 +292,12 @@ namespace AideDeJeu.ViewModels.Library
public List<KeyValuePair<string, string>> Rituals { get; }
public List<KeyValuePair<string, string>> CastingTimes { get; }
public List<KeyValuePair<string, string>> Ranges { get; }
public List<KeyValuePair<string, string>> Durations { get; }
public List<KeyValuePair<string, string>> Sources { get; }
}