JUST SWITTCH ADD PLAYER TO LIST OF STRING AND CHECK COUNT AND JUST VERIFY ! GOOD NIGHT

test_old_branch
Jérémy Mouyon 11 months ago
parent c5027304b0
commit 8d0a6f5814

@ -1,6 +1,7 @@
using Qwirkle.Views;
using Microsoft.Maui.Controls;
using Qwirkle.Pages;
using QwirkleClassLibrary.Games;
namespace Qwirkle
{
@ -13,6 +14,9 @@ namespace Qwirkle
MainPage = new AppShell();
Routing.RegisterRoute(nameof(SetPlayers), typeof(SetPlayers));
}
public Game Game { get; set; } = new();
}
}

@ -22,19 +22,19 @@
<controls:ButtonShadow
Text="{Binding Button1.Text}"
Text="Play"
InfoClicked="OnInfoClicked"
/>
<!-- <controls:ButtonShadow Text="{Binding button2.Text}"/> -->
<controls:ButtonShadow Text="{Binding Button3.Text} "/>
<controls:ButtonShadow Text="Leaderboard"/>
<controls:ButtonShadow Text="{Binding Button4.Text}"/>
<controls:ButtonShadow Text="Rules"/>
<controls:ButtonShadow Text="{Binding Button5.Text}"/>
<controls:ButtonShadow Text="Settings"/>
<controls:ButtonShadow Text="{Binding Button6.Text}"/>
<controls:ButtonShadow Text="Credits"/>
</VerticalStackLayout>

@ -15,46 +15,8 @@ namespace Qwirkle
BindingContext = this;
}
public ButtonShadow Button1 { get; set; }
= new ButtonShadow
{
Text = "Play"
};
public ButtonShadow Button2 { get; set; }
= new ButtonShadow
{
Text = "Continue"
};
public ButtonShadow Button3 { get; set; }
= new ButtonShadow
{
Text = "Leaderboard"
};
public ButtonShadow Button4 { get; set; }
= new ButtonShadow
{
Text = "Rules"
};
public ButtonShadow Button5 { get; set; }
= new ButtonShadow
{
Text = "Settings"
};
public ButtonShadow Button6 { get; set; }
= new ButtonShadow
{
Text = "Credits"
};
void OnInfoClicked(object sender, EventArgs e)
public void OnInfoClicked(object sender, EventArgs e)
{
Game game = new Game();
DisplayAlert("Game notification", "Enter minimun 2 player and max 4 player !", "Ok ! Lets's go !");
Navigation.PushAsync(new SetPlayers());

@ -6,6 +6,7 @@ namespace Qwirkle
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
@ -19,6 +20,7 @@ namespace Qwirkle
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}

@ -11,17 +11,13 @@
Text="SetPlayers"
Style="{StaticResource Title}"/>
<controls:EntryPlayer TextIn="{Binding Entry1.TextIn}"
TextOn="{Binding Entry1.TextOn}"/>
<controls:EntryPlayer TextIn="{Binding Entry2.TextIn}"
TextOn="{Binding Entry2.TextOn}"/>
<controls:EntryPlayer Entry="{Binding Entry1}"/>
<controls:EntryPlayer TextIn="{Binding Entry3.TextIn}"
TextOn="{Binding Entry3.TextOn}"/>
<controls:EntryPlayer Entry="{Binding Entry2}"/>
<controls:EntryPlayer TextIn="{Binding Entry4.TextIn}"
TextOn="{Binding Entry4.TextOn}"/>
<controls:EntryPlayer Entry="{Binding Entry3}"/>
<controls:EntryPlayer Entry="{Binding Entry4}"/>
<Button Text="Confirm"

@ -5,42 +5,61 @@ namespace Qwirkle.Pages;
public partial class SetPlayers : ContentPage
{
public SetPlayers()
private Game game = ((App)App.Current!).Game;
public SetPlayers()
{
InitializeComponent();
BindingContext = this;
}
public EntryPlayer Entry1 { get; set; }
= new EntryPlayer
{
TextOn = "Player 1",
TextIn = "Entry tag of player 1"
TextHolder = "Entry tag of player 1"
};
public EntryPlayer Entry2 { get; set; }
= new EntryPlayer
{
TextOn = "Player 2",
TextIn = "Entry tag of player 2"
TextHolder = "Entry tag of player 2"
};
public EntryPlayer Entry3 { get; set; }
= new EntryPlayer
{
TextOn = "Player 3",
TextIn = "Entry tag of player 3"
TextHolder = "Entry tag of player 3"
};
public EntryPlayer Entry4 { get; set; }
= new EntryPlayer
{
TextOn = "Player 4",
TextIn = "Entry tag of player 4"
TextHolder = "Entry tag of player 4"
};
void OnButtonContinueClick(object sender, EventArgs e)
{
string entry1 = Entry1.TextIn;
DisplayAlert("Game notification", entry1, "Ok ! Lets's go !");
game.PlayerAddNotified += Game_PlayerAddNotified;
string entry1 = Entry1.TextIn!;
string entry2 = Entry2.TextIn!;
string entry3 = Entry3.TextIn!;
string entry4 = Entry4.TextIn!;
DisplayAlert("Game notification", entry1 + "\n" + entry2 + "\n" + entry3 + "\n" + entry4, "Ok ! Lets's go !");
game.AddPlayerInGame(entry1);
game.AddPlayerInGame(entry2);
game.AddPlayerInGame(entry3);
game.AddPlayerInGame(entry4);
}
private void Game_PlayerAddNotified(object? sender, QwirkleClassLibrary.Events.AddPlayerNotifiedEventArgs args)
{
DisplayAlert("Game notification", args.ReturnedNotified, "Ok ! Lets's go !");
}
}

@ -153,7 +153,7 @@
<Setter Property="FontFamily" Value="Lexend-Meduim"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="HorizontalOptions" Value="Start" />
<Setter Property="PlaceholderColor" Value="Red" />
<Setter Property="PlaceholderColor" Value="DarkGrey" />
<Setter Property="MinimumHeightRequest" Value="44"/>
<Setter Property="MinimumWidthRequest" Value="200"/>
<Setter Property="Margin" Value="10"/>

@ -5,9 +5,9 @@
x:Name="root">
<VerticalStackLayout Padding="10">
<Label
Text="{Binding TextOn, Source={x:Reference root}}"
Text="{Binding Entry.TextOn, Source={x:Reference root}}"
Style="{StaticResource ContentStart}"/>
<Entry Text="{Binding TextIn, Source={x:Reference root}}"/>
<Entry Text="{Binding Entry.TextIn, Source={x:Reference root}, Mode=OneWayToSource}" Placeholder="{Binding Entry.TextHolder, Source={x:Reference root}}"/>
</VerticalStackLayout>
</ContentView>

@ -2,26 +2,26 @@ namespace Qwirkle.Views;
using Microsoft.Maui.Controls;
public partial class EntryPlayer : ContentView
{
public static readonly BindableProperty EntryProperty = BindableProperty.Create("Entry", typeof(EntryPlayer), typeof(object));
public EntryPlayer Entry
{
get => (EntryPlayer)GetValue(EntryProperty);
set => SetValue(EntryProperty, value);
}
public EntryPlayer()
{
InitializeComponent();
}
public static readonly BindableProperty TextInProperty =
BindableProperty.Create("TextIn", typeof(string), typeof(Button), "none");
public string TextIn
{
get => (string)GetValue(TextInProperty);
set => SetValue(TextInProperty, value);
}
public string TextHolder { get; set; } = "None";
public string TextOn { get; set; } = "None";
public string? TextIn { get; set; }
public static readonly BindableProperty TextOnProperty =
BindableProperty.Create("TextOn", typeof(string), typeof(Button), "none");
public string TextOn
{
get => (string)GetValue(TextOnProperty);
set => SetValue(TextOnProperty, value);
}
}
Loading…
Cancel
Save