Division en Projets Models et Stub

master
Cedric CHARBONNEL 2 years ago
parent dcfd36f02e
commit a3656fb6ca

@ -5,6 +5,10 @@ VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LOLAPP", "LOLAPP\LOLAPP.csproj", "{736A464D-D35B-47BD-AC29-04E11BFF186F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LOLAPP", "LOLAPP\LOLAPP.csproj", "{736A464D-D35B-47BD-AC29-04E11BFF186F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{495D58B1-27F0-4CF3-BA9B-426E4D3E8923}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stub", "Stub\Stub.csproj", "{B4BA7D18-1D1E-453D-B149-9E765428AD47}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -17,6 +21,14 @@ Global
{736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.ActiveCfg = Release|Any CPU {736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.Build.0 = Release|Any CPU {736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.Build.0 = Release|Any CPU
{736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.Deploy.0 = Release|Any CPU {736A464D-D35B-47BD-AC29-04E11BFF186F}.Release|Any CPU.Deploy.0 = Release|Any CPU
{495D58B1-27F0-4CF3-BA9B-426E4D3E8923}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{495D58B1-27F0-4CF3-BA9B-426E4D3E8923}.Debug|Any CPU.Build.0 = Debug|Any CPU
{495D58B1-27F0-4CF3-BA9B-426E4D3E8923}.Release|Any CPU.ActiveCfg = Release|Any CPU
{495D58B1-27F0-4CF3-BA9B-426E4D3E8923}.Release|Any CPU.Build.0 = Release|Any CPU
{B4BA7D18-1D1E-453D-B149-9E765428AD47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4BA7D18-1D1E-453D-B149-9E765428AD47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4BA7D18-1D1E-453D-B149-9E765428AD47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4BA7D18-1D1E-453D-B149-9E765428AD47}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -1,5 +1,6 @@
using LOLAPP.DataContractPersistance; using LOLAPP.DataContractPersistance;
using LOLAPP.Modele; using Models;
using Stub;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -8,7 +9,7 @@ namespace LOLAPP;
public partial class App : Application public partial class App : Application
{ {
public Manager MyManager { get; private set; } = new Manager(new Stub()); public Manager MyManager { get; private set; } = new Manager(new Stub.Stub());
public string FileNameC { get; set; } = "champions.xml"; public string FileNameC { get; set; } = "champions.xml";
public string FileNameU { get; set; } = "utilisateur.xml"; public string FileNameU { get; set; } = "utilisateur.xml";
public string FilePath { get; set; } = FileSystem.AppDataDirectory; public string FilePath { get; set; } = FileSystem.AppDataDirectory;

@ -11,5 +11,17 @@
Title="Home" Title="Home"
ContentTemplate="{DataTemplate view:Main}" ContentTemplate="{DataTemplate view:Main}"
Route="MainPage" /> Route="MainPage" />
<ShellContent
Title="Strat"
ContentTemplate="{DataTemplate view:Strat}"
Route="Strat" />
<ShellContent
Title="Login"
ContentTemplate="{DataTemplate view:Login}"
Route="Login" />
<ShellContent
Title="Register"
ContentTemplate="{DataTemplate view:Register}"
Route="Register" />
</TabBar> </TabBar>
</Shell> </Shell>

@ -1,4 +1,4 @@
using LOLAPP.Modele; using Models;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Xml; using System.Xml;

@ -1,4 +1,4 @@
using LOLAPP.Modele; using Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks> <TargetFrameworks>net7.0;</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> --> <!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
@ -52,10 +52,19 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="View\Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="View\Main.xaml"> <MauiXaml Update="View\Main.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="View\Login.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\Register.xaml"> <MauiXaml Update="View\Register.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
@ -64,4 +73,13 @@
</MauiXaml> </MauiXaml>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Stub\Stub.csproj" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,14 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LOLAPP.View.Login"
Title="Login">
<StackLayout>
<Label Text="Username" />
<Entry x:Name="usernameEntry" />
<Label Text="Password" />
<Entry x:Name="passwordEntry" IsPassword="True" />
<Button Text="Login" Clicked="LoginUtilisateur_Clicked" />
<Button Text="Logout" Clicked="LogoutUtilisateur_Clicked" />
<Button Text="Suprimer" Clicked="SupprimerUtilisateur_Clicked" />
</StackLayout>
</ContentPage>

@ -0,0 +1,93 @@
using Models;
using System.Diagnostics;
namespace LOLAPP.View;
public partial class Login : ContentPage
{
public Manager Mgr => (App.Current as App).MyManager;
public Login()
{
InitializeComponent();
BindingContext = Mgr;
}
private void LoginUtilisateur_Clicked(object sender, EventArgs e)
{
string username = usernameEntry.Text;
string password = passwordEntry.Text;
// Vérifier si l'utilisateur existe et les informations de connexion sont valides
Utilisateur utilisateur = Mgr._utilisateur.FirstOrDefault(u => u.Username == username && u.Password == password);
if (utilisateur != null && Mgr.UtilisateurConnecte == null)
{
// Connexion réussie
Mgr.UtilisateurConnecte = utilisateur;
DisplayAlert("Succès", "Connexion réussie", "OK");
}
else if (Mgr.UtilisateurConnecte != null)
{
// Utilisateur non connecté
DisplayAlert("Erreur", "Vous êtes déjà connecter", "OK");
}
else
{
// Informations de connexion incorrectes
DisplayAlert("Erreur", "Nom d'utilisateur ou mot de passe incorrect", "OK");
}
usernameEntry.Text = "";
passwordEntry.Text = "";
}
private void LogoutUtilisateur_Clicked(object sender, EventArgs e)
{
string username = usernameEntry.Text;
string password = passwordEntry.Text;
// Vérifier si l'utilisateur existe et les informations de connexion sont valides
Utilisateur utilisateur = Mgr._utilisateur.FirstOrDefault(u => u.Username == username && u.Password == password);
if (utilisateur != null && Mgr.UtilisateurConnecte!= null)
{
// Connexion réussie
Mgr.UtilisateurConnecte = null;
DisplayAlert("Succès", "Déconnexion réussie", "OK");
}
else if(Mgr.UtilisateurConnecte == null)
{
// Utilisateur non connecté
DisplayAlert("Erreur", "Vous n'êtes pas connecter", "OK");
}
else
{
// Informations de connexion incorrectes
DisplayAlert("Erreur", "Nom d'utilisateur ou mot de passe incorrect", "OK");
}
usernameEntry.Text = "";
passwordEntry.Text = "";
}
private void SupprimerUtilisateur_Clicked(object sender, EventArgs e)
{
string username = usernameEntry.Text;
string password = passwordEntry.Text;
// Recherche de l'utilisateur dans la liste
Utilisateur utilisateur = Mgr._utilisateur.FirstOrDefault(u => u.Username == username && u.Password == password);
if (utilisateur != null)
{
// Suppression de l'utilisateur
Mgr.RemoveUtilisateur(utilisateur);
Mgr.Sauvdon();
DisplayAlert("Succès", "Utilisateur supprimé avec succès", "OK");
}
else
{
// Utilisateur non trouvé
DisplayAlert("Erreur", "Nom d'utilisateur ou mot de passe incorrect", "OK");
}
usernameEntry.Text = "";
passwordEntry.Text = "";
}
}

@ -1,37 +1,75 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LOLAPP.View.Main" x:Class="LOLAPP.View.Main"
Title="Main">
Title="Main"> <!-- Barre de navigation -->
<StackLayout> <!-- Image à gauche (redirection vers cette page) -->
<!-- Barre de navigation --> <!-- Bouton "Strat" à droite de l'image (redirection vers la page "strat") -->
<StackLayout Orientation="Horizontal" Background="LightGray"> <!-- Bouton "Register" -->
<!-- Image à gauche (redirection vers cette page) --> <!-- Bouton "Login" -->
<ImageButton Source="CheminVersVotreImage"/> <ScrollView>
<!-- Bouton "Strat" à droite de l'image (redirection vers la page "strat") -->
<Button Clicked="StratClick" Text="Strat" />
<!-- Bouton "Register" -->
<Button Clicked="RegisterClick" Text="Register"/>
<!-- Bouton "Login" -->
<Button Clicked="LoginClick" Text="Login"/>
</StackLayout>
<!-- Grille d'images avec fenêtres contextuelles -->
<HorizontalStackLayout> <HorizontalStackLayout>
<ListView> <!-- Grille d'images avec fenêtres contextuelles -->
<ListView.ItemTemplate> <Grid HorizontalOptions="Start">
<DataTemplate> <Grid.RowDefinitions>
<Image Source="{Binding Image}" Margin="5" /> <RowDefinition Height="300" />
</DataTemplate> <RowDefinition Height="300"/>
</ListView.ItemTemplate> </Grid.RowDefinitions>
</ListView> <Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="300" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Source="{Binding _champions[0].Image}" >
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageTapped" />
</Image.GestureRecognizers>
</Image>
<Image Grid.Row="0" Grid.Column="1" Source="{Binding _champions[1].Image}" >
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageTapped" />
</Image.GestureRecognizers>
</Image>
<Image Grid.Row="0" Grid.Column="2" Source="{Binding _champions[2].Image}" >
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageTapped" />
</Image.GestureRecognizers>
</Image>
<Image Grid.Row="1" Grid.Column="0" Source="{Binding _champions[3].Image}" >
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageTapped" />
</Image.GestureRecognizers>
</Image>
<Image Grid.Row="1" Grid.Column="1" Source="{Binding _champions[4].Image}" >
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageTapped" />
</Image.GestureRecognizers>
</Image>
</Grid>
<!-- Ajoutez d'autres images pour les champions suivants -->
<StackLayout WidthRequest="530" BackgroundColor="DarkGrey">
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Label x:Name="championNameLabel" FontSize="20" HorizontalOptions="Center" />
<Label x:Name="championTitreLabel" FontSize="16" HorizontalOptions="Center" />
<Image x:Name="abilityimage1" Margin="1" HeightRequest="50" WidthRequest="50"/>
<Label x:Name="abilityname1" FontSize="17" HorizontalOptions="Center" />
<Label x:Name="abilitydesc1" FontSize="14" HorizontalOptions="Center" />
<Image x:Name="abilityimage2" Margin="1" HeightRequest="50" WidthRequest="50"/>
<Label x:Name="abilityname2" FontSize="17" HorizontalOptions="Center" />
<Label x:Name="abilitydesc2" FontSize="14" HorizontalOptions="Center" />
<Image x:Name="abilityimage3" Margin="1" HeightRequest="50" WidthRequest="50"/>
<Label x:Name="abilityname3" FontSize="17" HorizontalOptions="Center" />
<Label x:Name="abilitydesc3" FontSize="14" HorizontalOptions="Center" />
<Image x:Name="abilityimage4" Margin="1" HeightRequest="50" WidthRequest="50"/>
<Label x:Name="abilityname4" FontSize="17" HorizontalOptions="Center" />
<Label x:Name="abilitydesc4" FontSize="14" HorizontalOptions="Center" />
<Image x:Name="abilityimage5" Margin="1" HeightRequest="50" WidthRequest="50"/>
<Label x:Name="abilityname5" FontSize="17" HorizontalOptions="Center" />
<Label x:Name="abilitydesc5" FontSize="14" HorizontalOptions="Center" />
</StackLayout>
</StackLayout>
</HorizontalStackLayout> </HorizontalStackLayout>
</ScrollView>
</ContentPage>
</StackLayout>
</ContentPage>

@ -1,23 +1,57 @@
using LOLAPP.Modele; using Models;
using System.Diagnostics;
namespace LOLAPP.View; namespace LOLAPP.View;
public partial class Main : ContentPage public partial class Main : ContentPage
{ {
public Manager Mgr => (App.Current as App).MyManager;
public Main() public Main()
{ {
Manager CManager = new Manager();
BindingContext = CManager._champions;
InitializeComponent(); InitializeComponent();
} BindingContext = Mgr;
private void StratClick(object sender, EventArgs e)
{
} }
void RegisterClick(object sender, EventArgs e) private void ImageTapped(object sender, EventArgs e)
{ {
Champion champ= null;
var image = (Image)sender;
foreach (var champion in Mgr._champions)
{
//Debug.WriteLine(image.Source.ToString());
if ("File: " + champion.Image == image.Source.ToString())
{
//Debug.WriteLine(champion.Image + " 2");
champ = champion;
break;
}
}
//var champion = manager._champions.FirstOrDefault(c => c.Image == image.Source.ToString()); ;
if (champ != null)
{
//Debug.WriteLine(champ.Name + " 3");
// Mettre à jour les labels des détails du champion
championNameLabel.Text = champ.Name;
championTitreLabel.Text = champ.Titre;
//Debug.WriteLine(champ.Abilities[0].Image);
abilityimage1.Source = champ.Abilities[0].Image;
abilityname1.Text = champ.Abilities[0].Name;
abilitydesc1.Text = champ.Abilities[0].Description;
abilityimage2.Source = champ.Abilities[1].Image;
abilityname2.Text = champ.Abilities[1].Name;
abilitydesc2.Text = champ.Abilities[1].Description;
abilityimage3.Source = champ.Abilities[2].Image;
abilityname3.Text = champ.Abilities[2].Name;
abilitydesc3.Text = champ.Abilities[2].Description;
abilityimage4.Source = champ.Abilities[3].Image;
abilityname4.Text = champ.Abilities[3].Name;
//Debug.WriteLine(champ.Abilities[3].Image);
abilitydesc4.Text = champ.Abilities[3].Description;
abilityimage5.Source = champ.Abilities[4].Image;
abilityname5.Text = champ.Abilities[4].Name;
abilitydesc5.Text = champ.Abilities[4].Description;
}
} }
void LoginClick(object sender, EventArgs e)
{
}
} }

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LOLAPP.View.Register" x:Class="LOLAPP.View.Register"
Title="Register"> Title="Register">
<VerticalStackLayout> <StackLayout>
<Label <Label Text="Username" />
Text="Welcome to .NET MAUI!" <Entry x:Name="usernameEntry" />
VerticalOptions="Center" <Label Text="Password" />
HorizontalOptions="Center" /> <Entry x:Name="passwordEntry" IsPassword="True" />
</VerticalStackLayout> <Button Text="Enregistrer" Clicked="EnregistrerUtilisateur_Clicked" />
</StackLayout>
</ContentPage> </ContentPage>

@ -1,9 +1,35 @@
using Models;
using System.Diagnostics;
namespace LOLAPP.View; namespace LOLAPP.View;
public partial class Register : ContentPage public partial class Register : ContentPage
{ {
public Register() public Manager Mgr => (App.Current as App).MyManager;
public Register()
{ {
InitializeComponent(); InitializeComponent();
BindingContext= Mgr;
} }
private void EnregistrerUtilisateur_Clicked(object sender, EventArgs e)
{
string username = usernameEntry.Text;
string password = passwordEntry.Text;
if (Mgr._utilisateur.Any(u => u.Username == username))
{
DisplayAlert("Erreur", "Cet utilisateur existe déjà", "OK");
return;
}
Utilisateur utilisateur = new Utilisateur(username, password);
Mgr.AddUtilisateur(utilisateur);
Mgr.Sauvdon();
DisplayAlert("Succès", "Utilisateur enregistré avec succès", "OK");
usernameEntry.Text = "";
passwordEntry.Text = "";
}
} }

@ -1,12 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LOLAPP.View.Strat" x:Class="LOLAPP.View.Strat"
Title="Strat"> Title="Strat">
<VerticalStackLayout> <StackLayout BackgroundColor="DarkGrey">
<Label <Grid>
Text="Welcome to .NET MAUI!" <Grid.ColumnDefinitions>
VerticalOptions="Center" <ColumnDefinition Width="*" />
HorizontalOptions="Center" /> <ColumnDefinition Width="*" />
</VerticalStackLayout> </Grid.ColumnDefinitions>
<ListView x:Name="stratListView"
Grid.Column="0"
ItemsSource="{Binding StratList}"
/>
<!-- SelectedItemChanged="StratListView_OnItemSelected"-->
<StackLayout x:Name="detailsLayout"
Grid.Column="1">
<Label x:Name="nameLabel"
FontSize="Large" />
<StackLayout x:Name="championsLayout"
Orientation="Horizontal" />
<Label x:Name="descriptionLabel" />
</StackLayout>
</Grid>
</StackLayout>
</ContentPage> </ContentPage>

@ -1,9 +1,46 @@
namespace LOLAPP.View; using Models;
using System.Diagnostics;
public partial class Strat : ContentPage namespace LOLAPP.View
{ {
public Strat() public partial class Strat : ContentPage
{ {
InitializeComponent(); public List<Strategie> StratList { get; set; }
} public Manager Mgr => (App.Current as App).MyManager;
} public Strat()
{
InitializeComponent();
// Initialisez la liste des stratégies
StratList = Mgr.UtilisateurConnecte._strat;
// Liez la liste des stratégies à la ListView
// stratListView.ItemsSource = StratList;
}
/* private void StratListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem is Strategie selectedStrat)
{
UpdateDetails(selectedStrat);
}
}
private void UpdateDetails(Strategie strat)
{
nameLabel.Text = strat.Name;
championsLayout.Children.Clear();
foreach (var champion in strat.Champions.Take(5))
{
var image = new Image
{
Source = champion.Image
};
championsLayout.Children.Add(image);
}
descriptionLabel.Text = strat.Description;
}*/
}
}

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Models
{ {
[DataContract] [DataContract]
public class Ability public class Ability
@ -15,7 +15,7 @@ namespace LOLAPP.Modele
[DataMember] [DataMember]
public string Image { get; private set; } public string Image { get; private set; }
[DataMember] [DataMember]
public string Description { get; private set; } public string Description { get; private set; }
public Ability(string name,string image,string description) public Ability(string name,string image,string description)
{ {

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Models
{ {
[DataContract] [DataContract]
public class Champion public class Champion
@ -21,15 +21,15 @@ namespace LOLAPP.Modele
public Champion(string name,string titre,string image, List<Ability> abilities) public Champion(string name,string titre,string image, List<Ability> abilities)
{ {
// Le constructeur de la classe Champion initialise le nom et les abilités du champion. // Le constructeur de la classe Champion initialise le nom le titre le nom de l'image et les abilités du champion.
Name = name; Name = name;
Titre = titre; Titre = titre;
Image = image; Image = image;
Abilities = abilities; Abilities = new List<Ability>(abilities);
} }
public Champion(string name, string titre, string image) public Champion(string name, string titre, string image)
{ {
// Le constructeur de la classe Champion initialise le nom et les abilités du champion. // Le constructeur de la classe Champion initialise le nom le titre et le nom de l'image du champion.
Name = name; Name = name;
Titre = titre; Titre = titre;
Image = image; Image = image;

@ -1,10 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Models
{ {
public interface IPersistanceManager public interface IPersistanceManager
{ {

@ -6,13 +6,14 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq; using System.Xml.Linq;
namespace LOLAPP.Modele namespace Models
{ {
public class Manager public class Manager
{ {
public List<Champion> _champions { get; set; } public List<Champion> _champions { get; private set; }
public List<Utilisateur> _utilisateur { get; set; } public List<Utilisateur> _utilisateur { get; private set; }
public IPersistanceManager Persistance { get; set; } public IPersistanceManager Persistance { get; set; }
public Utilisateur UtilisateurConnecte { get; set; } = null; //rajouté pour login register
public Manager(IPersistanceManager Pers) public Manager(IPersistanceManager Pers)
{ {
@ -40,7 +41,7 @@ namespace LOLAPP.Modele
public void Chargdon() { public void Chargdon() {
var don = Persistance.Chargdon(); var don = Persistance.Chargdon();
_champions.AddRange(don.Item1); _champions.AddRange(don.Item1);
_utilisateur.AddRange(don.Item2); _utilisateur.AddRange(don.Item2);
} }

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Models
{ {
[DataContract] [DataContract]
public class Strategie public class Strategie

@ -5,7 +5,7 @@ using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Models
{ {
[DataContract] [DataContract]
public class Utilisateur public class Utilisateur

@ -1,10 +1,11 @@
using System; using Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LOLAPP.Modele namespace Stub
{ {
public class Stub : IPersistanceManager public class Stub : IPersistanceManager
{ {
@ -15,11 +16,11 @@ namespace LOLAPP.Modele
List<Champion> c = new List<Champion>(); List<Champion> c = new List<Champion>();
List<Ability> a = new List<Ability>(); List<Ability> a = new List<Ability>();
Ability c1a1 = new Ability("Runic Blade", "runicblade.jpg", "Riven's abilities charge her blade, and her basic attacks expend charges to deal an additional damage."); Ability c1a1 = new Ability("Runic Blade", "runicblade.png", "Riven's abilities charge her blade, and her basic attacks expend charges to deal an additional damage.");
Ability c1a2 = new Ability("Broken Wings", "brokenwings.jpg", "Riven lashes out in a series of strikes. This ability can be reactivated three times in a short time frame with the third hit knocking back nearby enemies."); Ability c1a2 = new Ability("Broken Wings", "brokenwings.png", "Riven lashes out in a series of strikes. This ability can be reactivated three times in a short time frame with the third hit knocking back nearby enemies.");
Ability c1a3 = new Ability("Ki Burst", "kiburst.jpg", "Riven emits a Ki Burst, damaging and stunning nearby enemies."); Ability c1a3 = new Ability("Ki Burst", "kiburst.png", "Riven emits a Ki Burst, damaging and stunning nearby enemies.");
Ability c1a4 = new Ability("Valor", "valor.jpg", "Riven steps forward a short distance and blocks incoming damage."); Ability c1a4 = new Ability("Valor", "valor.png", "Riven steps forward a short distance and blocks incoming damage.");
Ability c1a5 = new Ability("Blade of the Exile", "bladeoftheexile.jpg", "Riven empowers her keepsake weapon with energy, and gains Attack Damage and Range. During this time, she also gains the ability to use Wind Slash, a powerful ranged attack, once."); Ability c1a5 = new Ability("Blade of the Exile", "bladeoftheexile.png", "Riven empowers her keepsake weapon with energy, and gains Attack Damage and Range. During this time, she also gains the ability to use Wind Slash, a powerful ranged attack, once.");
a.Add(c1a1); a.Add(c1a1);
a.Add(c1a2); a.Add(c1a2);
a.Add(c1a3); a.Add(c1a3);
@ -29,11 +30,11 @@ namespace LOLAPP.Modele
c.Add(c1); c.Add(c1);
a.Clear(); a.Clear();
Ability c2a1 = new Ability("Rage Gene", "ragegene.jpg", "While in combat Gnar generates Rage. At maximum Rage his next ability will transform him into Mega Gnar, granting increased survivability and access to new spells."); Ability c2a1 = new Ability("Rage Gene", "ragegene.png", "While in combat Gnar generates Rage. At maximum Rage his next ability will transform him into Mega Gnar, granting increased survivability and access to new spells.");
Ability c2a2 = new Ability("Boomerang Throw / Boulder Toss", "boomerangthrow.jpg", "Gnar throws a boomerang that damages and slows enemies it hits before returning to him. If he catches the boomerang its cooldown is reduced.\r\n\r\nMega Gnar instead throws a boulder that stops on the first unit hit, damaging and slowing everything nearby. It can then be picked up to reduce the cooldown."); Ability c2a2 = new Ability("Boomerang Throw / Boulder Toss", "boomerangthrow.png", "Gnar throws a boomerang that damages and slows enemies it hits before returning to him. If he catches the boomerang its cooldown is reduced.\r\n\r\nMega Gnar instead throws a boulder that stops on the first unit hit, damaging and slowing everything nearby. It can then be picked up to reduce the cooldown.");
Ability c2a3 = new Ability("Hyper / Wallop", "hyper.jpg", "Gnar's attacks and spells hype him up, dealing bonus damage and granting him Movement Speed.\r\n\r\nMega Gnar is too enraged to be hyper and instead can rear up on his hind legs and smash down on the area in front of him, stunning enemies in an area."); Ability c2a3 = new Ability("Hyper / Wallop", "hyper.png", "Gnar's attacks and spells hype him up, dealing bonus damage and granting him Movement Speed.\r\n\r\nMega Gnar is too enraged to be hyper and instead can rear up on his hind legs and smash down on the area in front of him, stunning enemies in an area.");
Ability c2a4 = new Ability("Hop / Crunch", "hop.jpg", "Gnar leaps to a location and bounces off the head of any unit he lands on, traveling further.\r\n\r\nMega Gnar is too large to bounce and instead lands with earth-shattering force, dealing damage in an area around him."); Ability c2a4 = new Ability("Hop / Crunch", "hop.png", "Gnar leaps to a location and bounces off the head of any unit he lands on, traveling further.\r\n\r\nMega Gnar is too large to bounce and instead lands with earth-shattering force, dealing damage in an area around him.");
Ability c2a5 = new Ability("GNAR!", "gnarr.jpg", "Mega Gnar throws everything around him in a chosen direction, dealing damage and slowing them. Any enemy that hits a wall is stunned and takes bonus damage."); Ability c2a5 = new Ability("GNAR!", "gnarr.png", "Mega Gnar throws everything around him in a chosen direction, dealing damage and slowing them. Any enemy that hits a wall is stunned and takes bonus damage.");
a.Add(c2a1); a.Add(c2a1);
a.Add(c2a2); a.Add(c2a2);
a.Add(c2a3); a.Add(c2a3);
@ -43,25 +44,25 @@ namespace LOLAPP.Modele
c.Add(c2); c.Add(c2);
a.Clear(); a.Clear();
Ability c3a1 = new Ability("Daredevil Impulse", "daredevilimpulse.jpg", "Samira builds a combo by hitting attacks or abilities unique from the previous hit. Samira's attacks in melee range deal additional magic damage. Samira's attacks against enemies affected by Immobilizing effects will dash her to her attack range. If the enemy is Knocked Up, she also keeps them Knocked Up briefly."); Ability c3a1 = new Ability("Daredevil Impulse", "daredevilimpulse.png", "Samira builds a combo by hitting attacks or abilities unique from the previous hit. Samira's attacks in melee range deal additional magic damage. Samira's attacks against enemies affected by Immobilizing effects will dash her to her attack range. If the enemy is Knocked Up, she also keeps them Knocked Up briefly.");
Ability c3a2 = new Ability("Flair", "flair.jpg", "Samira fires a shot or swings her sword, dealing damage. If cast during Wild Rush, strike all enemies in her path upon completion."); Ability c3a2 = new Ability("Flair", "flair.png", "Samira fires a shot or swings her sword, dealing damage. If cast during Wild Rush, strike all enemies in her path upon completion.");
Ability c3a3 = new Ability("Blade Whirl", "bladewhirl.jpg", "Samira slashes around her, damaging enemies and destroying enemy missiles."); Ability c3a3 = new Ability("Blade Whirl", "bladewhirl.png", "Samira slashes around her, damaging enemies and destroying enemy missiles.");
Ability c3a4 = new Ability("Wild Rush", "wildrush.jpg", "Samira dashes through an enemy (including structures), slashing enemies she passes through and gaining Attack Speed. Killing an enemy champion refreshes this ability's cooldown."); Ability c3a4 = new Ability("Wild Rush", "wildrush.png", "Samira dashes through an enemy (including structures), slashing enemies she passes through and gaining Attack Speed. Killing an enemy champion refreshes this ability's cooldown.");
Ability c3a5 = new Ability("Inferno Trigger", "infernotrigger.jpg", "Samira unleashes a torrent of shots from her weapons, wildly shooting all enemies surrounding her."); Ability c3a5 = new Ability("Inferno Trigger", "infernotrigger.png", "Samira unleashes a torrent of shots from her weapons, wildly shooting all enemies surrounding her.");
a.Add(c1a1); a.Add(c3a1);
a.Add(c1a2); a.Add(c3a2);
a.Add(c1a3); a.Add(c3a3);
a.Add(c1a4); a.Add(c3a4);
a.Add(c1a5); a.Add(c3a5);
Champion c3 = new Champion("Samira", "The Desert Rose", "samira.jpg", a); Champion c3 = new Champion("Samira", "The Desert Rose", "samira.jpg", a);
c.Add(c3); c.Add(c3);
a.Clear(); a.Clear();
Ability c4a1 = new Ability("Bop 'n' Block", "bopnblock.jpg", "Periodically, when Yuumi attacks a champion, she restores mana and gains a shield that follows her, protecting her and the ally she's attached to."); Ability c4a1 = new Ability("Bop 'n' Block", "bopnblock.png", "Periodically, when Yuumi attacks a champion, she restores mana and gains a shield that follows her, protecting her and the ally she's attached to.");
Ability c4a2 = new Ability("Prowling Projectile", "prowlingprojectile.jpg", "Yuumi fires a missile, dealing damage to the first target hit. It deals bonus damage and slows if it takes at least 1 second to get to its target.\r\n\r\nWhile Attached, the missile can be controlled with your cursor."); Ability c4a2 = new Ability("Prowling Projectile", "prowlingprojectile.png", "Yuumi fires a missile, dealing damage to the first target hit. It deals bonus damage and slows if it takes at least 1 second to get to its target.\r\n\r\nWhile Attached, the missile can be controlled with your cursor.");
Ability c4a3 = new Ability("You and Me!", "youandme.jpg", "Passively, Yuumi increases her ally's Adaptive Force and her own. Actively, Yuumi dashes to a target ally, becoming untargetable from everything except turrets."); Ability c4a3 = new Ability("You and Me!", "youandme.png", "Passively, Yuumi increases her ally's Adaptive Force and her own. Actively, Yuumi dashes to a target ally, becoming untargetable from everything except turrets.");
Ability c4a4 = new Ability("Zoomies", "zoomies.jpg", "Heals Yuumi and boosts Movement Speed and Attack Speed. If she's attached, she passes it to her ally instead."); Ability c4a4 = new Ability("Zoomies", "zoomies.png", "Heals Yuumi and boosts Movement Speed and Attack Speed. If she's attached, she passes it to her ally instead.");
Ability c4a5 = new Ability("Final Chapter", "finalchapter.jpg", "Yuumi channels seven waves of damage, rooting anyone hit by three or more. Yuumi can move, attach, and cast Zoomies! while channeling."); Ability c4a5 = new Ability("Final Chapter", "finalchapter.png", "Yuumi channels seven waves of damage, rooting anyone hit by three or more. Yuumi can move, attach, and cast Zoomies! while channeling.");
a.Add(c4a1); a.Add(c4a1);
a.Add(c4a2); a.Add(c4a2);
a.Add(c4a3); a.Add(c4a3);
@ -71,11 +72,11 @@ namespace LOLAPP.Modele
c.Add(c4); c.Add(c4);
a.Clear(); a.Clear();
Ability c5a1 = new Ability("The Relentless Storm", "therelentlessstorm.jpg", "Riven's abilities charge her blade, and her basic attacks expend charges to deal an additional damage."); Ability c5a1 = new Ability("The Relentless Storm", "therelentlessstorm.png", "Riven's abilities charge her blade, and her basic attacks expend charges to deal an additional damage.");
Ability c5a2 = new Ability("Thundering Smash", "thunderingsmash.jpg", "Riven lashes out in a series of strikes. This ability can be reactivated three times in a short time frame with the third hit knocking back nearby enemies."); Ability c5a2 = new Ability("Thundering Smash", "thunderingsmash.png", "Riven lashes out in a series of strikes. This ability can be reactivated three times in a short time frame with the third hit knocking back nearby enemies.");
Ability c5a3 = new Ability("Frenzied Maul", "frenziedmaul.jpg", "Riven emits a Ki Burst, damaging and stunning nearby enemies."); Ability c5a3 = new Ability("Frenzied Maul", "frenziedmaul.png", "Riven emits a Ki Burst, damaging and stunning nearby enemies.");
Ability c5a4 = new Ability("Sky Splitter", "skysplitter.jpg", "Riven steps forward a short distance and blocks incoming damage."); Ability c5a4 = new Ability("Sky Splitter", "skysplitter.png", "Riven steps forward a short distance and blocks incoming damage.");
Ability c5a5 = new Ability("Stormbringer", "stormbringer.jpg", "Riven empowers her keepsake weapon with energy, and gains Attack Damage and Range. During this time, she also gains the ability to use Wind Slash, a powerful ranged attack, once."); Ability c5a5 = new Ability("Stormbringer", "stormbringer.png", "Riven empowers her keepsake weapon with energy, and gains Attack Damage and Range. During this time, she also gains the ability to use Wind Slash, a powerful ranged attack, once.");
a.Add(c5a1); a.Add(c5a1);
a.Add(c5a2); a.Add(c5a2);
a.Add(c5a3); a.Add(c5a3);

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>
</Project>
Loading…
Cancel
Save