diff --git a/AideDeJeu/AideDeJeu/AideDeJeu.csproj b/AideDeJeu/AideDeJeu/AideDeJeu.csproj index 01958cc0..8a7d7738 100644 --- a/AideDeJeu/AideDeJeu/AideDeJeu.csproj +++ b/AideDeJeu/AideDeJeu/AideDeJeu.csproj @@ -158,6 +158,9 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + MSBuild:UpdateDesignTimeXaml diff --git a/AideDeJeu/AideDeJeu/App.xaml.cs b/AideDeJeu/AideDeJeu/App.xaml.cs index 107bcaa1..d4e64912 100644 --- a/AideDeJeu/AideDeJeu/App.xaml.cs +++ b/AideDeJeu/AideDeJeu/App.xaml.cs @@ -29,11 +29,12 @@ namespace AideDeJeu var bgtan = (Color)Resources["HDWhite"]; - //MainPage = new MainShell(); - var mainNavigationPage = new MainNavigationPage(); - vm.Navigator = new Navigator(mainNavigationPage.Navigation); - MainPage = mainNavigationPage; - mainNavigationPage.Navigation.PushAsync(new MainPage()); + MainPage = new MainShell(); + //var mainNavigationPage = new MainNavigationPage(); + //vm.Navigator = new Navigator(mainNavigationPage.Navigation); + vm.Navigator = new Navigator(null); + //MainPage = mainNavigationPage; + //mainNavigationPage.Navigation.PushAsync(new MainPage()); } diff --git a/AideDeJeu/AideDeJeu/ViewModels/Navigator.cs b/AideDeJeu/AideDeJeu/ViewModels/Navigator.cs index a55726bc..0622422b 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/Navigator.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/Navigator.cs @@ -239,6 +239,8 @@ namespace AideDeJeu.ViewModels public async Task NavigateToLinkAsync(string s) { + await Shell.Current.GoToAsync($"//data/item?path={s}"); + return; if (s != null) { var regex = new Regex("/?(?.*?)(_with_(?.*))?\\.md(#(?.*))?"); diff --git a/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml new file mode 100644 index 00000000..b6cfe45d --- /dev/null +++ b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml.cs b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml.cs new file mode 100644 index 00000000..b352ac71 --- /dev/null +++ b/AideDeJeu/AideDeJeu/Views/Library/ItemPage.xaml.cs @@ -0,0 +1,146 @@ + +using AideDeJeu.ViewModels; +using AideDeJeu.ViewModels.Library; +using AideDeJeuLib; +using SkiaSharp; +using SkiaSharp.Views.Forms; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace AideDeJeu.Views.Library +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [QueryProperty("Path", "path")] + public partial class ItemPage : ContentPage, INotifyPropertyChanged + { + public MainViewModel Main + { + get + { + return DependencyService.Get(); + } + } + + private ItemDetailViewModel _Item = null; + public ItemDetailViewModel Item + { + get + { + return _Item; + } + set + { + SetProperty(ref _Item, value); + } + } + + public ItemPage() + { + BindingContext = this; + InitializeComponent(); + } + + public ItemPage(string id) + { + Path = id; + BindingContext = this; + InitializeComponent(); + LoadPageAsync(); + } + + protected override void OnAppearing() + { + base.OnAppearing(); + LoadPageAsync(); + } + + private string _Path { get; set; } = "index.md"; + public string Path + { + get + { + return _Path; + } + set + { + _Path = value; + LoadPageAsync(); + } + } + + private async Task LoadPageAsync() + { + var regex = new Regex("/?(?.*?)(_with_(?.*))?\\.md(#(?.*))?"); + var match = regex.Match(Path); + var file = match.Groups["file"].Value; + var anchor = match.Groups["anchor"].Value; + var with = match.Groups["with"].Value; + Item item = null; + try + { + Main.IsBusy = true; + Main.IsLoading = true; + item = await Task.Run(async () => await Main.Store.GetItemFromDataAsync(file, anchor)); + } + finally + { + Main.IsBusy = false; + Main.IsLoading = false; + } + if (item != null) + { + var items = item; // as Items; + var filterViewModel = items.GetNewFilterViewModel(); + var itemsViewModel = new ItemDetailViewModel() { Item = items }; + this.Item = itemsViewModel; + //SwitchToMainTab(); + //if (filterViewModel == null) + //{ + // await GotoItemsPageAsync(itemsViewModel); + //} + //else + //{ + // await GotoFilteredItemsPageAsync(itemsViewModel); + //} + + } + else + { + //await App.Current.MainPage.DisplayAlert("Lien invalide", s, "OK"); + } + } + + protected bool SetProperty(ref T backingStore, T value, + [CallerMemberName]string propertyName = "", + Action onChanged = null) + { + if (EqualityComparer.Default.Equals(backingStore, value)) + return false; + + backingStore = value; + onChanged?.Invoke(); + OnPropertyChanged(propertyName); + return true; + } + + #region INotifyPropertyChanged + public event PropertyChangedEventHandler PropertyChanged; + protected void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + var changed = PropertyChanged; + if (changed == null) + return; + + changed.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + #endregion + + } +} \ No newline at end of file diff --git a/AideDeJeu/AideDeJeu/Views/MainShell.xaml b/AideDeJeu/AideDeJeu/Views/MainShell.xaml index 109adb87..a0c9f3fe 100644 --- a/AideDeJeu/AideDeJeu/Views/MainShell.xaml +++ b/AideDeJeu/AideDeJeu/Views/MainShell.xaml @@ -16,7 +16,7 @@ - + + + + + + + + index_mdr.md + + + + + + + + + + + + + index_cdc.md + + + + + + + + + + + + + index_ceo.md + + + + + + - - - - - - - l5r_index_hd.md - - - - - - - - - - - l5r_index_hd.md - - - - - - - - - - - l5r_index_hd.md - - - - - - + + + + + + l5r_index_hd.md + + + + + + + + + + + + + tome_of_beasts.md + + + + + + + + + + + + + baby_bestiary.md + + + + + + + + + + + + + index_srd.md + + + + + + +# Cadre de campagne + +## [Objets magiques](magicitems_hd.md) + +### [Objets magiques de A à Z](magicitems_az_hd.md) + +### [Objets magiques intelligents](sentient_magicitems_hd.md) + +### [Artefacts](artifacts_hd.md) + +## [Jouer dans un multivers](planes_hd.md) + + diff --git a/Data/index_ceo.md b/Data/index_ceo.md new file mode 100644 index 00000000..c9930bb1 --- /dev/null +++ b/Data/index_ceo.md @@ -0,0 +1,18 @@ + + + +# Créatures et oppositions + +## [Créatures](monsters_hd.md) + +## [Pièges](traps_hd.md) + +## [Maladies](diseases_hd.md) + +## [Folie](madness_hd.md) + +## [Objets](objects_hd.md) + +## [Poisons](poisons_hd.md) + + diff --git a/Data/index_mdr.md b/Data/index_mdr.md new file mode 100644 index 00000000..148d8817 --- /dev/null +++ b/Data/index_mdr.md @@ -0,0 +1,32 @@ + + + +# Manuel des règles + +## [Création du personnage](beyond1stlevel_hd.md) + +## [Races](races_hd.md) + +## [Personnalité et Historique](personnality_background_hd.md) + +## [Classes](classes_hd.md) + +## [Équipement](equipment_hd.md) + +## [Options de personnalisation](custom_options_hd.md) + +## [Utiliser les Caractéristiques](abilities_hd.md) + +## [Partir à l'aventure](adventure_hd.md) + +## [Combattre](combat_hd.md) + +## [Gérer la santé](manage_health_hd.md) + +## [Lancer des sorts](spellcasting_hd.md) + +## [Description des Sorts](spells_hd.md) + +## [Panthéons](pantheons_hd.md) + + diff --git a/Data/index_srd.md b/Data/index_srd.md new file mode 100644 index 00000000..e5f6fc34 --- /dev/null +++ b/Data/index_srd.md @@ -0,0 +1,12 @@ + + + +# SRD + +## [Conditions](conditions_vo.md) + +## [Spells](spells_vo.md) + +## [Monsters, Animals and NPC](monsters_vo.md) + + diff --git a/Data/library.db b/Data/library.db index f0844299..3f471055 100644 Binary files a/Data/library.db and b/Data/library.db differ