Exemplo n.º 1
0
        void Client_ReceiveAddUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint   identifier     = reader.ReadVariableUInt32();
            string name           = reader.ReadString();
            bool   bot            = reader.ReadBoolean();
            uint   userIdentifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            //check for already exists
            {
                Client_Player playerForCheck = Client_GetPlayer(identifier);

                if (playerForCheck != null)
                {
                    Log.Fatal("PlayerManager: Client_ReceiveAddUserToClient: Player " +
                              "with identifier \"{0}\" is already exists.", identifier);
                }
            }

            UserManagementClientNetworkService.UserInfo user = null;
            if (userIdentifier != 0)
            {
                user = GameNetworkClient.Instance.UserManagementService.GetUser(userIdentifier);
            }

            Client_Player player = new Client_Player(identifier, name, bot, user);

            client_players.Add(player);
        }
Exemplo n.º 2
0
		void Client_ReceiveRemoveUser( RemoteEntityWorld sender, ReceiveDataReader reader )
		{
			uint identifier = reader.ReadVariableUInt32();

			if( !reader.Complete() )
				return;

			Client_Player player = Client_GetPlayer( identifier );
			if( player == null )
				return;

			client_players.Remove( player );
		}
Exemplo n.º 3
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (client_players != null)
            {
                Client_Player cp = Client_GetPlayer(myName);

                if (cp != null)
                {
                    UploadAssaultCredits(cp);
                }
            }

            instance = null;
        }
Exemplo n.º 4
0
        void Client_ReceiveUpdateData(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            while (reader.BitPosition < reader.EndBitPosition)
            {
                uint  identifier = reader.ReadVariableUInt32();
                int   frags      = reader.ReadVariableInt32();
                float ping       = reader.ReadSingle();

                Client_Player player = Client_GetPlayer(identifier);

                if (player != null)
                {
                    player.Frags = frags;
                    player.Ping  = ping;
                }
            }
        }
Exemplo n.º 5
0
        private void Client_ReceiveRemoveUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint identifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Client_Player player = Client_GetPlayer(identifier);

            if (player == null)
            {
                return;
            }

            uint ui = GameNetworkClient.Instance.UserManagementService.ThisUser.Identifier;

            client_players.Remove(player);
        }
Exemplo n.º 6
0
        private void Client_ReceiveUpdateData(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            while (reader.BitPosition < reader.EndBitPosition)
            {
                uint  identifier     = reader.ReadVariableUInt32();
                int   hitPoints      = reader.ReadVariableInt32();
                int   killPoints     = reader.ReadVariableInt32();
                int   assaultCredits = reader.ReadVariableInt32();
                float ping           = reader.ReadSingle();

                Client_Player player = Client_GetPlayer(identifier);

                if (player != null)
                {
                    player.HitPoints      = hitPoints;
                    player.KillPoints     = killPoints;
                    player.AssaultCredits = assaultCredits;
                    player.Ping           = ping;
                }
            }
        }
Exemplo n.º 7
0
 //TODO -- Fix assault credits to local file
 private static void UploadAssaultCredits(Client_Player player)
 {
 }
Exemplo n.º 8
0
        void Client_ReceiveAddUser( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint identifier = reader.ReadVariableUInt32();
            string name = reader.ReadString();
            bool bot = reader.ReadBoolean();
            uint userIdentifier = reader.ReadVariableUInt32();

            if( !reader.Complete() )
                return;

            //check for already exists
            {
                Client_Player playerForCheck = Client_GetPlayer( identifier );

                if( playerForCheck != null )
                {
                    Log.Fatal( "PlayerManager: Client_ReceiveAddUserToClient: Player " +
                        "with identifier \"{0}\" is already exists.", identifier );
                }
            }

            UserManagementClientNetworkService.UserInfo user = null;
            if( userIdentifier != 0 )
                user = GameNetworkClient.Instance.UserManagementService.GetUser( userIdentifier );

            Client_Player player = new Client_Player( identifier, name, bot, user );
            client_players.Add( player );
        }
Exemplo n.º 9
0
 //TODO -- Fix assault credits to local file
 private static void UploadAssaultCredits(Client_Player player)
 { 
 
 }