Exemple #1
0
        static void InitialiseGameConnectionHandler(IContainer container)
        {
            Debug.Assert(container != null);

            var engine         = container.Resolve <IGameEngine>();
            var packetHandlers = container.Resolve <IPacketHandler[]>();

            Debug.Assert(engine != null);
            Debug.Assert(packetHandlers != null);

            GameConnectionHandler.Init(engine, packetHandlers);
        }
Exemple #2
0
        protected override void InitChannel(ISocketChannel channel)
        {
            Debug.Assert(channel != null);

            var pipeline = channel.Pipeline;

            pipeline.AddLast(new GameMessageDecoder());

            var session = new GameConnectionHandler(channel);

            pipeline.AddLast(session);

            engine.RegisterSession(session);
        }
Exemple #3
0
        public static void Attach(int id, GameConnectionHandler client, AccountView account, bool killSession = true)
        {
            PlayerController controller = null;

            lock (_lock) {
                if (!Players.TryGetValue(id, out controller))
                {
                    Players[id] = controller = new PlayerController(account);
                }

                client.Controller = controller;
            }

            if (controller != null)
            {
                controller.Initialize(client, killSession);
            }
        }