Пример #1
0
        public Task <RetType> RegisterChannel(ChannelInfo info)
        {
            RetType ret = new RetType();

            if (m_ChannelList.Count >= 20)
            {
                ret.Error = -1;
            }
            else
            {
                ret.Port  = 7575 + m_ChannelList.Count;
                ret.UID   = m_ChannelList.Count;
                info.port = (short)ret.Port;
                m_ChannelList.Add(info);
            }
            Console.WriteLine("进行注册频道{0}", ret.UID);
            Task.Run(async() =>
            {
                await world.AddChannelInfo(worldEntity.WorldId, info);
            }).Wait();
            return(Task.FromResult(ret));
        }