Package com.github.xgameenginee.buffer

Examples of com.github.xgameenginee.buffer.GameUpBuffer


    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        ChannelBuffer cb = (ChannelBuffer) e.getMessage();
        if (cb.getShort(0) < 1) // client upstream msg must be more than zero.
            return;

        GameBoss.getInstance().getProcessor().process(new GameUpBuffer(cb, ((Connection) ctx.getAttachment())));
        // logger.info("#" + ctx.getChannel().getId() + " recv = " + type);
        super.messageReceived(ctx, e);
    }
View Full Code Here


            logger.debug("#" + c.getId() + " disconnected");
        super.channelDisconnected(ctx, e);
        if (c.getAttachment() != null) {
            ChannelBuffer cb = ChannelBuffers.buffer(2);
            cb.writeShort(0);
            GameUpBuffer disconnectEvent = new GameUpBuffer(cb, c);
            GameBoss.getInstance().getProcessor().process(disconnectEvent);
        } else {
            ConnectionManager.getInstance().removeConnection(c);
        }
        // XXX: You need to do this by yourself:
View Full Code Here

                            return;
                        }
                    }
                }
            }
            GameUpBuffer c = null;
            while ((c = msgQueue.poll()) != null) {
                short type = c.getShort();
                try {
                    GameHandler handler = GameHandlerManager.getInstance().getHandler(type);
                    if (handler != null) {
                        if (!handler.isSystem() && c.attachment() == null) // real upstream message
                            handler.process(c.getConnection(), c);
                        else if (handler.isSystem()) // the system message
                            handler.process(c.getConnection(), c);
                        else {
                            logger.error("error in upstream :" + type);
                        }
                    } else {
                        logger.error("error type = " + type);
View Full Code Here

TOP

Related Classes of com.github.xgameenginee.buffer.GameUpBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.