Esempio n. 1
0
        public GamePadClient(IUdpClient udpClient, IPlatform platform) : base(udpClient, platform)
        {
            udpClient.CreateWithEmptyEndPoint();
            BroadCastEndPoint = udpClient.GetBroadCastEndPoint(Defaults.DEFAULT_SERVER_PORT);

            // TODO: Change this to a proper identity
            PlayerIdentity = PlayerIdentity.GenerateNew("Test Player");
        }
Esempio n. 2
0
 public override bool Equals(object obj)
 {
     if (obj is PlayerIdentity)
     {
         PlayerIdentity other = (PlayerIdentity)obj;
         return(other.Equals(m_identity));
     }
     else
     {
         return(false);
     }
 }
 public PlayerClient(PlayerIdentity playerIdentity, UdpIpEndPoint endPoint)
 {
     Identity = playerIdentity;
     EndPoint = endPoint;
 }
Esempio n. 4
0
        public NetworkPackage CreatePlayerJoinRequest(ClientServerInformation server, PlayerIdentity player, String password = "")
        {
            var result = new NetworkPackage(NetworkPackageType.ClientPlayerJoinRequest);

            var data = new Dictionary <String, object>();

            data.Add("playeridentity", player.ToString());
            data.Add("playername", player.Name);

            // If a password is provided, add it SHA1 hashed to the package
            if (password != String.Empty)
            {
                data.Add("password", Plaform.HashString(password));
            }

            result.AdditionalData = result.CreateAdditionalDataString(data);
            return(result);
        }
Esempio n. 5
0
        public void SendJoinRequest(ClientServerInformation server, PlayerIdentity playerIdentity, String password)
        {
            var package = CreatePlayerJoinRequest(server, playerIdentity, password);

            SendPackage(package, server.ServerEndPoint);
        }
Esempio n. 6
0
        public static PlayerIdentity GenerateNew(String name)
        {
            PlayerIdentity result = new PlayerIdentity(name);

            return(result);
        }