示例#1
0
        public void InputGridCtor_GetSite_RowColumn()
        {
            InputGrid <bool> inputGrid   = new InputGrid <bool>(grid);
            ILandscape       myLandscape = new Landscape.Landscape(inputGrid);

            CheckGetSite_RowColumn(myLandscape);
        }
示例#2
0
 /// <summary>
 /// Toggle cell state i.e. dead or alive
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public void ToggleGridCell(int x, int y)
 {
     if (InputGrid.RowCount <= x || InputGrid.ColumnCount <= y)
     {
         throw new ArgumentOutOfRangeException("Argument out of bound");
     }
     InputGrid.ToggleCell(x, y);
 }
示例#3
0
 void recorder_OnReplayRecorded()
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() =>
     {
         HintLabel.Margin = new Thickness(0, 30, 365, 0);
         SearchTextBox.Watermark = "replay downloaded";
         var fadeGridInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
         InputGrid.BeginAnimation(Grid.OpacityProperty, fadeGridInAnimation);
         InputGrid.Visibility = Visibility.Visible;
         UpdateReplays();
     }));
 }
		public void Init()
		{
			data = new bool[7,5] { {false, false, false, false, false},
								   {false, false, true,  false, false},
								   {false, true,  true,  true,  false},
								   {true,  true,  true,  true,  true },
								   {false, true,  true,  true,  false},
								   {false, false, true,  false, false},
								   {false, false, false, false, false} };
			dimensions = new GridDimensions((uint) data.GetLength(0),
			                                (uint) data.GetLength(1));
			dataGrid = new DataGrid<bool>(data);
			grid = new InputGrid<bool>(dataGrid);
		}
        public void GridCtor_ReadPastEnd()
        {
            InputGrid <bool> myGrid = new InputGrid <bool>(dataGrid);

            for (uint row = 1; row <= dimensions.Rows; ++row)
            {
                for (uint col = 1; col <= dimensions.Columns; ++col)
                {
                    Assert.AreEqual(data[row - 1, col - 1], myGrid.ReadValue());
                }
            }

            myGrid.ReadValue();
        }
 public void Init()
 {
     data = new bool[7, 5] {
         { false, false, false, false, false },
         { false, false, true, false, false },
         { false, true, true, true, false },
         { true, true, true, true, true },
         { false, true, true, true, false },
         { false, false, true, false, false },
         { false, false, false, false, false }
     };
     dimensions = new GridDimensions((uint)data.GetLength(0),
                                     (uint)data.GetLength(1));
     dataGrid = new DataGrid <bool>(data);
     grid     = new InputGrid <bool>(dataGrid);
 }
示例#7
0
        private void GetReplayButton_Click(object sender, RoutedEventArgs e)
        {
            HintLabel.Margin = new Thickness(0, 30, 365, 0);
            HintLabel.Content = "retrieving replay";
            var fadeLabelInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
            HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimation);

            string SpectatorCommand = SearchTextBox.WaterTextbox.Text;
            string[] RemoveExcessInfo = SpectatorCommand.Split(new string[1] { "spectator " }, StringSplitOptions.None);

            if (RemoveExcessInfo.Length != 2)
            {
                HintLabel.Content = "invalid command";
                HintLabel.Margin = new Thickness(0, 60, 365, 0);
                return;
            }

            string[] Info = RemoveExcessInfo[1].Replace("\"", "").Split(' ');

            if (Info.Length != 4)
            {
                HintLabel.Content = "invalid command";
                HintLabel.Margin = new Thickness(0, 60, 150, 0);
                return;
            }

            SearchTextBox.WaterTextbox.Text = "";

            int GameId = Convert.ToInt32(Info[2]);

            recorder = new ReplayRecorder(Info[0], GameId, Info[3], Info[1]);
            recorder.OnReplayRecorded += recorder_OnReplayRecorded;
            recorder.OnGotChunk += recorder_OnGotChunk;

            var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1));
            InputGrid.BeginAnimation(Grid.OpacityProperty, fadeGridOutAnimation);
            InputGrid.Visibility = Visibility.Hidden;
        }
		public void GridCtor_ReadPastEnd()
		{
			InputGrid<bool> myGrid = new InputGrid<bool>(dataGrid);
			
			for (uint row = 1; row <= dimensions.Rows; ++row)
				for (uint col = 1; col <= dimensions.Columns; ++col)
					Assert.AreEqual(data[row-1, col-1], myGrid.ReadValue());

			myGrid.ReadValue();
		}
		public void InputGridCtor_GetSite_RowColumn()
		{
			InputGrid<bool> inputGrid = new InputGrid<bool>(grid);
			ILandscape myLandscape = new Landscape.Landscape(inputGrid);
			CheckGetSite_RowColumn(myLandscape);
		}
 private void EntryChat_Focused(object sender, FocusEventArgs e)
 {
     InputGrid.TranslateTo(0, -300, 250, Easing.Linear);
 }
 private void EntryChat_Completed(object sender, System.EventArgs e)
 {
     InputGrid.TranslateTo(0, 0, 250, Easing.Linear);
 }