mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2026-05-15 09:00:28 +00:00
NameVO => AltName
This commit is contained in:
parent
4bfcddff03
commit
884164e497
21 changed files with 1364 additions and 1509 deletions
|
|
@ -17,7 +17,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n\n" +
|
||||
$"{NameVO}\n\n" +
|
||||
$"{AltName}\n\n" +
|
||||
Text;
|
||||
}
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ namespace AideDeJeuLib
|
|||
|
||||
var properties = new List<Tuple<string, Action<Condition, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Condition, string>>("NameVO: ", (m, s) => m.NameVO = s),
|
||||
new Tuple<string, Action<Condition, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
};
|
||||
|
||||
foreach (var property in properties)
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ namespace AideDeJeuLib
|
|||
public abstract class Item
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string NameVO { get; set; }
|
||||
public string NameVOText
|
||||
public string AltName { get; set; }
|
||||
public string AltNameText
|
||||
{
|
||||
get
|
||||
{
|
||||
var regex = new Regex("\\[(?<text>.*?)\\]");
|
||||
var match = regex.Match(NameVO ?? string.Empty);
|
||||
var match = regex.Match(AltName ?? string.Empty);
|
||||
return match.Groups["text"].Value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ namespace AideDeJeuLib
|
|||
new Tuple<string, Action<Monster, string>>("**Skills** ", (m, s) => m.Skills = s),
|
||||
new Tuple<string, Action<Monster, string>>("**Compétence** ", (m, s) => m.Skills = s),
|
||||
|
||||
new Tuple<string, Action<Monster, string>>("NameVO: ", (m, s) => m.NameVO = s),
|
||||
new Tuple<string, Action<Monster, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
|
||||
new Tuple<string, Action<Monster, string>>("", (m,s) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{NameVO}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"{Type} de taille {Size}, {Alignment}\n" +
|
||||
$"**Classe d'armure** {ArmorClass}\n" +
|
||||
$"**Points de vie** {HitPoints}\n" +
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{NameVO}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"{Size} {Type}, {Alignment}\n" +
|
||||
$"**Armor Class** {ArmorClass}\n" +
|
||||
$"**Hit Points** {HitPoints}\n" +
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ namespace AideDeJeuLib
|
|||
if (block is Markdig.Syntax.HeadingBlock)
|
||||
{
|
||||
var headingBlock = block as Markdig.Syntax.HeadingBlock;
|
||||
//DumpHeadingBlock(headingBlock);
|
||||
if (headingBlock.HeaderChar == '#' && headingBlock.Level == 1)
|
||||
{
|
||||
if (this.Name != null)
|
||||
|
|
@ -42,7 +41,6 @@ namespace AideDeJeuLib
|
|||
return;
|
||||
}
|
||||
this.Name = headingBlock.Inline.ToMarkdownString();
|
||||
//Console.WriteLine(spell.Name);
|
||||
}
|
||||
}
|
||||
if (block is Markdig.Syntax.ParagraphBlock)
|
||||
|
|
@ -54,40 +52,29 @@ namespace AideDeJeuLib
|
|||
var paragraphBlock = block as Markdig.Syntax.ParagraphBlock;
|
||||
|
||||
this.DescriptionHtml += paragraphBlock.ToMarkdownString() + "\n";
|
||||
////DumpParagraphBlock(paragraphBlock);
|
||||
//Console.WriteLine(paragraphBlock.IsBreakable);
|
||||
//spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString();
|
||||
//if(paragraphBlock.IsBreakable)
|
||||
//{
|
||||
// spell.DescriptionHtml += "\n";
|
||||
//}
|
||||
}
|
||||
if (block is Markdig.Syntax.ListBlock)
|
||||
{
|
||||
var listBlock = block as Markdig.Syntax.ListBlock;
|
||||
//DumpListBlock(listBlock);
|
||||
if (listBlock.BulletType == '-')
|
||||
{
|
||||
this.Source = "";
|
||||
foreach (var inblock in listBlock)
|
||||
{
|
||||
//DumpBlock(inblock);
|
||||
var regex = new Regex("(?<key>.*?): (?<value>.*)");
|
||||
if (inblock is Markdig.Syntax.ListItemBlock)
|
||||
{
|
||||
var listItemBlock = inblock as Markdig.Syntax.ListItemBlock;
|
||||
foreach (var ininblock in listItemBlock)
|
||||
{
|
||||
//DumpBlock(ininblock);
|
||||
if (ininblock is Markdig.Syntax.ParagraphBlock)
|
||||
{
|
||||
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
|
||||
//DumpParagraphBlock(paragraphBlock);
|
||||
var str = paragraphBlock.Inline.ToMarkdownString();
|
||||
|
||||
var properties = new List<Tuple<string, Action<Spell, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Spell, string>>("NameVO: ", (m, s) => m.NameVO = s),
|
||||
new Tuple<string, Action<Spell, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
new Tuple<string, Action<Spell, string>>("CastingTime: ", (m, s) => m.CastingTime = s),
|
||||
new Tuple<string, Action<Spell, string>>("Components: ", (m, s) => m.Components = s),
|
||||
new Tuple<string, Action<Spell, string>>("Duration: ", (m, s) => m.Duration = s),
|
||||
|
|
@ -122,7 +109,6 @@ namespace AideDeJeuLib
|
|||
var listItemBlock = inblock as Markdig.Syntax.ListItemBlock;
|
||||
foreach (var ininblock in listItemBlock)
|
||||
{
|
||||
//DumpBlock(ininblock);
|
||||
if (ininblock is Markdig.Syntax.ParagraphBlock)
|
||||
{
|
||||
var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{NameVO}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"_{LevelType}_\n" +
|
||||
$"**Temps d'incantation :** {CastingTime}\n" +
|
||||
$"**Portée :** {Range}\n" +
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{NameVO}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"_{LevelType}_\n" +
|
||||
$"**Casting Time :** {CastingTime}\n" +
|
||||
$"**Range :** {Range}\n" +
|
||||
|
|
|
|||
|
|
@ -33,43 +33,4 @@ namespace AideDeJeu.Tools
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ItemSourceTypeConverter<T> : IValueConverter
|
||||
{
|
||||
public T SpellVO { get; set; }
|
||||
public T SpellHD { get; set; }
|
||||
public T MonsterVO { get; set; }
|
||||
public T MonsterHD { get; set; }
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var itemType = value as ItemSourceType?;
|
||||
if (itemType == ItemSourceType.SpellVO)
|
||||
{
|
||||
return SpellVO;
|
||||
}
|
||||
if (itemType == ItemSourceType.SpellHD)
|
||||
{
|
||||
return SpellHD;
|
||||
}
|
||||
if (itemType == ItemSourceType.MonsterVO)
|
||||
{
|
||||
return MonsterVO;
|
||||
}
|
||||
if (itemType == ItemSourceType.MonsterHD)
|
||||
{
|
||||
return MonsterHD;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class ItemSourceTypeToStringConverter : ItemSourceTypeConverter<string> { }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ namespace AideDeJeu.ViewModels
|
|||
return
|
||||
(
|
||||
(Helpers.RemoveDiacritics(spell.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
|
||||
(Helpers.RemoveDiacritics(spell.NameVOText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
(Helpers.RemoveDiacritics(spell.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
);
|
||||
}).AsEnumerable();
|
||||
}, token);
|
||||
|
|
@ -185,7 +185,7 @@ namespace AideDeJeu.ViewModels
|
|||
spell.Rituel.Contains(rituel) &&
|
||||
(
|
||||
(Helpers.RemoveDiacritics(spell.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
|
||||
(Helpers.RemoveDiacritics(spell.NameVOText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
(Helpers.RemoveDiacritics(spell.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
);
|
||||
}).OrderBy(spell => spell.Name)
|
||||
.AsEnumerable();
|
||||
|
|
@ -435,7 +435,7 @@ namespace AideDeJeu.ViewModels
|
|||
powerComparer.Compare(monster.Challenge, maxPower) <= 0 &&
|
||||
(
|
||||
(Helpers.RemoveDiacritics(monster.Name).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower())) ||
|
||||
(Helpers.RemoveDiacritics(monster.NameVOText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
(Helpers.RemoveDiacritics(monster.AltNameText ?? string.Empty).ToLower().Contains(Helpers.RemoveDiacritics(SearchText ?? string.Empty).ToLower()))
|
||||
);
|
||||
})
|
||||
.OrderBy(monster => monster.Name)
|
||||
|
|
|
|||
|
|
@ -31,72 +31,6 @@ namespace AideDeJeu.ViewModels
|
|||
{
|
||||
await Main.Navigator.GotoItemDetailPageAsync(item);
|
||||
}
|
||||
//protected ItemSourceType ItemSourceType;
|
||||
|
||||
|
||||
//private IEnumerable<Item> _AllItems = null;
|
||||
//public async Task<IEnumerable<Item>> GetAllItemsAsync()
|
||||
//{
|
||||
// if (_AllItems == null)
|
||||
// {
|
||||
// string resourceName = null;
|
||||
// switch (ItemSourceType)
|
||||
// {
|
||||
// case ItemSourceType.MonsterVO:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.monsters_vo.md";
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToMonsters<MonsterVO>(md);
|
||||
// }
|
||||
// break;
|
||||
// case ItemSourceType.MonsterHD:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.monsters_hd.md";
|
||||
// //var md = await Tools.Helpers.GetStringFromUrl("https://raw.githubusercontent.com/Nioux/AideDeJeu/master/Data/monsters_hd.md");
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToMonsters<MonsterHD>(md);
|
||||
// }
|
||||
// break;
|
||||
// case ItemSourceType.SpellVO:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.spells_vo.md";
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToSpells<SpellVO>(md);
|
||||
// }
|
||||
// break;
|
||||
// case ItemSourceType.SpellHD:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.spells_hd.md";
|
||||
// //var md = await Tools.Helpers.GetStringFromUrl("https://raw.githubusercontent.com/Nioux/AideDeJeu/master/Data/spells_hd.md");
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToSpells<SpellHD>(md);
|
||||
// }
|
||||
// break;
|
||||
// case ItemSourceType.ConditionVO:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.conditions_vo.md";
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToConditions<AideDeJeuLib.Condition>(md);
|
||||
// }
|
||||
// break;
|
||||
// case ItemSourceType.ConditionHD:
|
||||
// {
|
||||
// resourceName = "AideDeJeu.Data.conditions_hd.md";
|
||||
// //var md = await Tools.Helpers.GetStringFromUrl("https://raw.githubusercontent.com/Nioux/AideDeJeu/master/Data/spells_hd.md");
|
||||
// var md = await Tools.Helpers.GetResourceStringAsync(resourceName);
|
||||
// _AllItems = Tools.MarkdownExtensions.ToItem(md) as IEnumerable<Item>;
|
||||
// //_AllItems = Tools.MarkdownExtensions.MarkdownToConditions<AideDeJeuLib.Condition>(md);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return _AllItems;
|
||||
//}
|
||||
|
||||
private ItemSourceType _ItemSourceType = ItemSourceType.SpellHD;
|
||||
public ItemSourceType ItemSourceType
|
||||
|
|
@ -108,7 +42,6 @@ namespace AideDeJeu.ViewModels
|
|||
set
|
||||
{
|
||||
SetProperty(ref _ItemSourceType, value);
|
||||
//LoadItemsCommand.Execute(null);
|
||||
OnPropertyChanged(nameof(Items));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,20 +87,6 @@ namespace AideDeJeu.ViewModels
|
|||
new KeyValuePair<ItemSourceType, string>(ItemSourceType.ConditionVO, "Conditions (VO)"),
|
||||
};
|
||||
|
||||
private int _ItemsSourcesIndex = 0;
|
||||
public int ItemsSourcesIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ItemsSourcesIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _ItemsSourcesIndex, value);
|
||||
//ItemSourceType = ItemsSources[value].Key;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<ItemSourceType, Func<ItemsViewModel>> AllItemsViewModel = new Dictionary<ItemSourceType, Func<ItemsViewModel>>()
|
||||
{
|
||||
{ ItemSourceType.SpellVO, () => new ItemsViewModel(ItemSourceType.SpellVO) },
|
||||
|
|
@ -131,7 +117,6 @@ namespace AideDeJeu.ViewModels
|
|||
return AllFiltersViewModel[itemSourceType].Invoke();
|
||||
}
|
||||
|
||||
// Yan : pas besoin d'ObservableCollection, on ne modifie jamais la liste item par item
|
||||
public IEnumerable<Item> _Items = new List<Item>();
|
||||
public IEnumerable<Item> Items
|
||||
{
|
||||
|
|
@ -158,19 +143,10 @@ namespace AideDeJeu.ViewModels
|
|||
|
||||
public MainViewModel()
|
||||
{
|
||||
//LoadItemsCommand = new Command(async () =>
|
||||
// {
|
||||
// await GetItemsViewModel(ItemSourceType).ExecuteLoadItemsCommandAsync();
|
||||
// });
|
||||
GotoItemCommand = new Command<Item>(async (item) =>
|
||||
{
|
||||
await Navigator.GotoItemDetailPageAsync(item);
|
||||
//await GetItemsViewModel(ItemSourceType).ExecuteGotoItemCommandAsync(item);
|
||||
});
|
||||
//SwitchToSpellsHD = new Command(() => ItemSourceType = ItemSourceType.SpellHD);
|
||||
//SwitchToMonstersHD = new Command(() => ItemSourceType = ItemSourceType.MonsterHD);
|
||||
//SwitchToSpellsVO = new Command(() => ItemSourceType = ItemSourceType.SpellVO);
|
||||
//SwitchToMonstersVO = new Command(() => ItemSourceType = ItemSourceType.MonsterVO);
|
||||
AboutCommand = new Command(async () => await Main.Navigator.GotoAboutPageAsync());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,9 @@ namespace AideDeJeu.ViewModels
|
|||
|
||||
public async Task GotoItemsPageAsync(ItemsViewModel itemsVM)
|
||||
{
|
||||
//if (item == null)
|
||||
// return;
|
||||
if (itemsVM == null)
|
||||
return;
|
||||
|
||||
//var vm = new ItemDetailViewModel(item);
|
||||
await Navigation.PushAsync(new ItemsPage(itemsVM));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace AideDeJeu.Views
|
|||
var item = new MonsterHD
|
||||
{
|
||||
Name = "",
|
||||
NameVO = "",
|
||||
AltName = "",
|
||||
//Description = "This is an item description."
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
<ViewCell AutomationProperties.IsInAccessibleTree="True" AutomationId="machin" AutomationProperties.Name="hop">
|
||||
<StackLayout Padding="10" Orientation="Vertical">
|
||||
<Label Text="{Binding Name}" LineBreakMode="NoWrap" Style="{DynamicResource subsubsection}" FontSize="16" />
|
||||
<Label Text="{Binding NameVOText}" LineBreakMode="NoWrap" Style="{DynamicResource subsubsection}" FontSize="12" />
|
||||
<Label Text="{Binding AltNameText}" LineBreakMode="NoWrap" Style="{DynamicResource subsubsection}" FontSize="12" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue