OpSetPropertiesOfRoom
How do I use Op Set Properties Of Room
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: LoadbalancingPeer.cs
Copy
314 protected void OpSetPropertyOfRoom(byte propCode, object value)
315 {
316 Hashtable properties = new Hashtable();
317 properties[propCode] = value;
318 this.OpSetPropertiesOfRoom(properties, true, (byte)0);
319 }
File name: LoadbalancingPeer.cs
Copy
321 public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties, bool broadcast, byte channelId)
322 {
323 return this.OpSetPropertiesOfRoom(gameProperties.StripToStringKeys(), broadcast, channelId);
324 }
File name: LoadbalancingPeer.cs
Copy
326 public bool OpSetPropertiesOfRoom(Hashtable gameProperties, bool broadcast, byte channelId)
327 {
328 if (this.DebugOut >= DebugLevel.INFO)
329 {
330 this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfRoom()");
331 }
332
333 Dictionary
334 opParameters.Add(ParameterCode.Properties, gameProperties);
335 if (broadcast)
336 {
337 opParameters.Add(ParameterCode.Broadcast, true);
338 }
339
340 return this.OpCustom((byte)OperationCode.SetProperties, opParameters, broadcast, channelId);
341 }
File name: Room.cs
Copy
59 {
60 get
61 {
62 return (int)this.maxPlayersField;
63 }
64
65 set
66 {
67 if (!this.Equals(PhotonNetwork.room))
68 {
69 UnityEngine.Debug.LogWarning("Can't set maxPlayers when not in that room.");
70 }
71
72 if (value > 255)
73 {
74 UnityEngine.Debug.LogWarning("Can't set Room.maxPlayers to: " + value + ". Using max value: 255.");
75 value = 255;
76 }
77
78 if (value != this.maxPlayersField && !PhotonNetwork.offlineMode)
79 {
80 PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(new Hashtable() { { GameProperties.MaxPlayers, (byte)value } }, true, (byte)0);
81 }
82
83 this.maxPlayersField = (byte)value;
84 }
85 }
File name: Room.cs
Copy
96 {
97 get
98 {
99 return this.openField;
100 }
101
102 set
103 {
104 if (!this.Equals(PhotonNetwork.room))
105 {
106 UnityEngine.Debug.LogWarning("Can't set open when not in that room.");
107 }
108
109 if (value != this.openField && !PhotonNetwork.offlineMode)
110 {
111 PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(new Hashtable() { { GameProperties.IsOpen, value } }, true, (byte)0);
112 }
113
114 this.openField = value;
115 }
116 }
File name: Room.cs
Copy
124 {
125 get
126 {
127 return this.visibleField;
128 }
129
130 set
131 {
132 if (!this.Equals(PhotonNetwork.room))
133 {
134 UnityEngine.Debug.LogWarning("Can't set visible when not in that room.");
135 }
136
137 if (value != this.visibleField && !PhotonNetwork.offlineMode)
138 {
139 PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(new Hashtable() { { GameProperties.IsVisible, value } }, true, (byte)0);
140 }
141
142 this.visibleField = value;
143 }
144 }
File name: Room.cs
Copy
224 public void SetPropertiesListedInLobby(string[] propsListedInLobby)
225 {
226 Hashtable customProps = new Hashtable();
227 customProps[GameProperties.PropsListedInLobby] = propsListedInLobby;
228 PhotonNetwork.networkingPeer.OpSetPropertiesOfRoom(customProps, false, 0);
229
230 this.propertiesListedInLobby = propsListedInLobby;
231 }
OpSetPropertiesOfRoom 193 lượt xem
Gõ tìm kiếm nhanh...