public ScrollingTeam(DrawingsTeam team) { Team = team; Anchor = Anchor.CentreLeft; Origin = Anchor.CentreLeft; Size = new Vector2(WIDTH, HEIGHT); Masking = true; CornerRadius = 8f; Alpha = 0; Children = new Drawable[] { outline = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0 }, flagSprite = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(WIDTH, HEIGHT) - new Vector2(8) } }; }
private void onTeamSelected(DrawingsTeam team) { groupsContainer.AddTeam(team); fullTeamNameText.Text = team.FullName; fullTeamNameText.FadeIn(200); writeResults(groupsContainer.GetStringRepresentation()); }
private void reset(bool loadLastResults = false) { groupsContainer.ClearTeams(); reloadTeams(); if (!storage.Exists(results_filename)) { return; } if (loadLastResults) { try { // Read from drawings_results using (Stream stream = storage.GetStream(results_filename, FileAccess.Read, FileMode.Open)) using (StreamReader sr = new StreamReader(stream)) { string line; while ((line = sr.ReadLine()?.Trim()) != null) { if (string.IsNullOrEmpty(line)) { continue; } if (line.ToUpperInvariant().StartsWith("GROUP")) { continue; } // ReSharper disable once AccessToModifiedClosure DrawingsTeam teamToAdd = allTeams.Find(t => t.FullName == line); if (teamToAdd == null) { continue; } groupsContainer.AddTeam(teamToAdd); teamsContainer.RemoveTeam(teamToAdd); } } } catch (Exception ex) { Logger.Error(ex, "Failed to read last drawings results."); } } else { writeResults(string.Empty); } }
public void AddTeam(DrawingsTeam team) { if (groups[currentGroup].TeamsCount == maxTeams) { return; } groups[currentGroup].AddTeam(team); currentGroup = (currentGroup + 1) % groups.Count; }
public bool RemoveTeam(DrawingsTeam team) { allTeams.RemoveAll(gt => gt.Team == team); if (teams.RemoveAll(gt => gt.Team == team) > 0) { TeamsCount--; return(true); } return(false); }
public void AddTeam(DrawingsTeam team) { GroupTeam gt = new GroupTeam(team); if (TeamsCount < 8) { teams.Add(gt); allTeams.Add(gt); TeamsCount++; } }
public void AddTeam(DrawingsTeam team) { if (availableTeams.Contains(team)) { return; } availableTeams.Add(team); RemoveAll(c => c is ScrollingTeam); scrollState = ScrollState.Idle; }
public GroupTeam(DrawingsTeam team) { Team = team; Width = 36; AutoSizeAxes = Axes.Y; Children = new Drawable[] { innerContainer = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5f), Children = new Drawable[] { flagSprite = new Sprite { RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, FillMode = FillMode.Fit }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = team.Acronym.ToUpperInvariant(), TextSize = 10f, Font = @"Exo2.0-Bold" } } } }; }
public void RemoveTeam(DrawingsTeam team) { availableTeams.Remove(team); foreach (var c in Children) { ScrollingTeam st = c as ScrollingTeam; if (st == null) { continue; } if (st.Team == team) { st.FadeOut(200); st.Expire(); } } }