public async void OnStateChangedHandler(GridStateEventArgs <Claim> args) { Console.WriteLine(args.PropertyName); // get the setting that was just changed (paging, sorting,...) await GridRef.SetState(args.GridState); }
public void GivenSixFigureOsGridReferenceThenCorrectlyConstructed() { var sut = new GridRef("NM123456"); Assert.That(sut.SixFigure, Is.EqualTo("NM123456")); Assert.That(sut.TenFigure, Is.EqualTo("NM1230045600")); }
public void GivenTenFigureIrishGridReferenceThenCorrectlyConstructed() { var sut = new GridRef("B1234567890"); Assert.That(sut.SixFigure, Is.EqualTo("B123678")); Assert.That(sut.TenFigure, Is.EqualTo("B1234567890")); }
private void OnMouseUp() { isMovable = false; renderer.sortingOrder = 1; canvas.sortingOrder = 1; GridRef.ReleaseItem(this); }
private void OnMouseDown() { GridRef.SelectItem(this); isMovable = true; renderer.sortingOrder = 99; canvas.sortingOrder = 99; }
private void OnMouseDrag() { if (isMovable && !isMerging) { GridRef.DragItem(this); Vector3 newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); newPos = new Vector2(Mathf.Clamp(newPos.x, (-grid.Width + grid.ItemWidth) / 2.0f, (grid.Width - grid.ItemWidth) / 2.0f), Mathf.Clamp(newPos.y, (-grid.Height + grid.ItemWidth) / 2.0f, (grid.Height - grid.ItemWidth) / 2.0f)); transform.position = newPos; } }
public int CompareTo(object obj) { if (obj == null) { return(1); } GridRef otherGridRef = obj as GridRef; var xMatches = otherGridRef.x == this.x; var zMatchex = otherGridRef.z == this.z; return(xMatches && zMatchex ? 1 : 0); }
public GridRef GetOffsetGridRef(ExitDirections direction) { //Generate grid reference GridRef[] positionOffsets = new GridRef[] { new GridRef(0, 1), //Y = N new GridRef(1, 0), //X = E new GridRef(0, -1), //-Y = S new GridRef(-1, 0) //-X = W }; return(new Place.GridRef( PlaceGridRef.x + positionOffsets[(int)direction].x, PlaceGridRef.y + positionOffsets[(int)direction].y )); }
private IEnumerator MoveCoroutine(int newX, int newY, float time, bool merge) { gridIndex.X = newX; gridIndex.Y = newY; gridIndex.ChangeName(); Vector3 startPos = transform.localPosition; Vector3 endPos = GridRef.GetWorldPosition(newX, newY); for (float t = 0; t <= 1 * time; t += Time.deltaTime) { transform.localPosition = Vector3.Lerp(startPos, endPos, t / time); yield return(0); } transform.localPosition = endPos; if (merge) { Destroy(transform.gameObject); } }
public void Play() { char playAgainResponse; do { // Setup grid grid.SetUp(); // Place ships grid.AddShip(new Battleship()); grid.AddShip(new Destroyer()); grid.AddShip(new Destroyer()); while (grid.ShipsRemaining > 0) { grid.PrintGridForPlayer(); Console.WriteLine("Enter grid reference to fire at: "); string input = Console.ReadLine(); if (input == CheatCodes.REVEAL_GRID) { grid.PrintActualGrid(); continue; } if (input == CheatCodes.GIVE_UP) { break; } Point?chosenPoint = GridRef.GridRefToPoint(input); if (chosenPoint == null) { Console.WriteLine("Please enter a valid point. It should be a letter directly followed by a number i.e. A1."); continue; } Point point = (Point)chosenPoint; if (!grid.IsPointValid(point)) { Console.WriteLine("That point is outside the bounds of the grid"); continue; } string fireString = grid.Fire(point); Console.WriteLine(fireString); } grid.PrintActualGrid(); Console.WriteLine("Game Over"); do { Console.WriteLine(); Console.WriteLine("Play again? [y/n]: "); playAgainResponse = char.ToUpper(Console.ReadKey().KeyChar); }while (playAgainResponse != 'Y' && playAgainResponse != 'N'); } while (playAgainResponse == 'Y'); }
public int CompareTo(object obj) { GridRef otherGridRef = obj as GridRef; return(otherGridRef.x - this.x + otherGridRef.y - this.y); }
public bool GivenStringReturnsIsValidCorrectly(string input) { return(GridRef.IsValid(input)); }
void OnMouseDown() { GridRef.MouseDownHandler(this); }
void OnMouseEnter() { GridRef.MouseEnterHandler(this); }
public ActionGenerateRolls(GridChainRef gridChain, DiceRef dice, GridRef grid) { _gridChain = gridChain; _dice = dice; _grid = grid; }
public override string ToString() { var above = GridRef.IsValid(KeyCol) ? "col" : KeyCol; return($"{base.ToString()} above {above} ({KeyColHeight})"); }