示例#1
0
        /// <summary>
        /// 注册所有模块的网络消息到包管理器里
        /// </summary>
        /// <param name="modules"></param>
        /// <param name="handlers"></param>
        public static void Register(ILogicModule[] modules, PacketHandlersBase handlers)
        {
            foreach (var m in modules)
            {
                if (m is TradeAge.Server.Interface.Server.IGame)
                {
                    IProtoclAutoCode pac = new IGameAccess1();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.IGame);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }                if (m is TradeAge.Server.Interface.Server.ILogin)
                {
                    IProtoclAutoCode pac = new ILoginAccess2();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.ILogin);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }                if (m is TradeAge.Server.Interface.Server.IScene)
                {
                    IProtoclAutoCode pac = new ISceneAccess3();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.IScene);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }
            }
        }
示例#2
0
        /// <summary>
        /// 注册所有模块的网络消息到包管理器里
        /// </summary>
        /// <param name="modules"></param>
        /// <param name="handlers"></param>
        public static void Register(ILogicModule[] modules, PacketHandlersBase handlers)
        {
            foreach (var m in modules)
            {
                if (m is TradeAge.Server.Interface.Server.IGame)
                {
                    IProtoclAutoCode pac = new IGameAccess1();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.IGame);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }
                if (m is TradeAge.Server.Interface.Server.ILogin)
                {
                    IProtoclAutoCode pac = new ILoginAccess2();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.ILogin);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }
                if (m is TradeAge.Server.Interface.Server.IScene)
                {
                    IProtoclAutoCode pac = new ISceneAccess3();
                    list.Add(pac);

                    pac.SetModule(m as TradeAge.Server.Interface.Server.IScene);
                    pac.PacketHandlerManager = handlers;
                    pac.Init();
                }
            }
        }