Example #1
0
        static void Main(string[] args)
        {
            MapList mapList = new MapList();

            mapList.Add(3, "Fuzz");
            mapList.Add(5, "Buzz");

            foreach (string s in NumberList.GetNameNumberList(20, mapList))
            {
                Console.WriteLine(s);
            }
        }
Example #2
0
        private static void ReadConfig(string path)
        {
            Debuger.Log();
            string        jsonStr = FileUtils.ReadString(path);
            List <object> obj     = null;

            try
            {
                obj = Json.Deserialize(jsonStr) as List <object>;
            }
            catch (Exception e)
            {
                Debuger.LogError("文件加载失败:{0}", path);
                return;
            }

            for (int i = 0; i < obj.Count; i++)
            {
                var infoJson          = obj[i] as Dictionary <string, object>;
                ServerModuleInfo info = new ServerModuleInfo();
                info.id       = (int)infoJson["id"];
                info.name     = (string)infoJson["name"];
                info.assembly = (string)infoJson["assembly"];
                info.ip       = (string)infoJson["ip"];
                info.port     = (int)infoJson["port"];
                info.auto     = (bool)infoJson["auto"];
                MapServerModuleInfo.Add(info.id, info);
            }
        }
Example #3
0
        public void StartServer(int id)
        {
            Debuger.Log(id);

            ServerModuleInfo info     = ServerConfig.GetServerModuleInfo(id);
            string           fullName = ServerConfig.Namespace + "." + info.name + "." + info.name;

            try
            {
                Type type   = Type.GetType(fullName + "," + info.assembly);
                var  module = Activator.CreateInstance(type) as ServerModule;

                if (module != null)
                {
                    module.Create(info);
                    m_mapModule.Add(module.id, module);

                    module.Start();
                }
            }
            catch (Exception e)
            {
                Debuger.LogError(e.Message);
            }
        }
Example #4
0
        static void ChangeMap(Map map)
        {
            if (MapList == null)
            {
                MapList = new List <Map>();
            }
            switch (map.ChangeType)
            {
            case (int)ChangeMapType.新增:
                MapList.Add(map);
                break;

            case (int)ChangeMapType.修改:
                var item = MapList.Find(c => c.id == map.id);
                if (item != null)
                {
                    item = map;
                }
                else
                {
                    MapList.Add(map);
                }
                break;

            case (int)ChangeMapType.除:
                MapList.RemoveAll(c => c.id == map.id);
                break;
            }
            HandleLog.WriteLine($"映射{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{JsonHelper.Instance.Serialize(map)}", false);
            HandleLog.WriteLine($"【{map.name}】映射{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local} --> {map.remote}");
        }
Example #5
0
        private void GeneratePlace_Click(object sender, EventArgs e)
        {
            Place.ForeColor = Color.Black;
            int cnt = 0;

            for (int i = 0; i <= (MapListBox.Items.Count - 1); i++)
            {
                if (MapListBox.GetItemChecked(i))
                {
                    cnt = (i + 1);
                }
            }
            if (cnt >= 2)
            {
                for (i = 0; i <= (MapListBox.Items.Count - 1); i++)
                {
                    if (MapListBox.GetItemChecked(i))
                    {
                        MapList.Add(MapListBox.Items[i].ToString());
                    }
                }
                result = Convert.ToString((string)MapList[random.Next(0, MapList.Count)]);
                DesidePlace.Start();
            }
            else
            {
                MessageBox.Show("2つ以上の選択が必要", "Error");
            }
        }
Example #6
0
        private static void ChangeMapList(Map map)
        {
            try
            {
                switch (map.ChangeType)
                {
                case (int)ChangeMapType.新增:
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.修改:
                    MapList.RemoveAll(c => c.id == map.id);
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.除:
                    MapList.RemoveAll(c => c.id == map.id);
                    break;
                }
                LogHelper.Info($"服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.ToJson()}", false);
                LogHelper.Info($"【{map.name}】服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local_endpoint} --> {map.remote_endpoint}");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        /// <summary>
        /// 发送数据
        /// </summary>
        /// <typeparam name="TRsp"></typeparam>
        /// <param name="cmd"></param>
        /// <param name="req"></param>
        /// <param name="onRsp"></param>
        /// <param name="timeout"></param>
        /// <param name="onErr"></param>
        /// <returns>返回唯一的发送Index</returns>
        public uint Send <TRsp>(uint cmd, object req, Action <uint, TRsp> onRsp, float timeout = 30,
                                Action <NetErrorCode> onErr = null)
        {
            Debuger.LogVerbose("cmd:{0}, timeout:{1}", cmd, timeout);
            uint           index  = MessageIndexGenerator.NewIndex();
            ListenerHelper helper = new ListenerHelper()
            {
                cmd       = cmd,
                index     = index,
                TMsg      = typeof(TRsp),
                onErr     = onErr,
                onMsg0    = onRsp,
                timeout   = timeout,
                timestamp = SGFTime.GetTimeSinceStartup()
            };

            m_listRspListener.Add(index, helper);


            NetMessage msg = new NetMessage();

            msg.head.index    = index;
            msg.head.cmd      = cmd;
            msg.head.token    = m_token;
            msg.content       = PBSerializer.NSerialize(req);
            msg.head.dataSize = (uint)msg.content.Length;

            m_conn.Send(msg);
            return(index);
        }
Example #8
0
        static void ChangeMapList(Map map)
        {
            try
            {
                switch (map.ChangeType)
                {
                case (int)ChangeMapType.新增:
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.修改:
                    MapList.RemoveAll(c => c.id == map.id);
                    MapList.Add(map);
                    break;

                case (int)ChangeMapType.除:
                    MapList.RemoveAll(c => c.id == map.id);
                    break;
                }
                HandleLog.WriteLine($"服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{JsonHelper.Instance.Serialize(map)}", false);
                HandleLog.WriteLine($"【{map.name}】服务映射缓存{Enum.GetName(typeof(ChangeMapType), map.ChangeType)}成功:{map.local_endpoint} --> {map.remote_endpoint}");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
 public void ObjectFilter(IRunAsChain SelChain)
 {
     MapList.Clear();
     foreach (var ch in SelChain.Chain)
     {
         MapList.Add(ch);
     }
     ObjectFilter(MapList[0]);
 }
Example #10
0
        public FSPSession CreateSession()
        {
            Debuger.Log();
            uint       sid     = NewSessionID();
            FSPSession session = new FSPSession(sid, HandleSessionSend);

            m_mapSession.Add(sid, session);
            return(session);
        }
Example #11
0
        private void ButtonNewMap_Click(object sender, EventArgs e)
        {
            MapList.Add(new Map("Map " + ++MapCount));
            listViewMap.Items.Add("Map " + MapCount);

            SetMap setMap = new SetMap(this);

            setMap.ShowDialog();
        }
Example #12
0
 public static void UpdateMapList()
 {
     MapList.Clear();
     foreach (string file in Directory.GetFiles("Content/Map"))
     {
         //string s = TexturePath + "/" + Path.GetFileName(dir) + "/" + Path.GetFileNameWithoutExtension(file);
         //Textures.Add(Path.GetFileNameWithoutExtension(file), Content.Load<Texture2D>(s));
         MapList.Add(Path.GetFileNameWithoutExtension(file));
     }
 }
        //====================================================================================

        public UserData CreateUserData(uint id, string name)
        {
            UserData data = new UserData();

            data.name = name;
            data.id   = id;
            data.pwd  = "";
            m_mapUserData.Add(id, data);
            return(data);
        }
Example #14
0
        public bool AddBuff(ISkill skill, int buffId)
        {
            SkillUtil.LogWarning(string.Format(" [BUFFMANAGER]  [NAME]->{0}  AddBuff-> {1}",
                                               mContext.GetSelfActor().GetTransform().name, buffId));

            IBuff buff      = null;
            bool  canModify = true;
            float life      = 0;

            if (buffMap.ContainsKey(buffId))
            {
                buff      = buffMap[buffId];
                canModify = buff is IOverLayBuff;

                /*Buff
                 * 1.已经拥有 2.有持续时间 3.不可叠加
                 * -》直接刷新Buff的持续时间(Life)
                 */
                if (!canModify)
                {
                    RefreshTimerLife(buff);
                }
            }
            else
            {
                var  data      = SkillUtil.GetSkillBuffData(buffId);
                bool isOverLay = data.Attributes.Contains((int)EBuffAttributes.CanAdd);
                buff = isOverLay ? new OverlayBuff() : new Buff();
                buff.Create(skill, mContext.GetSelfActor(), buffId);
                buffMap.Add(buffId, buff);
            }

            if (canModify) //只有新加的和可叠加的Buff才能触发Modify
            {
                BuffModify(buffId);

                //1.先判定这个Buff 是不是一个循环定时器
                if (!TryAddLoopTimer(buffId))
                {
                    life = buff.GetDuringTime();
                    if (life > 0)
                    {
                        /* 可以执行到此处满足的条件:
                         * 1.不是循环定时器 2.有效的Buff生命周期life 3.可以叠加效果的老BUFF或者刚刚添加的新BUFF
                         * =》生成一个新的计时器
                         */
                        CreateNormalTimer(life, buffId);
                    }
                }
            }

            OnBuffEventDispatch(EBuffActionType.AddBuff);
            return(true);
        }
Example #15
0
        //=======================================================================
        //管理Game单局
        public FSPGame CreateGame(uint gameId, int authId)
        {
            Debuger.Log("gameId:{0}, auth:{1}", gameId, authId);

            FSPGame game = new FSPGame();

            game.Create(gameId, authId);

            m_mapGame.Add(gameId, game);
            return(game);
        }
Example #16
0
        public void RegisterService <T>() where T : class, IService
        {
            Type type = typeof(T);

            if (map.ContainsKey(type))
            {
                return;
            }

            var service = Activator.CreateInstance <T>();

            map.Add(type, service);
        }
Example #17
0
        /// <summary>
        /// Add resolver to composition.
        /// </summary>
        /// <param name="resolver"></param>
        /// <returns></returns>
        public ResolverComposition Add(IResolver resolver)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException(nameof(resolver));
            }
            if (isReadonly)
            {
                throw new InvalidOperationException("read-only");
            }

            resolvers.Add(resolver);

            // Add to resolvers by type
            Type[] intfs = resolver.GetType().GetInterfaces();
            foreach (Type itype in intfs.Where(i => i.IsGenericType && typeof(IResolver <>).Equals(i.GetGenericTypeDefinition())))
            {
                Type[] paramTypes  = itype.GetGenericArguments();
                var    resolveType = paramTypes[0];
                resolversByType.Add(resolveType, resolver);
            }

            // Add to resolvers by parameter name
            if (resolver is IParameterResolver parameterResolver_)
            {
                foreach (string parameterName in parameterResolver_.ParameterNames)
                {
                    resolversByParameterName.Add(parameterName, parameterResolver_);
                }
            }

            // Add to generic resolvers
            if (resolver is IGenericResolver genericResolver)
            {
                genericResolvers.Add(genericResolver);
            }

            // Update parameter names
            List <string> names = new List <string>();

            foreach (var r in resolvers)
            {
                if (r is IParameterResolver parameterResolver)
                {
                    names.AddRange(parameterResolver.ParameterNames);
                }
            }
            ParameterNames = names.Distinct().ToArray();
            return(this);
        }
Example #18
0
        public T RegisterService <T>() where T : class, IService
        {
            Type type = typeof(T);

            if (_map.ContainsKey(type))
            {
                return(_map[type] as T);
            }

            var service = Activator.CreateInstance <T>();

            _map.Add(type, service);
            return(service);
        }
Example #19
0
        private static void ReadConfig()
        {
            Debuger.Log();
            string jsonStr = FileUtils.ReadString(Path);
            var    obj     = MiniJSON.Json.Deserialize(jsonStr) as List <object>;

            for (int i = 0; i < obj.Count; i++)
            {
                var     infoJson = obj[i] as Dictionary <string, object>;
                IPCInfo info     = new IPCInfo();
                info.id   = (int)(long)infoJson["id"];
                info.port = (int)(long)infoJson["port"];
                s_MapIPCInfo.Add(info.id, info);
            }
        }
Example #20
0
        private void AddListener(uint cmd, Type TRsp, Delegate onRsp, uint index, float timeout, Action <NetErrorCode> onErr)
        {
            ListenerHelper helper = new ListenerHelper()
            {
                cmd       = cmd,
                index     = index,
                TMsg      = TRsp,
                onErr     = onErr,
                onMsg     = onRsp,
                timeout   = timeout,
                timestamp = SGFTime.GetTimeSinceStartup()
            };

            m_listRspListener.Add(index, helper);
        }
Example #21
0
        /// <summary>
        /// async/awaitを伴う初期化
        /// </summary>
        private async void initialize()
        {
            // マップ情報を取得
            var list = await model.GetMapList();

            if (list.Count == 0)
            {
                MessageBox.Show("マップ情報をダウンロードできませんでした。", "AWSK", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // マップ情報をリストに登録する
            foreach (string mapName in list)
            {
                MapList.Add(mapName);
            }
        }
Example #22
0
        private void DoReceiveInThread()
        {
            EndPoint remotePoint = IPUtils.GetIPEndPointAny(AddressFamily.InterNetwork, 0);
            int      cnt         = m_socket.ReceiveFrom(m_RecvBufferTemp, m_RecvBufferTemp.Length, SocketFlags.None, ref remotePoint);

            if (cnt > 0)
            {
                m_bufferReceive.Attach(m_RecvBufferTemp, cnt);
                byte[] m_32b = new byte[4];
                m_bufferReceive.ReadBytes(m_32b, 0, 4);
                uint sid = BitConverter.ToUInt32(m_32b, 0);

                lock (m_mapSession)
                {
                    KcpSession session = null;

                    if (sid == 0)
                    {
                        //来自Client的第1个包,只能是鉴权包
                        session = new KcpSession(NewSessionID(), m_listener);
                        m_mapSession.Add(session.Id, session);
                    }
                    else
                    {
                        session = m_mapSession[sid];
                    }


                    if (session != null)
                    {
                        session.Active(m_socket, remotePoint as IPEndPoint);
                        session.DoReceiveInGateway(m_RecvBufferTemp, cnt);
                    }
                    else
                    {
                        this.LogWarning("无效的包! sid:{0}", sid);
                        //需要返回给客户端,Session无效了,直接返回一个Sid为0的包
                        //当客户端收到包好,会抛出Session过期事件
                        //因为正常情况下,客户端收到的Session肯定不为0
                        m_socket.SendTo(new byte[4], remotePoint);
                    }
                }
            }
        }
Example #23
0
        public bool StartServer(ServerModuleInfo info)
        {
            string fullName = ServerConfig.Namespace + "." + info.name + "." + info.name;

            Debuger.Log(fullName);

            try
            {
                Type type = Type.GetType(fullName + "," + info.assembly);

                var module = Activator.CreateInstance(type) as ServerModule;

                if (module != null)
                {
                    module.Create(info);
                    m_mapModule.Add(info.id, module);

                    module.Start();

                    ServerConfig.SetServerModuleInfo(info);

                    //处理缓存的消息
                    if (m_mapCacheMessage.ContainsKey(info.id))
                    {
                        List <MessageObject> list = m_mapCacheMessage[info.id];
                        for (int i = 0; i < list.Count; i++)
                        {
                            MessageObject msgobj = list[i];
                            module.HandleMessage(msgobj.msg, msgobj.args);
                        }
                        m_mapCacheMessage.Remove(info.id);
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                m_mapModule.Remove(info.id);
                Debuger.LogError("ServerModule[{0}] Create Or Start Error:{1}", info.name,
                                 e.Message + "\n" + e.StackTrace);
            }
            return(false);
        }
Example #24
0
    // Use this for initialization
    void Start()
    {
        if (RandomSeed)
        {
            Seed = Random.Range(0, 10000);
        }

        for (int x = 0; x < Size; x++)
        {
            for (int y = 0; y < Size; y++)
            {
                MapTile tile = GameObject.Instantiate(MapTilePrefab, new Vector2(x + 0.5f, y + 0.5f), MapTilePrefab.transform.rotation) as MapTile;
                tile.Info.HumidityThreshold = DesertThreshold;
                float Elevation = Mathf.PerlinNoise((float)(x + Seed) * 0.018f, (float)(y + Seed) * 0.018f);
                tile.Info.Elevation = Elevation;
                tile.Info.Latitude  = (y - (Size / 2f)) / (Size / 2f);

                if (Elevation > Sealevel + BeachGap)
                {
                    tile.Type = TileType.Land;
                    float Hum1 = Mathf.PerlinNoise((float)(x + HumiditySeed + 1000) * 0.008f, (float)(y + HumiditySeed + 1000) * 0.008f);

                    tile.Info.Humidity = (Hum1 - 0.5f) + (1 - Elevation);
                }
                else if (Elevation > Sealevel)
                {
                    tile.Type                    = TileType.Beach;
                    tile.Info.Humidity           = 1.5f;
                    tile.Info.HumidityNormalized = 1.5f;
                }
                else
                {
                    tile.Type                    = TileType.Water;
                    tile.Info.Humidity           = 2f;
                    tile.Info.HumidityNormalized = 2f;
                }


                Map.Add(x, tile);
                tile.Init();
            }
        }
    }
Example #25
0
        private void DoReceiveInThread()
        {
            EndPoint remotePoint = IPUtils.GetIPEndPointAny(AddressFamily.InterNetwork, 0);
            int      cnt         = m_SystemSocket.ReceiveFrom(m_RecvBufferTemp, m_RecvBufferTemp.Length, SocketFlags.None, ref remotePoint);

            if (cnt > 0)
            {
                m_RecvBufferTempReader.Attach(m_RecvBufferTemp, cnt);
                byte[] m_32b = new byte[4];
                m_RecvBufferTempReader.ReadBytes(m_32b, 0, 4);
                uint sid = BitConverter.ToUInt32(m_32b, 0);
                //uint sid = m_RecvBufferTempReader.ReadUInt();


                lock (m_mapSession)
                {
                    ISession session = null;

                    if (sid == 0)
                    {
                        //来自Client的第1个包,只能是鉴权包
                        sid     = SessionID.NewID();
                        session = new KCPSession(sid, HandleSessionSend, m_listener);
                        m_mapSession.Add(session.id, session);
                    }
                    else
                    {
                        session = m_mapSession[sid];
                    }


                    if (session != null)
                    {
                        session.Active(remotePoint as IPEndPoint);
                        session.DoReceiveInGateway(m_RecvBufferTemp, cnt);
                    }
                    else
                    {
                        Debuger.LogWarning("无效的包! sid:{0}", sid);
                    }
                }
            }
        }
Example #26
0
        private void OnAcceptCompleted(object sender, SocketAsyncEventArgs e)
        {
            Socket acceptSocket = null;

            if (e.SocketError == SocketError.Success)
            {
                acceptSocket = e.AcceptSocket;
            }
            e.AcceptSocket = null;

            if (acceptSocket != null)
            {
                var sid     = NewSessionID();
                var session = new TcpSession(sid, m_saePool, m_listener);
                session.Active(acceptSocket);

                lock (m_mapSession)
                {
                    m_mapSession.Add(session.Id, session);
                }
            }

            this.AcceptAsync();
        }
        public void ComputeDefUseAndUseDefChains()
        {
            if (this.result == null)
            {
                throw new InvalidOperationException("Analysis result not available.");
            }

            this.def_use = new MapList <DefinitionInstruction, Instruction>();
            this.use_def = new MapList <Instruction, DefinitionInstruction>();

            foreach (var node in this.cfg.Nodes)
            {
                var input       = new HashSet <DefinitionInstruction>();
                var node_result = this.result[node.Id];

                if (node_result.Input != null)
                {
                    node_result.Input.ToSet(input);
                }

                var definitions = input.ToMapSet(def => def.Result);

                foreach (var instruction in node.Instructions)
                {
                    // use-def
                    foreach (var variable in instruction.UsedVariables)
                    {
                        if (definitions.ContainsKey(variable))
                        {
                            var var_defs = definitions[variable];

                            foreach (var definition in var_defs)
                            {
                                def_use.Add(definition, instruction);
                                use_def.Add(instruction, definition);
                            }
                        }
                        else
                        {
                            // Add all uses, even those with no reaching definitions.
                            use_def.Add(instruction);
                        }
                    }

                    // def-use
                    if (instruction is DefinitionInstruction)
                    {
                        var definition = instruction as DefinitionInstruction;

                        if (definition.HasResult)
                        {
                            var variable = definition.Result;

                            definitions.Remove(variable);
                            definitions.Add(variable, definition);

                            // Add all definitions, even those with no uses.
                            def_use.Add(definition);
                        }
                    }
                }
            }
        }
Example #28
0
 public void Play(DuelAnimation anim)
 {
     animQueue.Add(anim);
 }
Example #29
0
        /// <summary>
        /// Filters the log file based on <see cref="shipLoc"/> and the sector range listed in <see cref="textRange.Text"/>.</summary>
        /// Range calculation is simplified into a box shape for speed; min and max sector values are calculated for all three axis and the Map Log coordinates are kept if they fit in this box.
        private bool filterLog()
        {
            // Temporary storage for the new contents of the log file
            MapList tempLog = new MapList ();
            int range = MapPoint.intParse (txtRange.Text);
            // calculate sector ranges (+1 to make the range inclusive)
            int xmin = (int)shipLoc [0] - (range + 1);
            int xmax = (int)shipLoc [0] + (range + 1);
            int ymin = (int)shipLoc [1] - (range + 1);
            int ymax = (int)shipLoc [1] + (range + 1);
            int zmin = (int)shipLoc [2] - (range + 1);
            int zmax = (int)shipLoc [2] + (range + 1);

            // search for Map Log entries that are within the specified range
            foreach (MapPoint point in lstMasterLog) {
                if (point.sx > xmin && point.sx < xmax &&
                    point.sy > ymin && point.sy < ymax &&
                    point.sz > zmin && point.sz < zmax) {
                    tempLog.Add (point);
                }
            }

            // sort the new list, if desired
            if (chkSort.Active && sortNeeded) {
                tempLog.Sort (sorter);
                sortNeeded = false;
            }

            // convert the new list into a string before opening the file for write (minimize the time the file is open)
            string tempLogText = tempLog.ToString();
            // Replace the Map Log with the filtered resaults
            try {
                // delete the contents of the file before re-writing it. It's the easy way to ensure the file is overwritten and not appended to.
                deleteFile(btnMapLog.Label);
                using (System.IO.StreamWriter newLog = new System.IO.StreamWriter(OpenFile(btnMapLog.Label,true))) {
                    newLog.Write(tempLog.ToString());
                    newLog.Close();
                    // remember what was written
                    textMapLogFile = tempLogText;
                    // remember when the file was last written
                    lastLogged = getLastWriteTimeUTC(btnMapLog.Label);
                }
            } catch (System.ArgumentNullException) {
                // OpenFile should have already given an error message since OpenFile() returns null on error
            }
            return true;
        }
Example #30
0
        private void OnReceiveCompleted(object sender, SocketAsyncEventArgs e)
        {
            this.Log(e.SocketError.ToString());

            if (e.SocketError != SocketError.Success)
            {
                this.LogWarning(e.SocketError.ToString());
            }
            else
            {
                if (e.BytesTransferred == 0)
                {
                    this.LogWarning("收到的数据长度为0");
                }
                else
                {
                    m_bufferReceive.Attach(e.Buffer, e.BytesTransferred);
                    NetMessage msg = new NetMessage();
                    if (msg.Deserialize(m_bufferReceive))
                    {
                        lock (m_mapSession)
                        {
                            UdpSession session = null;

                            if (msg.head.sid == 0)
                            {
                                session = new UdpSession(NewSessionID(), m_pool, m_listener);
                                m_mapSession.Add(session.Id, session);
                            }
                            else
                            {
                                session = m_mapSession[msg.head.sid];
                                if (session == null)
                                {
                                    //对于UDP,可以重新分配SessionId
                                    session = new UdpSession(NewSessionID(), m_pool, m_listener);
                                    m_mapSession.Add(session.Id, session);
                                }
                            }


                            if (session != null)
                            {
                                session.Active(m_socket, (IPEndPoint)e.RemoteEndPoint);
                                session.DoReceiveInGateway(msg);
                            }
                            else
                            {
                                this.LogWarning("无效的包! sid:{0}", msg.head.sid);
                                //需要返回给客户端,Session无效了
                                UdpSession.ReturnErrorMessage(m_socket, (IPEndPoint)e.RemoteEndPoint,
                                                              NetErrorCode.SessionExpire, "Session Expired!");
                            }
                        }
                    }
                    else
                    {
                        this.LogError("反序列化失败!");
                    }
                }
            }

            this.ReceiveAsync();
        }
Example #31
0
 private void InitList()
 {
     MapList.Add(new MapData(MapNames.Lookout, 1, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Beach, 1, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Graveyard, 1, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Dungeon, 1, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Alleyways, 2, MapType.Regular));
     MapList.Add(new MapData(MapNames.Pen, 2, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Desert, 2, MapType.Regular));
     MapList.Add(new MapData(MapNames.AridLake, 2, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.FloodedMine, 2, MapType.Regular));
     MapList.Add(new MapData(MapNames.Marshes, 2, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Iceberg, 3, MapType.Regular));
     MapList.Add(new MapData(MapNames.Cage, 3, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Springs, 3, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Excavation, 3, MapType.Complex));
     MapList.Add(new MapData(MapNames.Leyline, 3, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Peninsula, 3, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Port, 3, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.BurialChambers, 3, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Cells, 3, MapType.Regular));
     MapList.Add(new MapData(MapNames.Arcade, 3, MapType.Regular));
     MapList.Add(new MapData(MapNames.CitySquare, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.RelicChambers, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.Courthouse, 4, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Strand, 4, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Chateau, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.Grotto, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.Gorge, 4, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Volcano, 4, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Lighthouse, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.Canyon, 4, MapType.Regular));
     MapList.Add(new MapData(MapNames.Conservatory, 5, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.SulphurVents, 5, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.HauntedMansion, 5, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Maze, 5, MapType.Regular));
     MapList.Add(new MapData(MapNames.Channel, 5, MapType.Regular));
     MapList.Add(new MapData(MapNames.ToxicSewer, 5, MapType.Regular));
     MapList.Add(new MapData(MapNames.AncientCity, 5, MapType.Regular));
     MapList.Add(new MapData(MapNames.IvoryTemple, 5, MapType.Complex));
     MapList.Add(new MapData(MapNames.SpiderLair, 5, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Barrows, 5, MapType.Complex));
     MapList.Add(new MapData(MapNames.Mausoleum, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Fields, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.JungleValley, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Phantasmagoria, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Academy, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Thicket, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Wharf, 6, MapType.Regular));
     MapList.Add(new MapData(MapNames.AshenWood, 6, MapType.Regular));
     MapList.Add(new MapData(MapNames.Atoll, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Cemetery, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.UndergroundSea, 6, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Tribunal, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.CoralRuins, 7, MapType.Regular));
     MapList.Add(new MapData(MapNames.LavaChamber, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Residence, 7, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Ramparts, 7, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Dunes, 7, MapType.Regular));
     MapList.Add(new MapData(MapNames.BoneCrypt, 7, MapType.Regular));
     MapList.Add(new MapData(MapNames.UndergroundRiver, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Gardens, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.ArachnidNest, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Bazaar, 7, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Laboratory, 8, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.InfestedValley, 8, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.OvergrownRuin, 8, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.VaalPyramid, 8, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Geode, 8, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Armoury, 8, MapType.Regular));
     MapList.Add(new MapData(MapNames.Courtyard, 8, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.MudGeyser, 8, MapType.Regular));
     MapList.Add(new MapData(MapNames.Shore, 8, MapType.Regular));
     MapList.Add(new MapData(MapNames.TropicalIsland, 8, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.MineralPools, 8, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.MoonTemple, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Sepulchre, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Tower, 9, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.WastePool, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Plateau, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Estuary, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Vault, 9, MapType.Bossroom)
     {
         Unsupported = true
     });
     MapList.Add(new MapData(MapNames.Temple, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Arena, 9, MapType.Complex));
     MapList.Add(new MapData(MapNames.Museum, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Scriptorium, 9, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Siege, 10, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Shipyard, 10, MapType.Regular));
     MapList.Add(new MapData(MapNames.Belfry, 10, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.ArachnidTomb, 10, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Wasteland, 10, MapType.Regular));
     MapList.Add(new MapData(MapNames.Precinct, 10, MapType.Regular));
     MapList.Add(new MapData(MapNames.Bog, 10, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Pier, 10, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.CursedCrypt, 10, MapType.Regular));
     MapList.Add(new MapData(MapNames.Orchard, 10, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Promenade, 11, MapType.Regular));
     MapList.Add(new MapData(MapNames.Lair, 11, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Colonnade, 11, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.PrimordialPool, 11, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.SpiderForest, 11, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Coves, 11, MapType.Regular));
     MapList.Add(new MapData(MapNames.Waterways, 11, MapType.Regular));
     MapList.Add(new MapData(MapNames.Factory, 11, MapType.Regular));
     MapList.Add(new MapData(MapNames.Mesa, 11, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Pit, 11, MapType.Regular));
     MapList.Add(new MapData(MapNames.DefiledCathedral, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Summit, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.OvergrownShrine, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.CastleRuins, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.CrystalOre, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Villa, 12, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.TortureChamber, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Necropolis, 12, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Racecourse, 12, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Caldera, 13, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Ghetto, 13, MapType.Regular));
     MapList.Add(new MapData(MapNames.Park, 13, MapType.Regular));
     MapList.Add(new MapData(MapNames.Malformation, 13, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.Terrace, 13, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Shrine, 13, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Arsenal, 13, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.DesertSpring, 13, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Core, 13, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.Colosseum, 14, MapType.Multilevel));
     MapList.Add(new MapData(MapNames.AcidLakes, 14, MapType.Regular));
     MapList.Add(new MapData(MapNames.DarkForest, 14, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.CrimsonTemple, 14, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Plaza, 14, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Dig, 14, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.Palace, 14, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.LavaLake, 15, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.Basilica, 15, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.SunkenCity, 15, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.Reef, 15, MapType.Bossroom)
     {
         UnsupportedBossroom = true
     });
     MapList.Add(new MapData(MapNames.Carcass, 15, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.VaalTemple, 16, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.ForgeOfPhoenix, 16, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.LairOfHydra, 16, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.MazeOfMinotaur, 16, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.PitOfChimera, 16, MapType.Bossroom));
     MapList.Add(new MapData(MapNames.VaultsOfAtziri, 3, MapType.Regular)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.WhakawairuaTuahu, 6, MapType.Multilevel)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.OlmecSanctum, 7, MapType.Complex)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.MaelstromOfChaos, 8, MapType.Bossroom)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.MaoKun, 9, MapType.Regular)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.PoorjoyAsylum, 9, MapType.Regular)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.PutridCloister, 9, MapType.Multilevel)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.CaerBlaiddWolfpackDen, 10, MapType.Bossroom)
     {
         Ignored = true
     });
     MapList.Add(new MapData(MapNames.Beachhead, 15, MapType.Bossroom)
     {
         Ignored = true
     });
 }