Esempio n. 1
0
        public GameService()
        {
            var connfactory = new DBConnectionFactory();

            conn = connfactory.Connect();
            conn.CreateTable();

            var worlds       = InstanceWorldManager.Instance;
            var defaultWorld = worlds.Get(InstanceWorldManager.DefaultID);

            var sessionLayer = NetworkStack.Session;

            sessionLayer.Connect.Received.Subscribe(d => HandleConnect(d.Session, d.Packet));
            sessionLayer.Disconnect.Received.Subscribe(d => HandleDisconnect(d.Session, d.Packet));
            sessionLayer.Ping.Received.Subscribe(d => HandlePing(d.Session, d.Packet));
            sessionLayer.Heartbeat.Received.Subscribe(d => HandleHeartbeat(d.Session, d.Packet));

            sessionLayer.SignUp.Received.Subscribe(d => HandleSignUp(d.Session, d.Packet));
            sessionLayer.Authentication.Received.Subscribe(d => HandleAuthentication(d.Session, d.Packet));

            sessionLayer.WorldJoin.Received.Subscribe(d => HandleWorldJoin(d.Session, d));
            sessionLayer.WorldLeave.Received.Subscribe(d => HandleWorldLeave(d.Session, d));

            sessionLayer.Attack.Received.Subscribe(d => EnqueueWorldPacket(d));
            sessionLayer.PlayerReady.Received.Subscribe(d => EnqueueWorldPacket(d));

            sessionLayer.Move.Received.Subscribe(d => EnqueueWorldPacket(d));
        }