public StartConfig GetAddressByAccount(string account)
 {
     if (AccountGateIndex.ContainsKey(account))
     {
         return(this.GateAddress[AccountGateIndex[account]]);
     }
     else
     {
         int         n      = RandomHelper.RandomNumber(0, this.GateAddress.Count);
         StartConfig config = this.GateAddress[n];
         AccountGateIndex.Add(account, n);
         return(config);
     }
 }
示例#2
0
        public override AChannel ConnectChannel(IPEndPoint remoteEndPoint)
        {
            uint     conv    = (uint)RandomHelper.RandomNumber(1000, int.MaxValue);
            KChannel channel = new KChannel(conv, this.socket, remoteEndPoint, this);
            KChannel oldChannel;

            if (this.idChannels.TryGetValue(channel.Id, out oldChannel))
            {
                this.idChannels.Remove(oldChannel.Id);
                oldChannel.Dispose();
            }
            this.idChannels[channel.Id] = channel;
            return(channel);
        }
        public StartConfig GetAddress(long roleId)
        {
            StartConfig ret = null;

            if (mLoginedAdrees.TryGetValue(roleId, out ret))
            {
                return(ret);
            }
            else
            {
                int n = RandomHelper.RandomNumber(0, this.GateAddress.Count);
                ret = this.GateAddress[n];
                mLoginedAdrees[roleId] = ret;
                return(ret);
            }
        }
        public MatchInfo CreateRoomInfo()
        {
            Random r  = new Random();
            int    id = r.Next(100000, 999999);

            while (mMathcInfos.ContainsKey(id))
            {
                id = r.Next(100000, 999999);
            }
            MatchInfo info = new MatchInfo();

            info.RoomId = id;
            List <StartConfig> mapConfigs = Game.Scene.GetComponent <StartConfigComponent>().MapConfigs;
            int n = RandomHelper.RandomNumber(0, mapConfigs.Count);

            info.Adress = mapConfigs[n].GetComponent <InnerConfig>().IPEndPoint;
            return(info);
        }
示例#5
0
        /// <summary>
        /// 随机获取一个启动配置
        /// </summary>
        /// <returns></returns>
        public StartConfig GetAddress()
        {
            int n = RandomHelper.RandomNumber(0, this.MapAddress.Count);

            return(this.MapAddress[n]);
        }
        public Entity GetAddress()
        {
            int n = RandomHelper.RandomNumber(0, this.GateAddress.Count);

            return(this.GateAddress[n]);
        }