public EasyGameComponent AddBrick(int row, int col) { int start = 60; EasyGameComponent brick = AddComponent("brick-1x2"); brick.Category = "brick"; brick.SetPosition(start + (col * brick.Width), start + (row * brick.Height)); brick.OverlayColor = RandomHelper.Color(); return(brick); }
public async Task <IActionResult> OnPostInitializeAsync() { if (!User.Identity.IsAuthenticated) { return(Unauthorized()); } string token = await idData.GetAccessToken(HttpContext); List <Category> tags = new List <Category>(); for (int i = 1; i <= 5; i++) { Category t = new Category { Name = $"category{i}", Color = RandomHelper.Color() }; t.Id = (await tagsClient.Create(token, t)).Value; tags.Add(t); } List <Note> nodes = new List <Note>(); for (int i = 1; i <= 10; i++) { Note t = new Note { Title = $"Note {i}", Content = $"Contents of note {i}.", CategoryId = RandomHelper.Choice(tags).Id }; t.Id = (await nodesClient.Create(token, t)).Value; nodes.Add(t); } List <Relation> relations = new List <Relation>(); for (int i = 1; i <= 10; i++) { Relation t = new Relation { From = RandomHelper.Choice(nodes).Id, To = RandomHelper.Choice(nodes).Id }; t.Id = (await relationsClient.Create(token, t)).Value; relations.Add(t); } return(RedirectToPage()); }