Пример #1
0
        public static ReactiveList <HudGaugeIndicatorStatsGroupViewModel> GroupStats(HudLayoutGaugeIndicator tool, HudElementViewModel hudElementViewModel)
        {
            var groupedStats = new ReactiveList <HudGaugeIndicatorStatsGroupViewModel>();

            if (tool.Stats == null)
            {
                return(groupedStats);
            }

            HudGaugeIndicatorStatsGroupViewModel group = null;

            foreach (var stat in tool.Stats)
            {
                var groupType = GetStatGroupType(stat);

                if (group == null || group.GroupType != groupType)
                {
                    group = new HudGaugeIndicatorStatsGroupViewModel
                    {
                        GroupType = groupType
                    };

                    groupedStats.Add(group);
                }

                var gaugeIndicatorStatInfo = new HudGaugeIndicatorStatInfo(stat);

                if (hudElementViewModel != null)
                {
                    gaugeIndicatorStatInfo.HeatMapViewModel = (HudHeatMapViewModel)tool.Tools?
                                                              .OfType <HudLayoutHeatMapTool>()
                                                              .FirstOrDefault(x => x.BaseStat != null && x.BaseStat.Stat == stat.Stat)?
                                                              .CreateViewModel(hudElementViewModel);
                }

                group.Stats.Add(gaugeIndicatorStatInfo);
            }

            return(groupedStats);
        }
Пример #2
0
 /// <summary>
 /// Refreshes group stats
 /// </summary>
 private void RefreshGroupedStats()
 {
     GroupedStats = HudGaugeIndicatorStatsGroupViewModel.GroupStats(tool, Parent);
 }