public void setClick(int line, int column) { lock (clickLock) { click = new GameCoords(line, column); } }
public QuatroInterface(QuatroPlayer player1, QuatroPlayer player2, QuatroOptions options) { InitializeComponent(); this.player1 = player1; this.player2 = player2; player1.mainThread = this.Dispatcher; player2.mainThread = this.Dispatcher; player1Control.Content = player1.GetFeedbackControl(); player2Control.Content = player2.GetFeedbackControl(); this.options = options; fieldUI = new Button[7, 9]; //visual initialization StackPanel columnStacks = new StackPanel(); columnStacks.Orientation = Orientation.Horizontal; playGrid.Children.Add(columnStacks); for(int i=0;i<9;i++) { StackPanel column = new StackPanel(); column.Orientation = Orientation.Vertical; columnStacks.Children.Add(column); for(int j=6;j>=0;j--) { Button slot = new Button(); slot.Width = 50; slot.Height = 50; fieldUI[j, i] = slot; GameCoords coords = new GameCoords(j, i); slot.DataContext = coords; slot.Click += slot_Click; slot.Content = "(" + j + "," + i + ")"; column.Children.Add(slot); } Label columnNumber = new Label(); columnNumber.Content = "" + i; columnNumber.FontSize = 16; columnNumber.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; column.Children.Add(columnNumber); } slotImage = new BitmapImage(new Uri("s0.png", UriKind.Relative)); p1Image = new BitmapImage(new Uri("s1.png", UriKind.Relative)); p2Image = new BitmapImage(new Uri("s2.png", UriKind.Relative)); player1ScoreLabel.Content = "0"; player2ScoreLabel.Content = "0"; StartNewGame(); }
public void PutClick(GameCoords coords) { if(notifier != null) notifier.setClick(coords.line, coords.column); }