Unity/C# кодер
Регистрация: 03.10.2005
Адрес: Россия, Рязань
Сообщений: 7,568
Написано 3,006 полезных сообщений (для 5,323 пользователей)
|
Ответ: Фак по Юнити.
Проверка нахождения в комнате:
PhotonNetwork.room != null
По поводу сообщений... откуда ты такие события взял?
есть OnJoinedRoom, OnJoinedLobby и т.д.

/// <summary> /// This enum makes up the set of MonoMessages sent by Photon Unity Networking. /// Implement any of these constant names as method and it will be called /// in the respective situation. /// </summary> /// <example> /// Implement: /// public void OnLeftRoom() { //some work } /// </example> /// \ingroup publicApi public enum PhotonNetworkingMessage { /// <summary> /// Called when the server is available and before client authenticates. Wait for the call to OnJoinedLobby (or OnConnectedToMaster) before the client does anything! /// Example: void OnConnectedToPhoton(){ ... } /// </summary> /// <remarks>This is not called for transitions from the masterserver to game servers, which is hidden for PUN users.</remarks> OnConnectedToPhoton,
/// <summary> /// Called once the local user left a room. /// Example: void OnLeftRoom(){ ... } /// </summary> OnLeftRoom,
/// <summary> /// Called -after- switching to a new MasterClient because the previous MC left the room (not when getting into a room). The last MC will already be removed at this time. /// Example: void OnMasterClientSwitched(PhotonPlayer newMasterClient){ ... } /// </summary> OnMasterClientSwitched,
/// <summary> /// Called if a CreateRoom() call failed. Most likely because the room name is already in use. /// Example: void OnPhotonCreateRoomFailed(){ ... } /// </summary> OnPhotonCreateRoomFailed,
/// <summary> /// Called if a JoinRoom() call failed. Most likely because the room does not exist or the room is full. /// Example: void OnPhotonJoinRoomFailed(){ ... } /// </summary> OnPhotonJoinRoomFailed,
/// <summary> /// Called when CreateRoom finishes creating the room. After this, OnJoinedRoom will be called, too (no matter if creating one or joining). /// Example: void OnCreatedRoom(){ ... } /// </summary> /// <remarks>This implies the local client is the MasterClient.</remarks> OnCreatedRoom,
/// <summary> /// Called on entering the Master Server's lobby. Client can create/join rooms but room list is not available until OnReceivedRoomListUpdate is called! /// Example: void OnJoinedLobby(){ ... } /// </summary> /// <remarks> /// Note: When PhotonNetwork.autoJoinLobby is false, OnConnectedToMaster will be called instead and the room list won't be available. /// While in the lobby, the roomlist is automatically updated in fixed intervals (which you can't modify). /// </remarks> OnJoinedLobby,
/// <summary> /// Called after leaving the lobby. /// Example: void OnLeftLobby(){ ... } /// </summary> OnLeftLobby,
/// <summary> /// Called after disconnecting from the Photon server. /// In some cases, other events are sent before OnDisconnectedFromPhoton is called. Examples: OnConnectionFail and OnFailedToConnectToPhoton. /// Example: void OnDisconnectedFromPhoton(){ ... } /// </summary> OnDisconnectedFromPhoton,
/// <summary> /// Called when something causes the connection to fail (after it was established), followed by a call to OnDisconnectedFromPhoton. /// If the server could not be reached in the first place, OnFailedToConnectToPhoton is called instead. /// The reason for the error is provided as StatusCode. /// Example: void OnConnectionFail(DisconnectCause cause){ ... } /// </summary> OnConnectionFail,
/// <summary> /// Called if a connect call to the Photon server failed before the connection was established, followed by a call to OnDisconnectedFromPhoton. /// If the connection was established but then fails, OnConnectionFail is called. /// Example: void OnFailedToConnectToPhoton(DisconnectCause cause){ ... } /// </summary> OnFailedToConnectToPhoton,
/// <summary> /// Called for any update of the room listing (no matter if "new" list or "update for known" list). Only called in the Lobby state (on master server). /// Example: void OnReceivedRoomListUpdate(){ ... } /// </summary> OnReceivedRoomListUpdate,
/// <summary> /// Called when entering a room (by creating or joining it). Called on all clients (including the Master Client). /// Example: void OnJoinedRoom(){ ... } /// </summary> OnJoinedRoom,
/// <summary> /// Called after a remote player connected to the room. This PhotonPlayer is already added to the playerlist at this time. /// Example: void OnPhotonPlayerConnected(PhotonPlayer newPlayer){ ... } /// </summary> OnPhotonPlayerConnected,
/// <summary> /// Called after a remote player disconnected from the room. This PhotonPlayer is already removed from the playerlist at this time. /// Example: void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer){ ... } /// </summary> OnPhotonPlayerDisconnected,
/// <summary> /// Called after a JoinRandom() call failed. Most likely all rooms are full or no rooms are available. /// Example: void OnPhotonRandomJoinFailed(){ ... } /// </summary> OnPhotonRandomJoinFailed,
/// <summary> /// Called after the connection to the master is established and authenticated but only when PhotonNetwork.AutoJoinLobby is false. /// If AutoJoinLobby is false, the list of available rooms won't become available but you could join (random or by name) and create rooms anyways. /// Example: void OnConnectedToMaster(){ ... } /// </summary> OnConnectedToMaster,
/// <summary> /// Called every network 'update' on MonoBehaviours that are being observed by a PhotonView. /// Example: void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){ ... } /// </summary> OnPhotonSerializeView,
/// <summary> /// Called on all scripts on a GameObject(and it's children) that have been spawned using PhotonNetwork.Instantiate /// Example: void OnPhotonInstantiate(PhotonMessageInfo info){ ... } /// </summary> OnPhotonInstantiate,
/// <summary> /// Because the concurrent user limit was (temporarily) reached, this client is rejected by the server and disconnecting. /// </summary> /// <remarks> /// When this happens, the user might try again later. You can't create or join rooms in OnPhotonMaxCcuReached(), cause the client will be disconnecting. /// You can raise the CCU limits with a new license (when you host yourself) or extended subscription (when using the Photon Cloud). /// The Photon Cloud will mail you when the CCU limit was reached. This is also visible in the Dashboard (webpage). /// Example: void OnPhotonMaxCccuReached(){ ... } /// </remarks> OnPhotonMaxCccuReached, /// <summary> /// Called when inside a room when its custom properties have changed. This is ALSO called for room property changes by the local players. /// </summary> /// <remarks> /// Example: void OnPhotonCustomRoomPropertiesChanged(){ ... } /// </remarks> OnPhotonCustomRoomPropertiesChanged, /// <summary> /// Called when inside a room when a players custom properties change. /// </summary> /// <remarks> /// Example: void OnPhotonPlayerPropertiesChanged(PhotonPlayer player){ ... } /// </remarks> OnPhotonPlayerPropertiesChanged }
Работаю нормально, в pdf лазил по началу, сейчас исходники PUN смотрю когда что надо.
|