pull/99/head
commit
6aa9e768e9
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 846 KiB |
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="Trek_12.Views.PageBoard"
|
||||||
|
Title="Board"
|
||||||
|
BackgroundColor="Bisque">
|
||||||
|
|
||||||
|
<Grid RowDefinitions="*,auto" ColumnDefinitions="*,auto">
|
||||||
|
<Image Source="maptest.png" Aspect="AspectFit" Grid.ColumnSpan="2" Grid.RowSpan="3"/>
|
||||||
|
|
||||||
|
<CollectionView ItemsSource="{Binding ListMap[0].Boards}"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
SelectionMode="Single"
|
||||||
|
WidthRequest="350"
|
||||||
|
HeightRequest="350"
|
||||||
|
ItemsLayout="VerticalGrid,7"
|
||||||
|
BackgroundColor="Aqua">
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="50" WidthRequest="50">
|
||||||
|
|
||||||
|
<Frame
|
||||||
|
IsVisible="{Binding Valid}"
|
||||||
|
BorderColor="DarkGray"
|
||||||
|
CornerRadius="25"
|
||||||
|
HeightRequest="50"
|
||||||
|
WidthRequest="50"
|
||||||
|
BackgroundColor="White"
|
||||||
|
Opacity="0.7"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
Padding="0">
|
||||||
|
<Frame.Triggers>
|
||||||
|
<DataTrigger TargetType="Frame" Binding="{Binding IsDangerous}" Value="True">
|
||||||
|
<Setter Property="BorderColor" Value="Black"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger TargetType="Frame" Binding="{Binding IsDangerous}" Value="False">
|
||||||
|
<Setter Property="BorderColor" Value="Transparent"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Frame.Triggers>
|
||||||
|
</Frame>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
|
||||||
|
<!-- Operation Grid -->
|
||||||
|
<CollectionView Grid.Row="0" Grid.Column="1"
|
||||||
|
ItemsSource="{Binding ListMap[0].OperationGrid}"
|
||||||
|
ItemsLayout="VerticalGrid,4"
|
||||||
|
WidthRequest="200"
|
||||||
|
HeightRequest="250"
|
||||||
|
BackgroundColor="Transparent"
|
||||||
|
SelectionChanged="OnOperationCellSelected"
|
||||||
|
Margin="50">
|
||||||
|
<CollectionView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Frame HasShadow="True"
|
||||||
|
BorderColor="Black"
|
||||||
|
BackgroundColor="Transparent"
|
||||||
|
CornerRadius="0"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HeightRequest="50"
|
||||||
|
WidthRequest="50"
|
||||||
|
Padding="0">
|
||||||
|
<Image Source="checked.png"
|
||||||
|
IsVisible="{Binding IsChecked}"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center"/>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
</CollectionView.ItemTemplate>
|
||||||
|
</CollectionView>
|
||||||
|
</Grid>
|
||||||
|
</ContentPage>
|
@ -0,0 +1,32 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Trek_12.Views;
|
||||||
|
|
||||||
|
using Models.Game;
|
||||||
|
using Stub;
|
||||||
|
|
||||||
|
public partial class PageBoard : ContentPage
|
||||||
|
{
|
||||||
|
public Stub MyStub { get; set; } = new Stub();
|
||||||
|
|
||||||
|
public PageBoard()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
BindingContext = MyStub;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnOperationCellSelected(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine("OnOperationCellSelected"); // Debug
|
||||||
|
if (e.CurrentSelection.Count > 0) // Si un élément est sélectionné
|
||||||
|
{
|
||||||
|
var selectedCell = (OperationCell)e.CurrentSelection[0];
|
||||||
|
if (selectedCell != null && !selectedCell.IsChecked)
|
||||||
|
{
|
||||||
|
selectedCell.Check();
|
||||||
|
Debug.WriteLine("OperationCell at ({0}, {1}) is checked", selectedCell.X, selectedCell.Y); // Debug
|
||||||
|
}
|
||||||
|
((CollectionView)sender).SelectedItem = null; // Déselectionne l'élément pour la CollectionView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue