Aborted
How do I use Aborted
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonNetwork.cs
Copy
1510 public static bool JoinRoom(string roomName, bool createIfNotExists)
1511 {
1512 if (connectionStateDetailed == PeerState.Joining || connectionStateDetailed == PeerState.Joined || connectionStateDetailed == PeerState.ConnectedToGameserver)
1513 {
1514 Debug.LogError("JoinRoom aborted: You can only join a room while not currently connected/connecting to a room.");
1515 }
1516 else if (room != null)
1517 {
1518 Debug.LogError("JoinRoom aborted: You are already in a room!");
1519 }
1520 else if (roomName == string.Empty)
1521 {
1522 Debug.LogError("JoinRoom aborted: You must specifiy a room name!");
1523 }
1524 else
1525 {
1526 if (offlineMode)
1527 {
1528 offlineModeRoom = new Room(roomName, null);
1529 NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnJoinedRoom);
1530 return true;
1531 }
1532 else
1533 {
1534 return networkingPeer.OpJoinRoom(roomName, null, null, createIfNotExists);
1535 }
1536 }
1537
1538 return false; // offline and OpJoin both return but the error-cases don't
1539 }
File name: PhotonNetwork.cs
Copy
2505 internal static void RPC(PhotonView view, string methodName, PhotonPlayer targetPlayer, bool encrpyt, params object[] parameters)
2506 {
2507 if (!VerifyCanUseNetwork())
2508 {
2509 return;
2510 }
2511
2512 if (room == null)
2513 {
2514 Debug.LogWarning("Cannot send RPCs in Lobby, only processed locally");
2515 return;
2516 }
2517
2518 if (player == null)
2519 {
2520 Debug.LogError("Error; Sending RPC to player null! Aborted \"" + methodName + "\"");
2521 }
2522
2523 if (networkingPeer != null)
2524 {
2525 networkingPeer.RPC(view, methodName, targetPlayer, encrpyt, parameters);
2526 }
2527 else
2528 {
2529 Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2530 }
2531 }
Aborted 125 lượt xem
Gõ tìm kiếm nhanh...