facebook twitter hatena line email

「Unity/photon/photon2違い」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(その5)
(その5)
行28: 行28:
 
*PhotonNetwork.room → PhotonNetwork.CurrentRoom;
 
*PhotonNetwork.room → PhotonNetwork.CurrentRoom;
  
===部屋一覧
+
===部屋一覧===
 
pun1
 
pun1
 
<pre>
 
<pre>
行38: 行38:
 
pun2
 
pun2
 
<pre>
 
<pre>
 +
public override void OnRoomListUpdate(List<RoomInfo> roomList)
 +
{
 +
Debug.Log("OnRoomListUpdate");
 +
List<RoomInfo> tmpRoomList = roomList.Where(s => s.IsOpen).Select(s => RoomToString(s)).ToList();
 +
}
 +
</pre>
 +
 +
MonoBehaviourPun → MonoBehaviourPunCallbacks

2021年8月11日 (水) 03:29時点における版

photonとphoton2の違い

参考:https://lifter-liberty.localinfo.jp/posts/5296583

実際に変更した作業

その1

using Photon.Pun;
using Photon.Realtime;

を追加

その2

Photon.MonoBehaviour → MonoBehaviourPunへ

その3

  • roomOptions.customRoomProperties → roomOptions.CustomRoomProperties
  • roomOptions.customRoomPropertiesForLobby → roomOptions.CustomRoomPropertiesForLobby
  • roomOptions.maxPlayers → roomOptions.MaxPlayers
  • roomOptions.isOpen → roomOptions.IsOpen
  • roomOptions.isVisible → roomOptions.IsVisible

その4

  • room.name → room.Name
  • room.customProperties → room.CustomProperties

その5

  • PhotonNetwork.room → PhotonNetwork.CurrentRoom;

部屋一覧

pun1

void OnReceivedRoomListUpdate()
{
        RoomInfo[] rooms = PhotonNetwork.GetRoomList(); // 注意:OnReceivedRoomListUpdate()が呼ばれた以後でしか取得できない

↓ pun2

public override void OnRoomListUpdate(List<RoomInfo> roomList)
{
	Debug.Log("OnRoomListUpdate");
	List<RoomInfo> tmpRoomList = roomList.Where(s => s.IsOpen).Select(s => RoomToString(s)).ToList();
}

MonoBehaviourPun → MonoBehaviourPunCallbacks