Persistance
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
9afc65ddb1
commit
ac558fddf0
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="MauiSpark.Views.CTableauScore">
|
||||||
|
<ListView ItemsSource="{Binding}">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<Frame CornerRadius="5" Padding="0" VerticalOptions="Start" Margin="20,0,20,10" >
|
||||||
|
<Grid ColumnDefinitions="auto,*,auto,auto,auto,auto">
|
||||||
|
<Label Grid.Column="0" Text="{Binding Place}" Margin="20,20,20,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
<Label Grid.Column="1" Text="{Binding Joueur.Nom}" Margin="55,20,20,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
<Label Grid.Column="2" Text="{Binding NbCoutMoyen}" Margin="20,20,100,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
<Label Grid.Column="3" Text="{Binding Joueur.NbPartieGagnee}" Margin="55,20,100,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
<Label Grid.Column="4" Text="{Binding Joueur.NbPartiePerdue}" Margin="55,20,100,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
<Label Grid.Column="5" Text="{Binding Joueur.NbPartieEgalite}" Margin="55,20,100,20" Style="{StaticResource TexteFrame}" />
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</ContentView>
|
@ -0,0 +1,245 @@
|
|||||||
|
using CoreLibrary.Events;
|
||||||
|
using CoreLibrary.Joueurs;
|
||||||
|
using CoreLibrary.Manager;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace MauiSpark.Views;
|
||||||
|
|
||||||
|
public class JoueurClassementNbCoupParPartie
|
||||||
|
{
|
||||||
|
private Manager manager;
|
||||||
|
private Joueur joueur;
|
||||||
|
|
||||||
|
public Joueur Joueur
|
||||||
|
{
|
||||||
|
get => joueur;
|
||||||
|
private set => joueur = value;
|
||||||
|
}
|
||||||
|
public int Place
|
||||||
|
{
|
||||||
|
get => manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbCoutTotal/(joueur.NbPartiePerdue+joueur.NbPartieGagnee+joueur.NbPartieEgalite)).ToList()
|
||||||
|
.IndexOf(Joueur) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbCoutMoyen => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite);
|
||||||
|
|
||||||
|
public JoueurClassementNbCoupParPartie(Joueur joueur, Manager manager)
|
||||||
|
{
|
||||||
|
this.manager = manager;
|
||||||
|
this.joueur = joueur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JoueurClassementPartieGagnee
|
||||||
|
{
|
||||||
|
private Manager manager;
|
||||||
|
private Joueur joueur;
|
||||||
|
|
||||||
|
public Joueur Joueur
|
||||||
|
{
|
||||||
|
get => joueur;
|
||||||
|
private set => joueur = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Place
|
||||||
|
{
|
||||||
|
get => manager.Joueurs.OrderByDescending(joueur => joueur.NbPartieGagnee).ToList().IndexOf(Joueur) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbCoutMoyen => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite);
|
||||||
|
|
||||||
|
public JoueurClassementPartieGagnee(Joueur joueur, Manager manager)
|
||||||
|
{
|
||||||
|
this.manager = manager;
|
||||||
|
this.joueur = joueur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JoueurClassementPartieEgalite
|
||||||
|
{
|
||||||
|
private Manager manager;
|
||||||
|
private Joueur joueur;
|
||||||
|
|
||||||
|
public Joueur Joueur
|
||||||
|
{
|
||||||
|
get => joueur;
|
||||||
|
private set => joueur = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Place
|
||||||
|
{
|
||||||
|
get => manager.Joueurs.OrderByDescending(joueur => joueur.NbPartieEgalite).ToList().IndexOf(joueur)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbCoutMoyen => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite);
|
||||||
|
|
||||||
|
public JoueurClassementPartieEgalite(Joueur joueur, Manager manager)
|
||||||
|
{
|
||||||
|
this.manager = manager;
|
||||||
|
this.joueur = joueur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JoueurClassementPartiePerdue
|
||||||
|
{
|
||||||
|
private Manager manager;
|
||||||
|
private Joueur joueur;
|
||||||
|
|
||||||
|
public Joueur Joueur
|
||||||
|
{
|
||||||
|
get => joueur;
|
||||||
|
private set => joueur = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Place
|
||||||
|
{
|
||||||
|
get => manager.Joueurs.OrderByDescending(joueur => joueur.NbPartiePerdue).ToList().IndexOf(joueur)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbCoutMoyen => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite);
|
||||||
|
|
||||||
|
public JoueurClassementPartiePerdue(Joueur joueur, Manager manager)
|
||||||
|
{
|
||||||
|
this.manager = manager;
|
||||||
|
this.joueur = joueur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JoueurClassementAlphabet
|
||||||
|
{
|
||||||
|
private Manager manager;
|
||||||
|
private Joueur joueur;
|
||||||
|
|
||||||
|
public Joueur Joueur
|
||||||
|
{
|
||||||
|
get => joueur;
|
||||||
|
private set => joueur = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Place
|
||||||
|
{
|
||||||
|
get => manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite)).ToList()
|
||||||
|
.IndexOf(Joueur) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbCoutMoyen => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite);
|
||||||
|
|
||||||
|
public JoueurClassementAlphabet(Joueur joueur, Manager manager)
|
||||||
|
{
|
||||||
|
this.manager = manager;
|
||||||
|
this.joueur = joueur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class CTableauScore : ContentView
|
||||||
|
{
|
||||||
|
public int NbCliquer { get; set; } = 0;
|
||||||
|
|
||||||
|
public IEnumerable<JoueurClassementNbCoupParPartie> GetClassementNbCoupParPartie()
|
||||||
|
{
|
||||||
|
if(NbCliquer % 2 == 0)
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite))
|
||||||
|
.Select(joueur => new JoueurClassementNbCoupParPartie(joueur, MauiProgram.Manager));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderByDescending(joueur => joueur.NbCoutTotal / (joueur.NbPartiePerdue + joueur.NbPartieGagnee + joueur.NbPartieEgalite))
|
||||||
|
.Select(joueur => new JoueurClassementNbCoupParPartie(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<JoueurClassementPartieGagnee> GetClassementPartieGagnee()
|
||||||
|
{
|
||||||
|
if(NbCliquer % 2 == 0)
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderByDescending(joueur => joueur.NbPartieGagnee)
|
||||||
|
.Select(joueur => new JoueurClassementPartieGagnee(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbPartieGagnee)
|
||||||
|
.Select(joueur => new JoueurClassementPartieGagnee(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<JoueurClassementPartieEgalite> GetClassementPartieEgalite()
|
||||||
|
{
|
||||||
|
if(NbCliquer % 2 == 0)
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderByDescending(joueur => joueur.NbPartieEgalite)
|
||||||
|
.Select(joueur => new JoueurClassementPartieEgalite(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbPartieEgalite)
|
||||||
|
.Select(joueur => new JoueurClassementPartieEgalite(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<JoueurClassementPartiePerdue> GetClassementPartiePerdue()
|
||||||
|
{
|
||||||
|
if(NbCliquer % 2 == 0)
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderByDescending(joueur => joueur.NbPartiePerdue)
|
||||||
|
.Select(joueur => new JoueurClassementPartiePerdue(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
; return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.NbPartiePerdue)
|
||||||
|
.Select(joueur => new JoueurClassementPartiePerdue(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<JoueurClassementAlphabet> GetClassementAlphabet()
|
||||||
|
{
|
||||||
|
if(NbCliquer % 2 == 0)
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderBy(joueur => joueur.Nom)
|
||||||
|
.Select(joueur => new JoueurClassementAlphabet(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NbCliquer++;
|
||||||
|
return MauiProgram.Manager.Joueurs
|
||||||
|
.OrderByDescending(joueur => joueur.Nom)
|
||||||
|
.Select(joueur => new JoueurClassementAlphabet(joueur, MauiProgram.Manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public CTableauScore()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateClassement(Func<IEnumerable<object>> getClassement)
|
||||||
|
{
|
||||||
|
BindingContext = getClassement();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="MauiSpark.Views.UsernameEntryView">
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
Margin="0, 50"
|
||||||
|
ColumnDefinitions="auto, *, 8*, *"
|
||||||
|
RowDefinitions="auto">
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Text="Joueur X"
|
||||||
|
FontSize="Large"
|
||||||
|
Margin="50, 0, 0, 0"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="Center"/>
|
||||||
|
|
||||||
|
<Entry
|
||||||
|
Grid.Column="2"
|
||||||
|
FontSize="Medium"
|
||||||
|
Margin="50, 0"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</ContentView>
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace MauiSpark.Views;
|
||||||
|
|
||||||
|
public partial class UsernameEntryView : ContentView
|
||||||
|
{
|
||||||
|
public UsernameEntryView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue