OnLeftRoom









How do I use On Left Room
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: MessageOverlay.cs Copy
18     public void OnLeftRoom()
19     {
20         SetActive(true);
21     }
File name: WorkerInGame.cs Copy
58     public void OnLeftRoom()
59     {
60         Debug.Log("OnLeftRoom (local)");
61
62         // back to main menu
63         Application.LoadLevel(WorkerMenu.SceneNameMenu);
64     }
File name: NetworkingPeer.cs Copy
459     private void LeftRoomCleanup()
460     {
461         bool wasInRoom = mRoomToGetInto != null;
462         // when leaving a room, we clean up depending on that room's settings.
463         bool autoCleanupSettingOfRoom = (this.mRoomToGetInto != null) ? this.mRoomToGetInto.autoCleanUp : PhotonNetwork.autoCleanUpPlayerObjects;
464
465         this.hasSwitchedMC = false;
466         this.mRoomToGetInto = null;
467         this.mActors = new Dictionary();
468         this.mPlayerListCopy = new PhotonPlayer[0];
469         this.mOtherPlayerListCopy = new PhotonPlayer[0];
470         this.mMasterClient = null;
471         this.allowedReceivingGroups = new HashSet();
472         this.blockSendingGroups = new HashSet();
473         this.mGameList = new Dictionary();
474         this.mGameListCopy = new RoomInfo[0];
475         this.isFetchingFriends = false;
476
477         this.ChangeLocalID(-1);
478
479         // Cleanup all network objects (all spawned PhotonViews, local and remote)
480         if (autoCleanupSettingOfRoom)
481         {
482             this.LocalCleanupAnythingInstantiated(true);
483             PhotonNetwork.manuallyAllocatedViewIds = new List(); // filled and easier to replace completely
484         }
485
486         if (wasInRoom)
487         {
488             SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom);
489         }
490     }
File name: PhotonClasses.cs Copy
427         public virtual void OnLeftRoom()
428         {
429         }
File name: PhotonNetwork.cs Copy
402     {
403         get
404         {
405             return isOfflineMode;
406         }
407
408         set
409         {
410             if (value == isOfflineMode)
411             {
412                 return;
413             }
414
415             if (value && connected)
416             {
417                 Debug.LogError("Can't start OFFLINE mode while connected!");
418             }
419             else
420             {
421                 if (networkingPeer.PeerState != PeerStateValue.Disconnected)
422                 {
423                     networkingPeer.Disconnect(); // Cleanup (also calls OnLeftRoom to reset stuff)
424                 }
425                 isOfflineMode = value;
426                 if (isOfflineMode)
427                 {
428                     NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnConnectedToMaster);
429                     networkingPeer.ChangeLocalID(1);
430                     networkingPeer.mMasterClient = player;
431                 }
432                 else
433                 {
434                     offlineModeRoom = null;
435                     networkingPeer.ChangeLocalID(-1);
436                     networkingPeer.mMasterClient = null;
437                 }
438             }
439         }
440     }
File name: PhotonNetwork.cs Copy
1838     public static bool LeaveRoom()
1839     {
1840         if (offlineMode)
1841         {
1842             offlineModeRoom = null;
1843             NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom);
1844         }
1845         else
1846         {
1847             if (room == null)
1848             {
1849                 Debug.LogWarning("PhotonNetwork.room is null. You don't have to call LeaveRoom() when you're not in one. State: " + PhotonNetwork.connectionStateDetailed);
1850             }
1851             return networkingPeer.OpLeave();
1852         }
1853
1854         return true;
1855     }
File name: SupportLogger.cs Copy
93     public void OnLeftRoom()
94     {
95         Debug.Log("SupportLogger OnLeftRoom().");
96     }

OnLeftRoom 170 lượt xem

Gõ tìm kiếm nhanh...