/// <summary>
        /// Initializes position and size for the current <see cref="HudPlainStatBoxViewModel"/> for the specified <see cref="EnumPokerSites"/> and <see cref="EnumGameType"/>
        /// </summary>
        /// <param name="pokerSite"><see cref="EnumPokerSites"/></param>
        /// <param name="gameType"><see cref="EnumGameType"/></param>
        /// <exception cref="DHBusinessException" />
        public override void InitializePositions(EnumPokerSites pokerSite, EnumTableType tableType, EnumGameType gameType)
        {
            if (!(Tool is T tool))
            {
                return;
            }

            var seats       = (int)tableType;
            var currentSeat = Parent.Seat - 1;

            var uiPosition = tool.UIPositions.FirstOrDefault(x => x.Seat == Parent.Seat);

            if (uiPosition == null)
            {
                LogProvider.Log.Warn($"Could not find UI positions for {pokerSite}, {gameType}, {Parent.Seat}, {tool.ToolType}");
            }

            var positionInfo = tool.Positions.FirstOrDefault(x => x.PokerSite == pokerSite && x.GameType == gameType);

            var hudPositionInfo = positionInfo?.HudPositions.FirstOrDefault(x => x.Seat == Parent.Seat);

            if (hudPositionInfo == null)
            {
                var positionProvider = ServiceLocator.Current.GetInstance <IPositionProvider>(pokerSite.ToString());

                if (!positionProvider.Positions.ContainsKey(seats))
                {
                    throw new DHBusinessException(new NonLocalizableString($"Could not find predefined positions for {pokerSite}, {gameType}, {Parent.Seat}"));
                }

                var playerLabelClientPosition = positionProvider.Positions[seats];

                var playerLabelPosition = HudDefaultSettings.TablePlayerLabelPositions[seats];

                var offsetX = playerLabelClientPosition[currentSeat, 0] - playerLabelPosition[currentSeat, 0];
                var offsetY = playerLabelClientPosition[currentSeat, 1] - playerLabelPosition[currentSeat, 1];

                var positionX = uiPosition != null ? uiPosition.Position.X : default(double);
                var positionY = uiPosition != null ? uiPosition.Position.Y : default(double);

                // do not change position if element is inside or above player label
                if (positionY > playerLabelPosition[currentSeat, 1] + HudDefaultSettings.TablePlayerLabelActualHeight)
                {
                    offsetY += positionProvider.PlayerLabelHeight - HudDefaultSettings.TablePlayerLabelHeight;
                }

                hudPositionInfo = new HudPositionInfo
                {
                    Seat     = Parent.Seat,
                    Position = new Point(positionX + offsetX, positionY + offsetY)
                };
            }

            Position = hudPositionInfo.Position;
            Opacity  = Parent.Opacity;

            Width  = uiPosition != null && uiPosition.Width != 0 && !UseDefaultSizesOnly ? uiPosition.Width : DefaultWidth;
            Height = uiPosition != null && uiPosition.Height != 0 && !UseDefaultSizesOnly ? uiPosition.Height : DefaultHeight;
        }
Пример #2
0
        private Point GetOffset(EnumPokerSites pokerSite, EnumGameType gameType, EnumTableType tableType, int seat)
        {
            if (pokerSite == EnumPokerSites.Ignition || pokerSite == EnumPokerSites.Bovada || pokerSite == EnumPokerSites.Bodog)
            {
                return(new Point(0, -27));
            }

            var hudPanelService = ServiceLocator.Current.GetInstance <IHudPanelService>(pokerSite.ToString());

            var shifts = hudPanelService.GetPositionShift(tableType, seat);

            return(shifts);
        }
        private void CreatePlayersLayout(RadDiagram diagram, HudDragCanvas dgCanvas, ReplayerViewModel viewModel)
        {
            var seats = (int)CurrentCapacity;

            var positionProvider = ServiceLocator.Current.GetInstance <IPositionProvider>(ReplayerPokerSite.ToString());

            var labelPositions = positionProvider.Positions[seats];
            var hasHoleCards   = viewModel.CurrentGame.Players.Any(x => x.hasHoleCards);
            var cardsCount     = hasHoleCards ? viewModel.CurrentGame.Players.Where(x => x.hasHoleCards).Max(x => x.HoleCards.Count) : 2;

            for (var i = 0; i < seats; i++)
            {
                var player = viewModel.PlayersCollection[i];
                var label  = CreatePlayerLabel(player);

                label.X = labelPositions[i, 0];
                label.Y = labelPositions[i, 1];

                PlaceCardLabels(diagram, label, cardsCount);

                player.ChipsContainer.ChipsShape.X = predefinedChipsPositions[seats][i, 0];
                player.ChipsContainer.ChipsShape.Y = predefinedChipsPositions[seats][i, 1];

                AddPotPlayerLabel(diagram, viewModel.PlayersCollection[i], predefinedChipsPositions[seats][i, 0], predefinedChipsPositions[seats][i, 1]);

                diagram.AddShape(label);
                diagram.AddShape(player.ChipsContainer.ChipsShape);
            }
        }
        public static string ToShortPokerSiteName(this EnumPokerSites site)
        {
            switch (site)
            {
            case EnumPokerSites.Adda52:
                return("ADDA");

            case EnumPokerSites.AmericasCardroom:
                return("ACR");

            case EnumPokerSites.BetOnline:
                return("BOL");

            case EnumPokerSites.BlackChipPoker:
                return("BCP");

            case EnumPokerSites.GGN:
                return("GG");

            case EnumPokerSites.Horizon:
                return("REV");

            case EnumPokerSites.PartyPoker:
                return("PP");

            case EnumPokerSites.Poker888:
                return("888");

            case EnumPokerSites.PokerBaazi:
                return("PB");

            case EnumPokerSites.PokerKing:
                return("PK");

            case EnumPokerSites.PokerMaster:
                return("PM");

            case EnumPokerSites.PokerStars:
                return("PS");

            case EnumPokerSites.PPPoker:
                return("PPP");

            case EnumPokerSites.RedDragon:
                return("RD");

            case EnumPokerSites.SpartanPoker:
                return("TSP");

            case EnumPokerSites.SportsBetting:
                return("SB");

            case EnumPokerSites.TigerGaming:
                return("TG");

            case EnumPokerSites.TruePoker:
                return("TP");

            case EnumPokerSites.Winamax:
                return("WMX");

            case EnumPokerSites.WinningPokerNetwork:
                return("WPN");

            case EnumPokerSites.YaPoker:
                return("YP");

            default:
                break;
            }

            return(site.ToString());
        }
Пример #5
0
        /// <summary>
        /// Gets the list of <see cref="HudPositionInfo"/> of element for the specified <see cref="EnumPokerSites"/>, <see cref="EnumTableType"/>
        /// </summary>
        /// <param name="pokerSite"></param>
        /// <param name="tableType"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        private List <HudPositionInfo> GetHudPositionInfo(EnumPokerSites pokerSite, EnumTableType tableType, Point position)
        {
            var positionsInfo = new List <HudPositionInfo>();

            // in designer only 2-max and 1st seat are available
            var labelPositions = HudDefaultSettings.TablePlayerLabelPositions[(int)EnumTableType.HU];

            var labelPositionX = labelPositions[0, 0];
            var labelPositionY = labelPositions[0, 1];

            var offsetX = position.X - labelPositionX;
            var offsetY = position.Y - labelPositionY;

            var positionProvider = ServiceLocator.Current.GetInstance <IPositionProvider>(pokerSite.ToString());

            var seats = (int)tableType;

            var tableTypeSize = (int)tableType;

            if (!positionProvider.Positions.ContainsKey(tableTypeSize))
            {
                return(positionsInfo);
            }

            var positions = positionProvider.Positions[tableTypeSize];

            for (var seat = 0; seat < seats; seat++)
            {
                var positionX = positions[seat, 0];
                var positionY = positions[seat, 1];

                var positionInfo = new HudPositionInfo
                {
                    Seat     = seat + 1,
                    Position = new Point(positionX + offsetX, positionY + offsetY)
                };

                positionsInfo.Add(positionInfo);
            }

            return(positionsInfo);
        }