当前位置: 首页>>代码示例>>C#>>正文


C# NetworkPlayer.ToString方法代码示例

本文整理汇总了C#中UnityEngine.NetworkPlayer.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkPlayer.ToString方法的具体用法?C# NetworkPlayer.ToString怎么用?C# NetworkPlayer.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.NetworkPlayer的用法示例。


在下文中一共展示了NetworkPlayer.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: client_authenticate_switch_handler

        public static void client_authenticate_switch_handler(string dataObject, NetworkPlayer np)
        {
            PurpleDebug.Log("Authentication Switch received: #" + np.ToString());
            if(np.ToString() == Constants.SERVER_ID_STRING && Network.isServer) return;

            _PMClient.Authentication authObject = PurpleSerializer.StringToObjectConverter<_PMClient.Authentication> (dataObject);
            bool validationResult = false;
            string newToken = string.Empty;

            // TODO...
        }
开发者ID:dannisliang,项目名称:PurpleScripts,代码行数:11,代码来源:PurpleNetworkBaseHandler.cs

示例2: client_authenticate_handler

        public static void client_authenticate_handler(string dataObject, NetworkPlayer np)
        {
            PurpleDebug.Log("Authentication received: #" + np.ToString());
            if(np.ToString() == Constants.SERVER_ID_STRING && Network.isServer) return;

            _PMClient.Authentication authObject = PurpleSerializer.StringToObjectConverter<_PMClient.Authentication> (dataObject);
            bool validationResult = false;
            string newToken = string.Empty;

            if(string.IsNullOrEmpty(authObject.ClientPassword))
            {
                validationResult = AccountHelper.ValidateAuthentication (authObject.ClientName, authObject.ClientToken);
                if(validationResult)
                    newToken = AccountHelper.GenerateToken(authObject.ClientName, authObject.ClientToken, np);
            }
            else
            {
                validationResult = AccountHelper.Login (authObject.ClientName, authObject.ClientPassword, np, out newToken);
            }

            authObject.validate = validationResult;
            authObject.timestamp = DateTime.Now;

            // save 2 spaces if monitoring is allowed otherwise just one for Admin/Mod/GM
            int maxAllowedConnections = PurpleServer.CurrentConfig.ServerMaxClients;
            maxAllowedConnections -= (PurpleServer.CurrentConfig.ServerAllowMonitoring) ? 2 : 1;

            authObject.ClientPassword = String.Empty;
            authObject.ClientToken = String.Empty;
            authObject.ClientAuthenticated = false;

            if(validationResult && PurpleServer.UserList.Count <= maxAllowedConnections)
            {
                authObject.ClientToken = newToken;
                authObject.ClientAuthenticated = true;

            }
            else if(validationResult)
            {
                PurpleNetworkUser playerReference = get_network_player_reference(np);
                if (playerReference.UserType != UserTypes.User)
                {
                    authObject.ClientToken = newToken;
                    authObject.ClientAuthenticated = true;
                }
            }
            AccountHelper.AddLog(get_network_player_reference(np).UserName, "client_authenticate_handler "
                                 + authObject.ClientName + " - "+ authObject.ClientAuthenticated);
            PurpleDebug.Log("Authentication result: " + authObject.ClientName + ": " + authObject.ClientAuthenticated);
            PurpleNetwork.ToPlayer(np, "server_authenticate_result", authObject);
        }
开发者ID:dannisliang,项目名称:PurpleScripts,代码行数:51,代码来源:PurpleNetworkBaseHandler.cs

示例3: getDebugName

 public static string getDebugName(NetworkPlayer player)
 {
     string address = formatAddress(player.ipAddress, player.port);
     string externalAddress = "(Ext:" + formatAddress(player.externalIP, player.externalPort) + ")";
     string guid = "[" + player.guid + "]";
     return string.Join(" ", new string[] {address, externalAddress, guid, player.ToString()});
 }
开发者ID:alvarogzp,项目名称:nextation,代码行数:7,代码来源:NetworkPlayerFormatter.cs

示例4: AddNewPlayer

    /// <summary>
    /// Called by UserManagementObjectController on the server whenever a new player has successfully connected.
    /// </summary>
    /// <param name="player">Newly connected player</param>
    /// <param name="isClient">True if Client connected</param>
    public void AddNewPlayer(NetworkPlayer player,bool isClient)
    {
        if (!networkPlayerMap.ContainsKey(player))
        {

            int playerCounter = 1;
            while (networkPlayerMap.ContainsValue("player" + System.Convert.ToString(playerCounter)))
            {
                playerCounter++;
            }

            Debug.Log("UserManager Unity player " + player.ToString() + "added as UserManager player" + System.Convert.ToString(playerCounter));
            networkPlayerMap.Add(player,"player" + System.Convert.ToString(playerCounter));

            if(isClient)
            {
                Debug.Log("RPC Call setname sent to player"+System.Convert.ToString(playerCounter));
                GameObject.Find("GUIObj").networkView.RPC("setName", player, "player" + System.Convert.ToString(playerCounter));
            }
            else
            {
                Debug.Log("Server setname sent to player"+System.Convert.ToString(playerCounter));
                GameObject.Find("GUIObj").GetComponent<MobileNetworkGUI>().setName("player" + System.Convert.ToString(playerCounter));
            }
        }
    }
开发者ID:peterklima,项目名称:ARJenga,代码行数:31,代码来源:UserManager.cs

示例5: client_validate_username_handler

 // HANDLER /////////////////////////
 // ACCOUNT /////////////////////////
 public static void client_validate_username_handler(string dataObject, NetworkPlayer np)
 {
     PurpleDebug.Log("Username validation received: #" + np.ToString());
     _PMBasic.Data basicData = PurpleSerializer.StringToObjectConverter<_PMBasic.Data> (dataObject);
     basicData.validate = AccountHelper.IsUniqueUsername (basicData.data);
     PurpleNetwork.ToPlayer (np, "server_validate_username_result", basicData);
 }
开发者ID:dannisliang,项目名称:PurpleScripts,代码行数:9,代码来源:PurpleNetworkAccountHandler.cs

示例6: OnPlayerConnected

    void OnPlayerConnected(NetworkPlayer player)
    {
        Debug.Log ("Client connected: " + player.ToString());

        OccludedPlayer newOplayer = new OccludedPlayer(player);
        _players.Add(newOplayer);
    }
开发者ID:nevyn,项目名称:Occluded,代码行数:7,代码来源:NetworkManager.cs

示例7: DisconnectPlayer

    void DisconnectPlayer(NetworkPlayer player)
    {
        if(Network.isClient)
        {
            Debug.Log("Player Disconnected: " + player.ToString());
        }

        // now we have to do the reverse lookup from
        // the NetworkPlayer --> GameObject
        // this is easy with the Hashtable

        if(players.ContainsKey(player))
        {
            // we check to see if the gameobject exists
            // or not first just as a safety measure
            // trying to destory a gameObject that
            // doesn't exist causes a runtime error

            if((GameObject)players[player]) {
                Destroy((GameObject)players[player]);
            }

            // we also have to remove the Hashtable entry

            players.Remove(player);
        }
    }
开发者ID:Game-Group,项目名称:dog-fighter,代码行数:27,代码来源:networkController.cs

示例8: PlayerLeft

 void PlayerLeft(NetworkPlayer player)
 {
     string key = player.ToString();
     if(PlayerNamesScript.names.ContainsKey (key))
         PlayerNamesScript.names.Remove(key);
     else
         Debug.Log ("Player we didn't know about left the game!?");
 }
开发者ID:Zatchmeister,项目名称:Dias,代码行数:8,代码来源:PlayerNamesScript.cs

示例9: ServerPlaceBlock

 public void ServerPlaceBlock( NetworkPlayer sender, int x, int y, int z, int chunkx, int chunky, int chunkz, int data )
 {
     if (EnableDebugLog) Debug.Log ("UniblocksServer: Received PlaceBlock from player " + sender.ToString());
     // You can check whether the change sent by the client is valid here
     // if (true) {
     DistributeChange (sender, x,y,z, chunkx, chunky,chunkz, data, false);
     // }
 }
开发者ID:fancybit,项目名称:VoxelPrototype,代码行数:8,代码来源:UniblocksServer.cs

示例10: SpawnPlayer

 void SpawnPlayer(NetworkPlayer player)
 {
     string tempPlayerString = player.ToString ();
         int playerNumber = Convert.ToInt32(tempPlayerString);
         Transform newPlayerTransform = (Transform)Network.Instantiate (playerPrefab, transform.position, transform.rotation, playerNumber);
         playerScripts.Add (newPlayerTransform.GetComponent ("CubeScriptAuthoritative"));//that's the authoritative movement script
         NetworkView theNetworkView = newPlayerTransform.networkView;
         theNetworkView.RPC ("SetPlayer", RPCMode.AllBuffered, player);
 }
开发者ID:ChrisHorrigan,项目名称:NetworkingTutorial,代码行数:9,代码来源:Authoritative.cs

示例11: SyncMyPosition

 void SyncMyPosition(NetworkPlayer np, Vector3 position)
 {
     foreach(NetworkPlayer npp in Network.connections){
         if(npp.ToString() == np.ToString()){
             transform.position = position;
             break;
         }
     }
 }
开发者ID:Sacristan,项目名称:infinite-void,代码行数:9,代码来源:RPCs.cs

示例12: AddPlayerToList

    void AddPlayerToList(NetworkPlayer nPlayer)
    {
        //Create a new entry in the PlayerList and supply the players Network ID as the first entry
        PlayerDataClass capture = new PlayerDataClass();

        capture.networkPlayer = int.Parse(nPlayer.ToString());

        PlayerList.Add (capture);
    }
开发者ID:CharlesVI,项目名称:UnityFPS,代码行数:9,代码来源:PlayerDatabase.cs

示例13: EditPlayerListWithScore

 void EditPlayerListWithScore(NetworkPlayer nPlayer, int pScore)
 {
     for(int i = 0; i < PlayerList.Count; i++)
     {
         if(PlayerList[i].networkPlayer == int.Parse (nPlayer.ToString ()))
         {
             PlayerList[i].playerScore = pScore;
         }
     }
 }
开发者ID:AnthonyB28,项目名称:FPS_Unity,代码行数:10,代码来源:PlayerDatabase.cs

示例14: AddPlayerNameToList

	void AddPlayerNameToList(NetworkPlayer rpcNetPlayer)//takes the onplayerconncted(netplayer.tostring) ID. 
	{
		for(int i = 0; i<OBplayer.Count; i++)
		{
		   if(OBplayer[i].PlayerIndex == int.Parse (rpcNetPlayer.ToString()))
			{
				OBplayer[i].PlayerName = setPlayerName; //this setPlayerName was set globally from menumanager RPC also nameset = true so it fires
			}
		}
	}
开发者ID:ionescuvictor,项目名称:Multiplayer-fps-game-in-Unity3d,代码行数:10,代码来源:PlayerDatabase.cs

示例15: RemovePlayerFromList

	void RemovePlayerFromList(NetworkPlayer rpcNetPlayer)
	{
		for(int i = 0; i<OBplayer.Count; i++)
		{
		   if(OBplayer[i].PlayerIndex == int.Parse (rpcNetPlayer.ToString()))
			{
				OBplayer.RemoveAt(i); 
			}
		}
	}
开发者ID:ionescuvictor,项目名称:Multiplayer-fps-game-in-Unity3d,代码行数:10,代码来源:PlayerDatabase.cs


注:本文中的UnityEngine.NetworkPlayer.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。