Exemple #1
0
        public void Move(float XCoord, float YCoord)
        {
            m_NearbyPosition.MyPositionX = XCoord;
            m_NearbyPosition.MyPositionY = YCoord;
            List <int> disconnectedPlayers = new List <int>();

            foreach (int playerId in m_NearbyPosition.Visitors)
            {
                var target = GameSession.Get(playerId);
                if (target != null && target.IsSocket)
                {
                    LCPlayerMove package = new LCPlayerMove();
                    package.LobbyPositionX = XCoord;
                    package.LobbyPositionY = YCoord;
                    package.PlayerId       = m_UserId;
                    byte[] buffer = CustomActionDispatcher.GeneratePackageStream(package.PacketActionId, ProtoBufUtils.Serialize(package));
                    target.SendAsync(buffer, 0, buffer.Length);
                }
                else
                {
                    disconnectedPlayers.Add(playerId);
                }
            }
            m_NearbyPosition.ModifyLocked(() =>
            {
                foreach (int playerId in disconnectedPlayers)
                {
                    m_NearbyPosition.Visitors.Remove(playerId);
                }
            });
        }
Exemple #2
0
 public Action1034(ActionGetter actionGetter)
     : base((short)1034, actionGetter)
 {
     m_RequestPacket  = null;
     m_ResponsePacket = new LCPlayerMove();
     m_UserId         = 0;
 }