public TableDescription(int hash, EnumTableType tableType, EnumPokerSites pokerSite, EnumGameType gameType)
 {
     Hash      = hash;
     TableType = tableType;
     PokerSite = pokerSite;
     GameType  = gameType;
 }
        private IList <StatInfo> GetHudStats(EnumPokerSites pokerSite, EnumGameType gameType, EnumTableType tableType)
        {
            var activeLayout = hudLayoutsService.GetActiveLayout(pokerSite, tableType, gameType);

            if (activeLayout == null)
            {
                LogProvider.Log.Error("Could not find active layout");
                return(null);
            }

            return(activeLayout.LayoutTools.OfType <HudLayoutPlainBoxTool>().SelectMany(x => x.Stats).ToArray());
        }
Exemplo n.º 3
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);
        }
        public int GetHash(EnumPokerSites pokerSite, EnumGameType gameType, EnumTableType tableType)
        {
            unchecked
            {
                var hashCode = (int)2166136261;

                hashCode = (hashCode * 16777619) ^ pokerSite.GetHashCode();
                hashCode = (hashCode * 16777619) ^ gameType.GetHashCode();
                hashCode = (hashCode * 16777619) ^ tableType.GetHashCode();

                return(hashCode);
            }
        }
Exemplo n.º 5
0
        private HudElementViewModel CreateHudElement(HudLayoutInfoV2 layout, EnumGameType enumGameType)
        {
            var hudElementCreator = new HudElementViewModelCreator();

            var hudElementCreationInfo = new HudElementViewModelCreationInfo
            {
                GameType      = enumGameType,
                HudLayoutInfo = layout,
                PokerSite     = EnumPokerSites.Ignition,
                SeatNumber    = 1
            };

            var hudElement = hudElementCreator.Create(hudElementCreationInfo);

            hudElement.PlayerName = "Player";
            hudElement.PlayerId   = 1;

            return(hudElement);
        }
Exemplo n.º 6
0
 /// <summary>
 /// To create a game of given type.
 /// </summary>
 /// <param name="type">game type.</param>
 /// <returns>a game instance</returns>
 public static IGame CreateGame(EnumGameType type)
 {
     IGame game = null;
     switch (type) {
         case EnumGameType.Single:
         case EnumGameType.Multiple:
             game = new LocalGame(type, null); // assign the container later
             break;
         case EnumGameType.Host:
             game = new ServerGame();
             break;
         case EnumGameType.Client:
             game = new ClientGame();
             break;
         default:
             throw new GameException("This type of game is not implmented.", null);
     }
     return game;
 }
Exemplo n.º 7
0
        public void LoadLayout(string layoutName, EnumPokerSites pokerSite, EnumGameType gameType, EnumTableType tableType)
        {
            try
            {
                LogProvider.Log.Info($"Set layout {layoutName} as active for {pokerSite} {gameType} {tableType}");

                var hudLayoutsService = ServiceLocator.Current.GetInstance <IHudLayoutsService>();

                var hudToLoad = hudLayoutsService.GetLayout(layoutName);

                if (hudToLoad == null)
                {
                    LogProvider.Log.Info(this, $"Could not find layout with name {layoutName} for {pokerSite} {gameType} {tableType}");
                    return;
                }

                hudLayoutsService.SetActiveLayout(hudToLoad, pokerSite, gameType, tableType);
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, $"Could not load layout #{layoutName} for {pokerSite}, {gameType}, {tableType}", e);
            }
        }
Exemplo n.º 8
0
 public static bool IsTournamentGameType(this EnumGameType gameType)
 {
     return(tournamentGameTypes.Contains(gameType));
 }
Exemplo n.º 9
0
 public TetrisGame(EnumGameType type)
     : this()
 {
     this.GameType = type;
 }
        /// <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;
        }
Exemplo n.º 11
0
 public override void InitializePositions(EnumPokerSites pokerSite, EnumTableType tableType, EnumGameType gameType)
 {
 }
Exemplo n.º 12
0
        private void StartLocalGame(EnumGameType type, IList<Player> players)
        {
            LocalGame game = GameFactory.CreateGame(type) as LocalGame;
            game.Container = m_gameContainer;
            foreach (Player player in players) {
                if (null == player.PlayFiled)
                    player.PlayFiled = new PlayPanel(false);
                this.InitPlayer(player);
                game.AddPlayer(player);
            }

            if (null != m_game)
                m_game.Dispose();

            m_game = game;
            game.New();
            this.Refresh();
            game.Start();
        }
Exemplo n.º 13
0
 public LocalGame(EnumGameType type, Form container)
     : base(type)
 {
     this.Container = container;
     PrivateInit();
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes position and size for the current <see cref="HudBaseToolViewModel"/> for the specified <see cref="EnumPokerSites"/> and <see cref="EnumGameType"/>
 /// </summary>
 /// <exception cref="DHBusinessException" />
 public abstract void InitializePositions(EnumPokerSites pokerSite, EnumTableType tableType, EnumGameType gameType);
 public static void LoadLayout(string layoutName, EnumPokerSites pokerSite, EnumGameType gameType, EnumTableType tableType)
 {
     _callback?.LoadLayout(layoutName, pokerSite, gameType, tableType);
 }