Beispiel #1
0
        /// <summary>
        /// Creates <see cref="HudElementViewModel"/> based on the specific <see cref="HudElementViewModelCreationInfo"/>
        /// </summary>
        /// <param name="creationInfo">Creation Info</param>
        /// <returns><see cref="HudElementViewModel"/></returns>
        public HudElementViewModel Create(HudElementViewModelCreationInfo creationInfo)
        {
            Check.ArgumentNotNull(() => creationInfo);
            Check.Require(creationInfo.HudLayoutInfo != null, "HudLayoutInfo must be set.");

            var layoutTools = GetHudLayoutTools(creationInfo);

            var hudElementViewModel = new HudElementViewModel(layoutTools)
            {
                Seat    = creationInfo.SeatNumber,
                Opacity = creationInfo.HudLayoutInfo.Opacity
            };

            try
            {
                hudElementViewModel.Tools.ForEach(x =>
                {
                    x.InitializePositions(creationInfo.PokerSite, creationInfo.HudLayoutInfo.TableType, creationInfo.GameType);
                    ApplyRestrictions(x, creationInfo);
                });
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, $"Could not configure positions for seat #{creationInfo.SeatNumber} using {creationInfo.HudLayoutInfo.Name}, {(int)creationInfo.HudLayoutInfo.TableType}-max", e);
            }

            return(hudElementViewModel);
        }
Beispiel #2
0
        /// <summary>
        ///  Initialize an instance of <see cref="HudFourStatsBoxViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutFourStatsBoxTool"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudFourStatsBoxViewModel(HudLayoutFourStatsBoxTool tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;

            RotateCommand = ReactiveCommand.Create(() =>
            {
                IsVertical = !IsVertical;

                Height = DefaultHeight;
                Width  = DefaultWidth;

                var uiPositions = tool.UIPositions.FirstOrDefault(p => p.Seat == Parent.Seat);

                if (uiPositions != null)
                {
                    uiPositions.Width  = Width;
                    uiPositions.Height = Height;
                }
            });
        }
        /// <summary>
        ///  Initialize an instance of <see cref="HudTextBoxViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutTextBoxTool"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudTextBoxViewModel(HudLayoutTextBoxTool tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;
        }
 /// <summary>
 ///  Initialize an instance of <see cref="HudHeatMapViewModel"/>
 /// </summary>
 /// <param name="tool"><see cref="HudLayoutHeatMapTool"/> to initialize an instance</param>
 /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
 public HudHeatMapViewModel(HudLayoutHeatMapTool tool, HudElementViewModel parent) : this(tool)
 {
     Check.ArgumentNotNull(() => parent);
     Parent = parent;
 }
        /// <summary>
        ///  Initialize an instance of <see cref="HudPlayerIconViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutPlayerIconTool"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudPlayerIconViewModel(HudLayoutPlayerIconTool tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;
        }
Beispiel #6
0
        /// <summary>
        ///  Initialize an instance of <see cref="HudGaugeIndicatorViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutGaugeIndicator"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudGaugeIndicatorViewModel(HudLayoutGaugeIndicator tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;
        }
        /// <summary>
        ///  Initialize an instance of <see cref="HudBumperStickersViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutBumperStickersTool"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudBumperStickersViewModel(HudLayoutBumperStickersTool tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;
        }
        /// <summary>
        ///  Initialize an instance of <see cref="HudTiltMeterViewModel"/>
        /// </summary>
        /// <param name="tool"><see cref="HudLayoutTiltMeterTool"/> to initialize an instance</param>
        /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
        public HudTiltMeterViewModel(HudLayoutTiltMeterTool tool, HudElementViewModel parent) : this(tool)
        {
            Check.ArgumentNotNull(() => parent);

            Parent = parent;
        }
 /// <summary>
 ///  Initialize an instance of <see cref="HudGraphViewModel"/>
 /// </summary>
 /// <param name="tool"><see cref="HudLayoutGraphTool"/> to initialize an instance</param>
 /// <param name="parent">Parent <see cref="HudElementViewModel"/> to initialize an instance</param>
 public HudGraphViewModel(HudLayoutGraphTool tool, HudElementViewModel parent) : this(tool)
 {
     Check.ArgumentNotNull(() => parent);
     Parent = parent;
 }
Beispiel #10
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);
        }