public static void UpArrow() { _firstBtn = ConsoleKey.D5; ConsoleKeyInfo CKI = new ConsoleKeyInfo(); _y--; Console.SetCursorPosition(_x, _y); Console.Write(_snake); upY++; if (upY >= _snakeIndex) { Console.SetCursorPosition(_x, _y + (_snakeIndex + 1)); Console.Write(_snakeSpace); } if (_FoodX == _x && _FoodY == _y) { _snakeIndex++; FoodGeneration.RandomFoodGeneration(); } if (_privateVaribale == false) { _privateVaribale = true; _i = 0; } _i++; if (_i == _snakeIndex) { fullSnake = true; } Thread.Sleep(400); if (Console.KeyAvailable == true) { CKI = Console.ReadKey(true); if (CKI.Key == ConsoleKey.DownArrow ^ CKI.Key == ConsoleKey.LeftArrow ^ CKI.Key == ConsoleKey.RightArrow) { _userBtnRight = CKI.Key; CoordinateRecord.AllCoordintatesRecords(_x, _y, fullSnake, _i, 4, _snakeIndex); _i = 0; fullSnake = false; upY++; if (zxc == false) { privateVariable = true; zxc = true; } } } else { _userBtnRight = ConsoleKey.UpArrow; } }
public void AddNewCarRecord(string carId) { var record = new CoordinateRecord() { CarId = carId, Coordinates = new Coordinate[] { } }; IList <FilterDefinition <CoordinateRecord> > filters = new List <FilterDefinition <CoordinateRecord> >(); //add this to db var count = _coordinateRecordsCollection.Find <CoordinateRecord>( Builders <CoordinateRecord> .Filter.Eq(r => r.CarId, carId) & Builders <CoordinateRecord> .Filter.Eq(r => r.IsComplete, false)) .CountDocuments(); if (count == 0) { _coordinateRecordsCollection.InsertOne(record); } //_coordinateRecordsCollection.FindOneAndReplace(Builders<CoordinateRecord>.Filter.Eq(r => r.CarId, carId),record); }
protected ImagePoint RecordToPoint(CoordinateRecord ildaRecord, FormatCode formatCode, IList <RecordColourPalette> palette) { var res = new ImagePoint(); switch (formatCode) { case FormatCode.Format2DIndexedColour: { var r = (Record2DIndexed)ildaRecord; var c = palette[r.ColourIndex]; res.X = r.X; res.Y = r.Y; res.Blanking = r.Blanking; res.R = c.Red; res.G = c.Green; res.B = c.Blue; break; } case FormatCode.Format2DTrueColour: { var r = (Record2DTrueColour)ildaRecord; res.X = r.X; res.Y = r.Y; res.Blanking = r.Blanking; res.R = r.Red; res.G = r.Green; res.B = r.Blue; break; } case FormatCode.Format3DIndexedColour: { var r = (Record3DIndexed)ildaRecord; var c = palette[r.ColourIndex]; res.X = r.X; res.Y = r.Y; res.Z = r.Z; res.Blanking = r.Blanking; res.R = c.Red; res.G = c.Green; res.B = c.Blue; break; } case FormatCode.Format3DTrueColour: { var r = (Record3DTrueColour)ildaRecord; res.X = r.X; res.Y = r.Y; res.Z = r.Z; res.Blanking = r.Blanking; res.R = r.Red; res.G = r.Green; res.B = r.Blue; break; } default: throw new ArgumentException($"Unknown FormatCode '{formatCode}'", nameof(formatCode)); } return(res); }