public GameNetworkManager2(GameServerConfig config)
            : base(config)
        {
            Tables = config.Tables;

            ServerInfo = new GameServerInfo();
            ServerInfo.ServerId = ServerId;
            ServerInfo.Type = Type;

            foreach (IGameTable gt in Tables)
            {
                ServerInfo.TableIds.Add(gt.TableId);
            }

            base.CreateHiveNode(ServerInfo);
        }
Example #2
0
        public GameServer(string appId, int listeningPort, string broadcastRange, string serverId, ServerType type)
        {
            ServerId = serverId;

            m_gtcTables = new GameTableCollection();
            Random rng = new Random((int)DateTime.Now.Ticks + DateTime.Now.Month + DateTime.Now.Day);

            for (int i = 0; i < 50; i++)
            {
                int smallBlind = rng.Next(10, 500);
                m_gtcTables.Add(ObjectFactory.CreateIGameTableTableInstance(smallBlind, smallBlind * 2, 9, Guid.NewGuid().ToString(), "Texas Holdem Table " + i, ServerId));
            }

            GameServerConfig config = new GameServerConfig();
            config.AppId = appId;
            config.BroadcastRange = broadcastRange;
            config.ListeningPort = listeningPort;
            config.Serializer = ObjectFactory.CreateISerializeInstance();
            config.ServerId = serverId;
            config.ServerType = type;
            config.Tables = m_gtcTables;

            m_nmNetworkManager = new GameNetworkManager2(config);
        }