Ejemplo n.º 1
0
        /// <summary>
        /// Refreshes the types of columns displayed for judgemnt type hit count.
        /// </summary>
        public void RefreshColumns(IModeService service)
        {
            // In case of a null service, just display all labels.
            if (service == null)
            {
                Logger.LogWarning($"RankingColumn.RefreshColumn - The specified mode service is null.");
                judgementLabels.ForEach(l => l.Active = true);
                return;
            }

            // Only display judgement types that are used by this mode.
            var timing      = service.CreateTiming();
            int activeCount = 0;

            judgementLabels.ForEach(l => l.Active = false);
            foreach (var result in timing.SupportedHitResults())
            {
                activeCount++;
                judgementLabels[(int)result].Active = true;
            }
            // Position these labels.
            for (int i = 0; i < judgementLabels.Count; i++)
            {
                if (judgementLabels[i].Active)
                {
                    activeCount--;
                    judgementLabels[i].X = JudgementLabelStartX - (activeCount * JudgementLabelInterval);
                }
            }
        }