public void HudBumperStickersViewModelToolCanBeSerializedDeserializedWithProtobuf()
        {
            var hudLayoutToolExpected = new HudLayoutBumperStickersTool();

            var hudElement = new HudElementViewModel
            {
                Seat = 1,
            };

            var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudBumperStickersViewModel;

            hudToolViewModelExpected.Width    = 100;
            hudToolViewModelExpected.Height   = 75;
            hudToolViewModelExpected.Position = new System.Windows.Point(5, 5);
            hudToolViewModelExpected.Opacity  = 60;

            Assert.IsNotNull(hudToolViewModelExpected);

            var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected);

            Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id));
            Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType));
            Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width));
            Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height));
            Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position));
            Assert.That(hudToolViewModelActual.Opacity, Is.EqualTo(hudToolViewModelExpected.Opacity));
        }
        public void HudHeatMapViewModelToolCanBeSerializedDeserializedWithProtobuf()
        {
            var hudLayoutToolExpected = new HudLayoutHeatMapTool
            {
                BaseStat = new StatInfo {
                    Stat = Stat.S3Bet
                }
            };

            var hudElement = new HudElementViewModel
            {
                Seat = 1,
            };

            var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudHeatMapViewModel;

            var heatMap = new HeatMapDto();

            heatMap.OccuredByCardRange.Add("AA", 10);

            hudToolViewModelExpected.HeatMap = heatMap;

            var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected);

            Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id));
            Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType));
            Assert.That(hudToolViewModelActual.BaseStat.Stat, Is.EqualTo(hudToolViewModelExpected.BaseStat.Stat));
            Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width));
            Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height));
            Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position));
            Assert.That(hudToolViewModelActual.HeatMap.OccuredByCardRange.Count, Is.EqualTo(hudToolViewModelExpected.HeatMap.OccuredByCardRange.Count));
            Assert.That(hudToolViewModelActual.HeatMap.OccuredByCardRange.Keys.First(), Is.EqualTo(hudToolViewModelExpected.HeatMap.OccuredByCardRange.Keys.First()));
        }
Esempio n. 3
0
        public static void SetStatValue(this HudElementViewModel hudElement, Stat stat, decimal value)
        {
            if (hudElement == null)
            {
                return;
            }

            if (hudElement.StatInfoCollection == null)
            {
                hudElement.StatInfoCollection = new List <StatInfo>();
            }

            var statInfo = hudElement.StatInfoCollection.FirstOrDefault(x => x.Stat == stat);

            if (statInfo == null)
            {
                statInfo = new StatInfo
                {
                    Stat = stat
                };

                hudElement.StatInfoCollection.Add(statInfo);
            }

            statInfo.Caption      = string.Format(statInfo.Format, value);
            statInfo.CurrentValue = value;
        }
        public void HudGraphViewModelToolCanBeSerializedDeserializedWithProtobuf()
        {
            var hudLayoutToolExpected = new HudLayoutGraphTool
            {
                BaseStat = new StatInfo {
                    Stat = Stat.CBet
                },
                IsVertical = true,
                Stats      = new ReactiveList <StatInfo> {
                    new StatInfo {
                        Stat = Stat.AGG
                    }
                },
                ParentId = Guid.NewGuid()
            };

            var hudElement = new HudElementViewModel
            {
                Seat = 1,
            };

            var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudGraphViewModel;

            var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected);

            Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id));
            Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType));
            Assert.That(hudToolViewModelActual.BaseStat.Stat, Is.EqualTo(hudToolViewModelExpected.BaseStat.Stat));
            Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width));
            Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height));
            Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position));
            Assert.That(hudToolViewModelActual.Stats.Count, Is.EqualTo(hudToolViewModelExpected.Stats.Count));
            Assert.That(hudToolViewModelActual.Stats.First().Stat, Is.EqualTo(hudToolViewModelExpected.Stats.First().Stat));
        }
Esempio n. 5
0
        private int GetPanelOffsetsKey(HudElementViewModel viewModel)
        {
            if (viewModel == null)
            {
                return(0);
            }

            return(viewModel.Seat);
        }
Esempio n. 6
0
        /// <summary>
        /// Creates the view model of the current <see cref="HudLayoutGraphTool" />
        /// </summary>
        /// <param name="hudElement"><see cref="HudElementViewModel"/> to create view model</param>
        /// <returns>The view model of the current <see cref="HudLayoutGraphTool" /></returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var toolViewModel = new HudGraphViewModel(this, hudElement)
            {
                Width  = HudDefaultSettings.GraphWidth,
                Height = HudDefaultSettings.GraphHeight
            };

            return(toolViewModel);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates the view model of the current <see cref="HudLayoutHeatMapTool" />
        /// </summary>
        /// <param name="hudElement"><see cref="HudElementViewModel"/> to create view model</param>
        /// <returns>The view model of the current <see cref="HudLayoutHeatMapTool" /></returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var viewModel = new HudHeatMapViewModel(this, hudElement)
            {
                Width  = HudDefaultSettings.HeatMapWidth,
                Height = HudDefaultSettings.HeatMapHeight
            };

            return(viewModel);
        }
Esempio n. 8
0
        /// <summary>
        /// Creates the view model of the current <see cref="HudLayoutGaugeIndicator" />
        /// </summary>
        /// <param name="hudElement"><see cref="HudElementViewModel"/> to create view model</param>
        /// <returns>The view model of the current <see cref="HudLayoutGaugeIndicator" /></returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var toolViewModel = new HudGaugeIndicatorViewModel(this, hudElement)
            {
                Width  = HudDefaultSettings.GaugeIndicatorWidth,
                Height = HudDefaultSettings.GaugeIndicatorHeight
            };

            toolViewModel.Stats.ForEach(x => x.StatInfoMeter = new StatInfoMeterModel());

            return(toolViewModel);
        }
        public void HudFourStatsBoxViewModelToolCanBeSerializedDeserializedWithProtobuf()
        {
            var hudLayoutToolExpected = new HudLayoutFourStatsBoxTool
            {
                Stats = new ReactiveList <StatInfo>
                {
                    new StatInfo {
                        Stat = Stat.VPIP
                    },
                    new StatInfo {
                        Stat = Stat.PFR
                    },
                    new StatInfo {
                        Stat = Stat.S3Bet
                    },
                    new StatInfo {
                        Stat = Stat.ColdCall
                    }
                },
                IsVertical = true
            };

            var hudElement = new HudElementViewModel
            {
                Seat = 1,
            };

            var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudFourStatsBoxViewModel;

            hudToolViewModelExpected.Width    = 100;
            hudToolViewModelExpected.Height   = 150;
            hudToolViewModelExpected.Position = new System.Windows.Point(5, 5);
            hudToolViewModelExpected.Opacity  = 50;

            Assert.IsNotNull(hudToolViewModelExpected);

            var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected);

            Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id));
            Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType));
            Assert.That(hudToolViewModelActual.Stats.Count, Is.EqualTo(hudToolViewModelExpected.Stats.Count));
            Assert.That(hudToolViewModelActual.Stat1.Stat, Is.EqualTo(hudToolViewModelExpected.Stat1.Stat));
            Assert.That(hudToolViewModelActual.Stat2.Stat, Is.EqualTo(hudToolViewModelExpected.Stat2.Stat));
            Assert.That(hudToolViewModelActual.Stat3.Stat, Is.EqualTo(hudToolViewModelExpected.Stat3.Stat));
            Assert.That(hudToolViewModelActual.Stat4.Stat, Is.EqualTo(hudToolViewModelExpected.Stat4.Stat));
            Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width));
            Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height));
            Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position));
            Assert.That(hudToolViewModelActual.Opacity, Is.EqualTo(hudToolViewModelExpected.Opacity));
            Assert.That(hudToolViewModelActual.IsVertical, Is.EqualTo(hudToolViewModelExpected.IsVertical));
        }
Esempio n. 10
0
        /// <summary>
        /// Creates a view model of the current <see cref="HudLayoutPlainBoxTool"/> instance
        /// </summary>
        /// <returns>View model of the current <see cref="HudBaseToolViewModel"/> instance</returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var viewModel = new HudPlainStatBoxViewModel(this, hudElement);

            return(viewModel);
        }
        public void HudGaugeIndicatorViewModelToolCanBeSerializedDeserializedWithProtobuf()
        {
            var hudLayoutToolExpected = new HudLayoutGaugeIndicator
            {
                BaseStat = new StatInfo {
                    Stat = Stat.CBet
                },
                Stats = new ReactiveList <StatInfo>
                {
                    new StatInfo {
                        Stat = Stat.VPIP
                    },
                    new StatInfo {
                        Stat = Stat.PFR
                    },
                    new StatInfo {
                        Stat = Stat.S3Bet
                    },
                    new StatInfo {
                        Stat = Stat.ColdCall
                    }
                },
                Text       = "test",
                IsVertical = true,
                HeaderText = "HeaderText",
                Tools      = new ReactiveList <HudLayoutTool>
                {
                    new HudLayoutHeatMapTool
                    {
                        BaseStat = new StatInfo {
                            Stat = Stat.PFR
                        }
                    }
                }
            };

            var hudElement = new HudElementViewModel
            {
                Seat = 1,
            };

            var hudToolViewModelExpected = hudLayoutToolExpected.CreateViewModel(hudElement) as HudGaugeIndicatorViewModel;

            hudToolViewModelExpected.IsGraphIndicatorsDisabled = true;

            Assert.IsNotNull(hudToolViewModelExpected.GroupedStats);

            var hudToolViewModelActual = SerializerHelper.GetSerializedDeserializedObject(hudToolViewModelExpected);

            Assert.That(hudToolViewModelActual.Id, Is.EqualTo(hudToolViewModelExpected.Id));
            Assert.That(hudToolViewModelActual.ToolType, Is.EqualTo(hudToolViewModelExpected.ToolType));
            Assert.That(hudToolViewModelActual.Stats.Count, Is.EqualTo(hudToolViewModelExpected.Stats.Count));
            Assert.That(hudToolViewModelActual.BaseStat.Stat, Is.EqualTo(hudToolViewModelExpected.BaseStat.Stat));
            Assert.That(hudToolViewModelActual.Width, Is.EqualTo(hudToolViewModelExpected.Width));
            Assert.That(hudToolViewModelActual.Text, Is.EqualTo(hudToolViewModelExpected.Text));
            Assert.That(hudToolViewModelActual.HeaderText, Is.EqualTo(hudToolViewModelExpected.HeaderText));
            Assert.That(hudToolViewModelActual.Height, Is.EqualTo(hudToolViewModelExpected.Height));
            Assert.That(hudToolViewModelActual.Position, Is.EqualTo(hudToolViewModelExpected.Position));
            Assert.That(hudToolViewModelActual.IsGraphIndicatorsDisabled, Is.EqualTo(hudToolViewModelExpected.IsGraphIndicatorsDisabled));
            Assert.That(hudToolViewModelActual.GroupedStats.Count, Is.EqualTo(hudToolViewModelExpected.GroupedStats.Count));

            var hudGaugeIndicatorStats = hudToolViewModelActual.GroupedStats.SelectMany(x => x.Stats).ToArray();

            foreach (var groupedStat in hudToolViewModelExpected.GroupedStats)
            {
                foreach (var expectedHudGaugeIndicatorStat in groupedStat.Stats)
                {
                    var actualHudGaugeIndicatorStat = hudGaugeIndicatorStats.FirstOrDefault(x => x.Stat.Stat == expectedHudGaugeIndicatorStat.Stat.Stat);

                    Assert.IsNotNull(actualHudGaugeIndicatorStat);

                    if (expectedHudGaugeIndicatorStat.IsHeatMapVisible)
                    {
                        Assert.That(actualHudGaugeIndicatorStat.IsHeatMapVisible, Is.EqualTo(expectedHudGaugeIndicatorStat.IsHeatMapVisible));
                        Assert.That(actualHudGaugeIndicatorStat.HeatMapViewModel.BaseStat.Stat, Is.EqualTo(expectedHudGaugeIndicatorStat.HeatMapViewModel.BaseStat.Stat));
                    }
                }
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Creates a view model of the current <see cref="HudLayoutTiltMeterTool"/> instance
        /// </summary>
        /// <returns>View model of the current <see cref="HudBaseToolViewModel"/> instance</returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var toolViewModel = new HudTiltMeterViewModel(this, hudElement);

            return(toolViewModel);
        }
Esempio n. 13
0
        /// <summary>
        /// Creates a view model of the current <see cref="HudLayoutBumperStickersTool"/> instance
        /// </summary>
        /// <returns>View model of the current <see cref="HudBaseToolViewModel"/> instance</returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var toolViewModel = new HudBumperStickersViewModel(this, hudElement);

            return(toolViewModel);
        }
Esempio n. 14
0
        /// <summary>
        /// Creates a view model of the current <see cref="HudLayoutTiltMeterTool"/> instance
        /// </summary>
        /// <returns>View model of the current <see cref="HudBaseToolViewModel"/> instance</returns>
        public override HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement)
        {
            var toolViewModel = new HudPlayerIconViewModel(this, hudElement);

            return(toolViewModel);
        }
Esempio n. 15
0
 /// <summary>
 /// Creates a view model of the current <see cref="HudBaseToolViewModel"/> instance
 /// </summary>
 /// <returns>View model of the current <see cref="HudBaseToolViewModel"/> instance</returns>
 public abstract HudBaseToolViewModel CreateViewModel(HudElementViewModel hudElement);