public StatisticsItem(IGlobalStatistic statistic) { Statistic = statistic; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; InternalChildren = new Drawable[] { new SpriteText { Font = FrameworkFont.Regular, Colour = FrameworkColour.Yellow, Text = Statistic.Name, RelativeSizeAxes = Axes.X, Width = 0.68f, }, valueText = new SpriteText { Font = FrameworkFont.Condensed, RelativePositionAxes = Axes.X, X = 0.7f, RelativeSizeAxes = Axes.X, Width = 0.3f, }, }; }
public void Add(IGlobalStatistic stat) { if (items.Any(s => s.Statistic == stat)) { return; } items.Add(new StatisticsItem(stat)); }
public void Remove(IGlobalStatistic stat) { items.FirstOrDefault(s => s.Statistic == stat)?.Expire(); }
/// <summary> /// Register a new statistic type. /// </summary> /// <param name="stat">The statistic to register.</param> private static void register(IGlobalStatistic stat) { lock (statistics) statistics.Add(stat); }
/// <summary> /// Remove a specific statistic. /// </summary> /// <param name="statistic">The statistic to remove.</param> public static void Remove(IGlobalStatistic statistic) { lock (statistics) statistics.Remove(statistic); }