示例#1
0
        /// <summary>
        /// Inserts heat map tool
        /// </summary>
        /// <param name="dropStatInfoSource">Target <see cref="StatInfo"/> to insert heat map</param>
        private void InsertHeatMap(HudGaugeIndicatorStatInfo dropStatInfoSource, Point position)
        {
            if (dropStatInfoSource.HeatMapViewModel != null)
            {
                return;
            }

            var factory = ServiceLocator.Current.GetInstance <IHudToolFactory>();

            if (tool.Tools == null)
            {
                tool.Tools = new ReactiveList <HudLayoutTool>();
            }

            var creationInfo = new HudToolCreationInfo
            {
                HudElement = Parent,
                Position   = position,
                ToolType   = HudDesignerToolType.HeatMap,
                Tools      = tool.Tools,
                Source     = dropStatInfoSource.Stat
            };

            factory.CreateTool(creationInfo);

            RefreshGroupedStats();
        }
示例#2
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);
        }