Created
June 2, 2018 13:11
-
-
Save meron1122/bb2bee5136c15b86eb21837ee0a684a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace StrategoGUI | |
{ | |
public class GameField | |
{ | |
public Players Player { get; set; } = Players.Nobody; | |
public GameField(CellLocation location) | |
{ | |
Location = location; | |
} | |
} | |
public enum Players | |
{ | |
Nobody, | |
Player, | |
Computer | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window xmlns="https://github.com/avaloniaui" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="clr-namespace:StrategoGUI" | |
Width="{Binding Width}" | |
Height="{Binding Height}" | |
Title="GameWindow"> | |
<Window.Styles > | |
<Style Selector="ItemsControl > ContentPresenter"> | |
<Setter Property="Canvas.Left" Value="{Binding Location.X}"/> | |
<Setter Property="Canvas.Top" Value="{Binding Location.Y}"/> | |
</Style> | |
</Window.Styles> | |
<ItemsControl | |
Items="{Binding GameFields}" <!-- collection of classes show above --> | |
Width="{Binding Width}" | |
Height="{Binding Height}"> | |
<ItemsControl.ItemsPanel> | |
<ItemsPanelTemplate> | |
<Canvas/> | |
</ItemsPanelTemplate> | |
</ItemsControl.ItemsPanel> | |
<ItemsControl.DataTemplates> | |
<DataTemplate DataType="{x:Type local:GameField }"> <!-- if( Elem.Player == Players.Nobody , and another enum vals analogus--> | |
<Image Width="64" Height="64" Source="resm:StrategoGUI.Resources.empty.png" /> | |
</DataTemplate> | |
</ItemsControl.DataTemplates> | |
</ItemsControl> | |
</Window> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment