using System; using System.Collections.Generic; using UnityEngine.Scripting; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Unity.Services.Lobbies.Http; namespace Unity.Services.Lobbies.Models { /// /// Custom data property for a player. /// The value of the custom property. This property can be set to null or empty string. /// Indicates for whom the property should be visible. If `public`, the property will be visible to everyone and will be included in query results. If `member` the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If `private`, the metadata will only be visible to the the player. /// [Preserve] [DataContract(Name = "PlayerDataObject")] public class PlayerDataObject { /// /// Custom data property for a player. /// /// Indicates for whom the property should be visible. If `public`, the property will be visible to everyone and will be included in query results. If `member` the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If `private`, the metadata will only be visible to the the player. /// The value of the custom property. This property can be set to null or empty string. [Preserve] public PlayerDataObject(VisibilityOptions visibility, string value = default) { Value = value; Visibility = visibility; } /// /// The value of the custom property. This property can be set to null or empty string. /// [Preserve] [DataMember(Name = "value", EmitDefaultValue = false)] public string Value{ get; } /// /// Indicates for whom the property should be visible. If `public`, the property will be visible to everyone and will be included in query results. If `member` the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If `private`, the metadata will only be visible to the the player. /// [Preserve] [JsonConverter(typeof(StringEnumConverter))] [DataMember(Name = "visibility", IsRequired = true, EmitDefaultValue = true)] public VisibilityOptions Visibility{ get; } /// /// Indicates for whom the property should be visible. If `public`, the property will be visible to everyone and will be included in query results. If `member` the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If `private`, the metadata will only be visible to the the player. /// /// Indicates for whom the property should be visible. If `public`, the property will be visible to everyone and will be included in query results. If `member` the data will only be visible to users who are members of the lobby (i.e. those who have successfully joined). If `private`, the metadata will only be visible to the the player. [Preserve] [JsonConverter(typeof(StringEnumConverter))] public enum VisibilityOptions { /// /// Enum Public for value: public /// [EnumMember(Value = "public")] Public = 1, /// /// Enum Member for value: member /// [EnumMember(Value = "member")] Member = 2, /// /// Enum Private for value: private /// [EnumMember(Value = "private")] Private = 3 } } }