private void CreatePin_btn_Click(object sender, RoutedEventArgs e) { con.Open(); OracleCommand command = new OracleCommand(); command.Connection = con; command.CommandText = "select count(*) from board where user_id= :userid"; command.CommandType = CommandType.Text; command.Parameters.Add("userid", Account.UserID); OracleDataReader reader = command.ExecuteReader(); int i = -1; if (reader.Read()) { i = Convert.ToInt32(reader[0]); } reader.Close(); con.Close(); boardPanel.Children.Clear(); if (i == 0) { MessageBox.Show("Please, create board First"); CreateBoard board1 = new CreateBoard(); board1.ShowDialog(); } else { CreatePin pin1 = new CreatePin(); pin1.ShowDialog(); } }
private void CreateBoard_btn_Click(object sender, RoutedEventArgs e) { boardPanel.Children.Clear(); CreateBoard board1 = new CreateBoard(); board1.ShowDialog(); }
IEnumerator PushBack2Home(GameObject defeatedPawn) { cellMetaData.RemovePlayer(defeatedPawn); PlayerMetaData defeatedPMetaData = defeatedPawn.GetComponent <PlayerMetaData>(); GameObject homeCell = defeatedPMetaData.homeCell; GameObject currCell = defeatedPMetaData.currCell; while (currCell != homeCell) { Vector3 desiredPosition = CreateBoard.NewPiecePosition(currCell); defeatedPawn.transform.position = Vector3.Lerp(defeatedPawn.transform.position, desiredPosition, 1); currCell = currCell.GetComponent <CellMetaData>().GetPrevGameObj(defeatedPMetaData.myTeam); if (currCell == null) { currCell = homeCell; } // wasnt able to show smooth behvaviour using progress (t) & movementspeed in lerp // so used this. yield return(new WaitForSeconds(0.05f)); } // Now formally adding defeated pawn to home cell homeCell.GetComponent <CellMetaData>().AddPlayer(defeatedPawn); runningProcesses--; }
public async Task <PostBoardResponse> Post(PostBoardRequest request) { var boardId = _ids.Create(); var command = new CreateBoard(boardId, request.Name, request.UserId); var user = _cluster.GetGrain <IUserAggregate>(request.UserId); await user.CreateBoard(command); return(new PostBoardResponse(boardId)); }
public async Task CreateBoard(CreateBoard command) { var board = GrainFactory.GetGrain <IBoardAggregate>(command.BoardId); await board.CreateBoard(command); var @event = new UserAddedToBoard(command.BoardId, command.Name, command.UserId); RaiseEvent(@event); }
public override void SetAttackOn(Vector2 _sell, CreateBoard board) { for (int i = 1; i <= length; i++) { if (!board.setIsAttack(_sell + (go_sell * i))) { break; } } }
public override void setMoveOn(piece _piece, CreateBoard board) { for (int i = 1; i <= length; i++) { if (!board.setMovable(_piece.sell + (go_sell * i))) { break; } } }
private void play_b_Click(object sender, EventArgs e) { int diff = 0; if (hard_rb.Checked) { diff = 3; } else if (normal_rb.Checked) { diff = 2; } else if (esey_rb.Checked) { diff = 1; } else { MessageBox.Show("Nie został wybrany poziom trudności", "Poziom trudnosci", MessageBoxButtons.OK, MessageBoxIcon.Stop); } board.Difficul = diff; int size = 0; if (big_rb.Checked) { size = 3; } else if (medium_rb.Checked) { size = 2; } else if (small_rb.Checked) { size = 1; } else { MessageBox.Show("Nie została wybrana wielkość planszy", "Wielkość planszy", MessageBoxButtons.OK, MessageBoxIcon.Warning); } board.Size = size; if (size > 0 && diff > 0) { this.Visible = false; this.Close(); CreateBoard createBoard = new CreateBoard(board); board.WindowGame = CreateWindow.Create(board); saper.Visible = true; saper.StartGame(); } }
public ActionResult Post(CreateBoard request) { var id = _boards.Max(b => b.Id) + 1; var board = new Board(id, request.Name, request.Description); _boards.Add(board); //return Created($"http://localhost:5000/boards/{id}",null); return(CreatedAtAction(nameof(Get), new { id }, null)); }
private static async Task initBoard(int size) { if (!_letterBasedBoardInputValidator.IsBoardSizeValid(size)) { throw new ArgumentException($"Board Size Not Valid"); } var createBoardCommand = new CreateBoard(size); _boardId = createBoardCommand.Id; await _commandSender.Send(createBoardCommand); }
public async Task <bool> CreateBoard(CreateBoard createBoard, Project project, string slug) { Board board = new Board { BoardName = createBoard.BoardName, BoardSlug = slug, Project = project, }; await context.Boards.AddAsync(board); int saveResult = await context.SaveChangesAsync(); return(saveResult == 1); }
public Deserializacja(Game game) : base(game.Player) { if (Deserial()) { int Count = FieldList.Count; game.Board.Size = ReadSize(Count); game.TimeSet(FieldList[0].time); int[] info = ReadShow(FieldList); game.Board.Difficul = ReadDiff(info[1], game.Board.Size); CreateBoard createBoard = new CreateBoard(game.Board); game.Board.WindowGame = CreateWindow.Create(game.Board); game.ShowedField = info[0]; isRead = true; } }
public void ExecuteMethodThrowExeptionWhenInputParametersCountIsNotValid() { var mockedDatabase = new Mock <IDatabase>(); var mockedFactory = new Mock <IWIMFactory>(); var command = new CreateBoard(mockedFactory.Object, mockedDatabase.Object); var input = new List <string>() { "BoardName" }; var ex = Assert.ThrowsException <ArgumentException>(() => command.Execute(input)); Assert.AreEqual(GlobalConstants.ParametersCountInvalid, ex.Message); }
public async Task Handle_ValidParameters_ShouldCreateNewBoard() { // Arrange var command = new CreateBoard { Id = Model.Id, Name = Model.Name, }; var repositoryMock = new Mock <IRepository <Board> >(); var handler = new CreateBoardCommandHandler(repositoryMock.Object, _utcNowFactoryMock.Object); // Act await handler.Handle(command, cancellationToken : default); // Assert repositoryMock.Verify(x => x.Add(Model.Id, It.IsAny <Board>()), Times.Once); }
public void Handle_NullOrEmptyName_ShouldThrowValidationException(string name) { // Arrange var command = new CreateBoard { Id = Model.Id, Name = name, }; var handler = new CreateBoardCommandHandler(Mock.Of <IRepository <Board> >(), _utcNowFactoryMock.Object); // Act Func <Task> action = () => handler.Handle(command, cancellationToken: default); // Assert action.Should().Throw <ValidationException>() .WithMessage("*Name*"); }
/// <summary> /// Creates a board. /// </summary> /// <param name="createBoard">The mutation model.</param> /// <returns></returns> public async Task <int> CreateBoard(CreateBoard createBoard) { var request = new GraphQLRequest { Query = @"mutation request($name:String! $boardKind:BoardKind!) { create_board (board_name: $name, board_kind: $boardKind) { id }}", Variables = new { name = createBoard.Name, boardKind = createBoard.BoardAccessType.GetVariableBoardAccessType() } }; var result = await _graphQlHttpClient.SendMutationAsync <CreateBoardResponse>(request); ThrowResponseErrors(result.Errors); return(result.Data.Board.Id); }
// Start is called before the first frame update void Start() { Sr = GetComponent <SpriteRenderer>(); DisplayScreen = FindObjectOfType <CreateBoard>(); DataItem = FindObjectOfType <ItemData>(); //1 - (1 / (0.15 * 4 + 1) = float RandItemChance = 1 - (1 / (0.15f * PlayerController.ChanceMultipler + 1)); float RandChance = Random.Range(0f, 1f); if (RandItemChance > RandChance) { Value = Random.Range(0, ItemType.Length) + 1; Sr.sprite = ItemType[Value - 1]; } else { Value = 11; Sr.sprite = LostMemory[Random.Range(0, LostMemory.Length)]; } PlayerPos = GameObject.FindGameObjectWithTag("Player").transform; }
public async Task <IActionResult> Create(CreateBoard createBoard, string userSlug, string projectSlug) { if (!ModelState.IsValid) { return(View()); } AppUser user = await userManager.GetUserAsync(HttpContext.User); AppUser projectOwner = boardService.GetUserBySlug(userSlug); Project project = boardService.GetProjectBySlug(projectSlug, projectOwner); if (project == null) { return(NotFound()); } if (!boardService.IsMemberOfProject(user, project)) { return(NotFound()); } string slug = createBoard.BoardName.ToLower().Replace(" ", "-"); if (!boardService.ProjectNameIsAvailable(slug)) { return(View()); } bool successful = await boardService.CreateBoard(createBoard, project, slug); if (!successful) { return(BadRequest("Could not create board")); } return(RedirectToAction("Index")); }
public void ExecuteMethodReturnsCorrectMessageWhenTeamIsMissingInDatabase() { var mockedDatabase = new Mock <IDatabase>(); var mockedFactory = new Mock <IWIMFactory>(); var fakeList = new List <ITeam>(); mockedDatabase.Setup(x => x.ListAllTeams).Returns(fakeList); var command = new CreateBoard(mockedFactory.Object, mockedDatabase.Object); var mockedTeam = new Mock <ITeam>(); mockedTeam.Setup(x => x.Name).Returns("Teamteam"); fakeList.Add(mockedTeam.Object); var parameters = new List <string> { "BoardName", "Team14" }; var expected = string.Format(GlobalConstants.TeamDoesNotExist, "Team14"); Assert.AreEqual(expected, command.Execute(parameters)); }
void Start() { board = GetComponent <CreateBoard>(); Vector2 child = prefab.GetComponent <SpriteRenderer>().bounds.size; GameObject[,] matrix = new GameObject[M, N]; float startX = -8; float startY = -4; GameObject tile; Sprite sprite; for (int i = 0; i < M; ++i) { for (int j = 0; j < N; ++j) { tile = Instantiate(prefab, new Vector3(startX + child.x * i, startY + child.y * j, 0), prefab.transform.rotation); matrix[i, j] = tile; tile.transform.parent = transform; sprite = club[Random.Range(0, club.Count)]; tile.GetComponent <SpriteRenderer>().sprite = sprite; } } }
public Task CreateBoard(CreateBoard command) { List <IEvent> events = new List <IEvent>(); events.Add(new BoardCreated(command.Name, command.BoardId, command.UserId)); //var response = await _plaid.GetCategories(_tokenSource.Token); //var categoriesAdded = response.Categories.Select(c => new CategoryAdded(command.BoardId, c.CategoryId, c.Group, c.Hierarchy)); //events.AddRange(categoriesAdded); //var systemEnvelopes = new List<EnvelopeAdded>() //{ // new EnvelopeAdded("sys-env-starting-balance", "Starting Balance", new string[]{ }, command.BoardId, command.UserId), // new EnvelopeAdded("sys-env-funding", "Funding", new string[] { }, command.BoardId, command.UserId), // new EnvelopeAdded("sys-env-income", "Income", new string[] { }, command.BoardId, command.UserId), // new EnvelopeAdded("sys-env-rollover", "Rollover", new string[] { }, command.BoardId, command.UserId), // new EnvelopeAdded("sys-env-credit-card-payments", "Credit Card Payments", new string[] { }, command.BoardId, command.UserId) //}; //events.AddRange(systemEnvelopes); RaiseEvents(events); return(Task.CompletedTask); }
public void CreateWithSize2020_WillHaveRightSizeAndNumberOfBeasties() { var given = new List <Event>(); var herbivores = new List <Herbivore> { new Herbivore(1, 1, String.Empty) }; var carnivores = new List <Carnivore> { new Carnivore(2, 2, String.Empty, 10) }; var when = new CreateBoard(20, 20, herbivores, carnivores, "woop"); var then = new List <Event> { new CreateBoardAccepted(20, 20, new List <Herbivore>(), new List <Carnivore>(), Message.CausationId, Message.CorrelationId, Message.CreatedOn) }; var results = Execute(given, when, then, events => new Surface(events, new Random())); var e = (CreateBoardAccepted)results[0]; Assert.Equal(20, e.X); Assert.Equal(20, e.Y); }
private void Start() { cb = GameObject.Find("GameManager").GetComponent <CreateBoard>(); attackCount = 5; }
void Awake() { board = GameObject.Find("Board").GetComponent <CreateBoard>(); }
// Use this for initialization void Start() { gobBoard = GameObject.FindGameObjectWithTag ("BOARD"); brdBoardManager = gobBoard.GetComponent<CreateBoard> () as CreateBoard; }
void SetComponents() { createBoard = GetComponent <CreateBoard>(); gameplayLogic = GetComponent <GameplayLogic>(); }
public override void SetAttackOn(Vector2 _sell, CreateBoard board) { Vector2 onsell = _sell + go_sell; board.setIsAttack(onsell); }
public virtual void setMoveOn(piece _piece, CreateBoard board) { }
// Start is called before the first frame update void Start() { collider = GetComponent <BoxCollider2D>(); boardManager = FindObjectOfType <CreateBoard>(); PlayerControl = FindObjectOfType <PlayerController>(); collider.size = new Vector2(BoxX * 0.64f, BoxY * 0.64f); StartedBattle = false; GameObject Bottom = Instantiate(BottomShadow, transform.position, Quaternion.identity, transform); collider.size = new Vector2(BoxX * 0.64f, BoxY * 0.64f); if (CenterSpawn) { boardManager.BoardY[4].BoardX[4] = 1; BoardPosition = new Vector2(5, 5); } for (int x = 0; x < BoxX; x++) { for (int y = 0; y < BoxY; y++) { Vector3 Vector3Position = transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks); float RandomChance = Random.Range(0f, 1f); if (RandomChance <= DecorationChance && y > 0 && x > 0 && x < BoxX - 1 && y < BoxY - 1) { Instantiate(Decoration, transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } if (x == (BoxX / 2) + 0.5f && y == (BoxY / 2) + 0.5f) { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); GameObject TowerPillar = Instantiate(Tower, transform.position, Quaternion.identity, transform); MemoryPillar = TowerPillar.GetComponent <SpawnBattle>(); } //Corners:right, left, up, down /*else if (x == BoxX - 2 || y == BoxY - 2 || y == 1 && x == 1) * { * Instantiate(AdaptTiles[Random.Range(0, AdaptTiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); * */ else if (x == BoxX - 1 && y == BoxY - 1) { Instantiate(CornerTiles[4], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (x == BoxX - 1 && y == 0) { Instantiate(CornerTiles[5], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (x == 0 && y == BoxY - 1) { Instantiate(CornerTiles[6], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (x == 0 && y == 0) { Instantiate(CornerTiles[7], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } //For vector locations else if (x == BoxX - SpawnLocation && y == BoxY - SpawnLocation) { SpawnLocations[0] = Vector3Position; if (CornerStuff) { Instantiate(Walls[Random.Range(0, Walls.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } else if (x == BoxX - SpawnLocation && y == SpawnLocation - 1) { SpawnLocations[1] = Vector3Position; if (CornerStuff) { Instantiate(Walls[Random.Range(0, Walls.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } else if (x == SpawnLocation - 1 && y == BoxY - SpawnLocation) { SpawnLocations[2] = Vector3Position; if (CornerStuff) { Instantiate(Walls[Random.Range(0, Walls.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } else if (x == SpawnLocation - 1 && y == SpawnLocation - 1) { SpawnLocations[3] = Vector3Position; if (CornerStuff) { Instantiate(Walls[Random.Range(0, Walls.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } //this is the rest of the stuff else { if (x == BoxX - 1) { Instantiate(CornerTiles[0], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (x == 0) { Instantiate(CornerTiles[1], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (y == BoxY - 1) { Instantiate(CornerTiles[2], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else if (y == 0) { Instantiate(CornerTiles[3], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } else { Instantiate(Tiles[Random.Range(0, Tiles.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } if (Condition && WillSpawn) { for (int i = 0; i < WallLocationsX.Length; i++) { //second is less, third is greater than. what the heck is ths lazy code! if (x == WallLocationsX[i] && x <WallLocationsX[1] && x> WallLocationsX[2]) { Instantiate(WallEnvironment[Random.Range(0, WallEnvironment.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } for (int i = 0; i < WallLocationsY.Length; i++) { //second is less, third is greater than. what the heck is ths lazy code! if (y == WallLocationsX[i] && y <WallLocationsX[1] && y> WallLocationsX[2]) { Instantiate(WallEnvironment[Random.Range(0, WallEnvironment.Length)], transform.position + new Vector3((x - (BoxX - 1) / 2) * DistanceBetweenBlocks, (y - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } } } } if (!Condition && WillSpawn) { for (int i = 0; i < WallLocationsX.Length; i++) { Instantiate(WallEnvironment[Random.Range(0, WallEnvironment.Length)], transform.position + new Vector3((WallLocationsX[i] - (BoxX - 1) / 2) * DistanceBetweenBlocks, (WallLocationsY[i] - (BoxY - 1) / 2) * DistanceBetweenBlocks, 0), Quaternion.identity, transform); } } }
public IList <BoardSummary> Boards(CreateBoard cmd) { return(_boards.GetList()); }
private void OnCreateBoard(CreateBoardEventArgs args) { CreateBoard?.Invoke(this, args); }
// Use this for initialization void Start() { smiley = GameObject.Find ("smiley"); outline = GameObject.Find ("outline"); canGo = true; pause = false; custom_index = 0; board = new CreateBoard(); playIt = GameObject.Find ("Background").GetComponent<PlayIt> (); // starting place not shown or 0, 0? currentY = 2; if (menu) { currentX = 2; currentY= 2; } if (custom) { currentX = 0; currentY= 1; // load all the unlocked cards from playprefs } changeWhereInGrid (0, 0); GameObject Music = GameObject.Find ("MusicPlay"); if (Music != null) { audio = Music.GetComponents<AudioSource> (); } }