/*----------------------------------------------------------------------------------------------------------------------------*/ /// <summary> /// Gets the room property. /// </summary> /// <param name="key">The key.</param> /// <returns>Dictionary<System.String, System.String>.</returns> public static Dictionary <string, string> GetRoomProperty(RoomPropertiesType key) { if (!PhotonNetwork.CurrentRoom.CustomProperties.ContainsKey(key.ToString())) { if (PhotonNetwork.CurrentRoom.CustomProperties.Count <= 0) { Log.Warn("No room properties found."); } else { Log.Info("Room contains '{0}' properties, but could not find '{1}'", PhotonNetwork.CurrentRoom.CustomProperties.Count, key.ToString()); } return(null); } Dictionary <string, string> getProperty = PhotonNetwork.CurrentRoom.CustomProperties[key.ToString()] as Dictionary <string, string>; return(getProperty); }
public void ClearRoomProperty(RoomPropertiesType prop) { string convertedProp = prop.ToString(); List <Hashtable> newProperties = new List <Hashtable>(); Hashtable cachedProperties = PhotonNetwork.CurrentRoom.CustomProperties; foreach (var item in cachedProperties) { string convertedPropKey = (string)item.Key; if (convertedPropKey.StartsWith(convertedProp)) { Hashtable resetTable = new Hashtable(); Dictionary <string, string> resetDict = new Dictionary <string, string>(); resetTable.Add(item.Key, resetDict); newProperties.Add(resetTable); } } for (int i = 0; i < newProperties.Count; i++) { PhotonNetwork.CurrentRoom.SetCustomProperties(newProperties[i]); } }