🎮
常用的回调函数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| ⭐随机加入房间失败时候 public override void OnJoinRandomFailed(short returnCode, string message) {
CreateAndJoinRoom(); }
⭐当创建好一个房间时会触发此 public override void OnCreatedRoom() {
}
⭐第一位玩家加入时会触发此 public override void OnJoinedRoom() { Debug.Log("the 本地玩家是"+PhotonNetwork.NickName+"joined to"+PhotonNetwork.CurrentRoom.Name+"Player count"+PhotonNetwork.CurrentRoom.PlayerCount); }
⭐其他玩家加入我的房间会触发此 public override void OnPlayerEnteredRoom(Player newPlayer) {
}
⭐创建、有新玩家加入、更改了房间的财产 都会触发 public override void OnRoomListUpdate(List<RoomInfo> roomList) {
}
⭐当本地人离开房间时触发 public override void OnLeftRoom() {
}
⭐当本地人断开连接时 public override void OnDisconnected(DisconnectCause cause) {
}
⭐当本地人连接到Master public override void OnConnectedToMaster() {
}
|
官网手册参考👇
Photon Unity Networking 2: ILobbyCallbacks Interface Reference