Example #1
0
        public void MsgUpdateInfo(Player player, ProtocolBase protoBase)
        {
            Room room = player.tempData.room;

            if (room == null)
            {
                return;
            }
            int           start     = 0;
            ProtocolBytes protocol  = (ProtocolBytes)protoBase;
            string        protoName = protocol.GetString(start, ref start);
            float         x         = protocol.GetFloat(start, ref start);
            float         y         = protocol.GetFloat(start, ref start);

            //int score = protocol.GetInt(start, ref start);
            room.UpdateInfo(player.id, x, y);

            ProtocolBytes protocolRet = new ProtocolBytes();

            protocolRet.AddString("UpdateInfo");
            protocolRet.AddString(player.id);
            protocolRet.AddFloat(x);
            protocolRet.AddFloat(y);
            //protocolRet.AddInt(score);
            room.Broadcast(protocolRet);
        }
Example #2
0
        public void SendPlayerList(Player player)
        {
            ProtocolBytes protocol = new ProtocolBytes();

            protocol.AddString("GetList");
            foreach (Player p in list.Values)
            {
                protocol.AddString(p.id);
                protocol.AddFloat(p.sceneData.x);
                protocol.AddFloat(p.sceneData.y);
                //protocol.AddInt(p.sceneData.score);
            }
            player.Send(protocol);
        }
Example #3
0
        public void SendPlayerList(Player player)
        {
            int           count    = list.Count;
            ProtocolBytes protocol = new ProtocolBytes();

            protocol.AddString("GetList");
            protocol.AddInt(count);
            foreach (ScenePlayer p in list.Values)
            {
                protocol.AddString(p.id);
                protocol.AddFloat(p.x);
                protocol.AddFloat(p.y);
                protocol.AddInt(p.score);
            }
            player.Send(protocol);
        }