/// <summary> /// Initialises a new instance of the request with the given description. /// </summary> /// /// <param name="desc">The description.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> /// <param name="serverUrl">The server url for this call.</param> public QueryCollectionRequest(QueryCollectionRequestDesc desc, string connectAccessToken, string serverUrl) { ReleaseAssert.IsNotNull(desc, "A description object cannot be null."); ReleaseAssert.IsNotNull(desc.Key, "Key cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Key = desc.Key; Query = desc.Query; if (desc.Params != null) { Params = Mutability.ToImmutable(desc.Params); } if (desc.SortFields != null) { SortFields = Mutability.ToImmutable(desc.SortFields); } Page = desc.Page; Randomize = desc.Randomize; ConnectAccessToken = connectAccessToken; Url = serverUrl + "/1.0/data/collection/query"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance with the given description. /// </summary> /// /// <param name="desc">The description.</param> public Message(MessageDesc desc) { ReleaseAssert.IsNotNull(desc, "A description object cannot be null."); ReleaseAssert.IsNotNull(desc.MessageId, "MessageId cannot be null."); ReleaseAssert.IsNotNull(desc.From, "From cannot be null."); ReleaseAssert.IsNotNull(desc.SentOn, "SentOn cannot be null."); MessageId = desc.MessageId; From = desc.From; SentOn = desc.SentOn; Read = desc.Read; ReadOn = desc.ReadOn; Redeemed = desc.Redeemed; RedeemedOn = desc.RedeemedOn; if (desc.Tags != null) { Tags = Mutability.ToImmutable(desc.Tags); } Expiry = desc.Expiry; Title = desc.Title; Text = desc.Text; Data = desc.Data; Rewards = desc.Rewards; }
/// <summary> /// Initialises a new instance of the request with the given description. /// </summary> /// /// <param name="desc">The description.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public CreateMatchRequest(CreateMatchRequestDesc desc, string connectAccessToken) { ReleaseAssert.IsNotNull(desc, "A description object cannot be null."); ReleaseAssert.IsNotNull(desc.MatchTypeKey, "MatchTypeKey cannot be null."); ReleaseAssert.IsNotNull(desc.TurnType, "TurnType cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); MatchTypeKey = desc.MatchTypeKey; TurnType = desc.TurnType; PlayerLimit = desc.PlayerLimit; if (desc.Properties != null) { Properties = Mutability.ToImmutable(desc.Properties); } StateData = desc.StateData; TurnTimeout = desc.TurnTimeout; WaitingTimeout = desc.WaitingTimeout; TurnOrderType = desc.TurnOrderType; if (desc.Players != null) { Players = Mutability.ToImmutable(desc.Players); } AutoStart = desc.AutoStart; Private = desc.Private; ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/multiplayer/async/match/create"; HttpRequestMethod = HttpRequestMethod.Post; }
static Type() { var type = typeof(T); // initialize the default constructor: if T:new(), then invoke the parameterless constructor // else if it's an array or struct, then simply return default(T) create = type.Subtypes(typeof(MemberInfo)) ? null: type.IsInterface || type.IsAbstract ? null: type.IsArray || type.IsValueType ? DefaultCtor: type == typeof(string) ? Expression.Lambda <Func <T> >(Expression.Constant(string.Empty)).Compile(): HasEmptyConstructor(type) ? Constructor <Func <T> > .Invoke: () => (T)FormatterServices.GetUninitializedObject(type); // Immutable: any types decorated with [Pure] || T has init-only fields whose types are immutable // Maybe: if any fields have types with Mutability.Maybe // Mutable: otherwise // Need a list of sanitized core immutable types: Int32, DateTime, decimal, Exception, Attribute, Tuple<*>, etc. Mutability = ImmutableWhitelist(type) ? Mutability.Immutable: MutableBlacklist(type) ? Mutability.Mutable: TransitiveMutability(type, out isMutable); var visited = new Type[6]; Cycles = DetectCycles(type, ref visited, 0); deepCopy = Mutability == Mutability.Immutable ? null : GenerateCopy(type); }
/// <summary> /// Initialises a new instance of the request with the given description. /// </summary> /// /// <param name="desc">The description.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> /// <param name="serverUrl">The server url for this call.</param> public SendMessageRequest(SendMessageRequestDesc desc, string connectAccessToken, string serverUrl) { ReleaseAssert.IsNotNull(desc, "A description object cannot be null."); ReleaseAssert.IsNotNull(desc.To, "To cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); To = desc.To; From = desc.From; Title = desc.Title; Text = desc.Text; Data = desc.Data; if (desc.Tags != null) { Tags = Mutability.ToImmutable(desc.Tags); } Expiry = desc.Expiry; Gifts = desc.Gifts; Transfer = desc.Transfer; ConnectAccessToken = connectAccessToken; Url = serverUrl + "/1.0/message/send"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the description with the given required properties. /// </summary> /// /// <param name="key">The Key that identifies the leaderboard</param> /// <param name="chilliConnectIds">A list of ChilliConnectIDs to find scores for. Maximum 100.</param> public GetScoresForChilliConnectIdsRequestDesc(string key, IList <string> chilliConnectIds) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(chilliConnectIds, "Chilli Connect Ids cannot be null."); Key = key; ChilliConnectIds = Mutability.ToImmutable(chilliConnectIds); }
/// <summary> /// Initialises a new instance with the given properties. /// </summary> /// /// <param name="currencies">A list of Currencies.</param> /// <param name="items">A list of Inventory Items.</param> public MessageRewardRedeemed(IList <MessageRewardRedeemedCurrency> currencies, IList <MessageRewardRedeemedInventory> items) { ReleaseAssert.IsNotNull(currencies, "Currencies cannot be null."); ReleaseAssert.IsNotNull(items, "Items cannot be null."); Currencies = Mutability.ToImmutable(currencies); Items = Mutability.ToImmutable(items); }
/// <summary> /// Initialises a new instance with the given properties. /// </summary> /// /// <param name="currencies">The Currency items to be exchanged.</param> /// <param name="items">The Inventory items to be exchanged.</param> public PurchaseExchangeDefinition(IList <PurchaseCurrencyExchangeDefinition> currencies, IList <PurchaseInventoryExchangeDefinition> items) { ReleaseAssert.IsNotNull(currencies, "Currencies cannot be null."); ReleaseAssert.IsNotNull(items, "Items cannot be null."); Currencies = Mutability.ToImmutable(currencies); Items = Mutability.ToImmutable(items); }
/// <summary> /// Initialises a new instance with the given properties. /// </summary> /// /// <param name="currencies">A list of Currencies.</param> /// <param name="itemIDs">A list of Inventory ItemIDs.</param> public MessageTransfer(IList <MessageSendCurrency> currencies, IList <string> itemIDs) { ReleaseAssert.IsNotNull(currencies, "Currencies cannot be null."); ReleaseAssert.IsNotNull(itemIDs, "Item I Ds cannot be null."); Currencies = Mutability.ToImmutable(currencies); ItemIDs = Mutability.ToImmutable(itemIDs); }
public Global(Bin.TypeID type, bool mutable) { this.mutable = (mutable == true) ? Mutability.Variable : Mutability.Const; this.type = type; uint size = DataStore.GetTypeIDSize(type); this.store = new DataStore(size); }
/// <summary> /// Initialises a new instance with the given required properties. /// </summary> /// /// <param name="key">The key of the item.</param> /// <param name="name">The name of the item.</param> /// <param name="tags">The tags of the item.</param> public CustomDefinitionDesc(string key, string name, IList <string> tags) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(tags, "Tags cannot be null."); Key = key; Name = name; Tags = Mutability.ToImmutable(tags); }
protected AppendSeries(Mutability mutability = Mutability.ReadOnly, KeySorting keySorting = KeySorting.Strong, KeyComparer <TKey> comparer = default, MovingWindowOptions <TKey>?movingWindowOptions = default) : base(mutability, keySorting, comparer) { if (movingWindowOptions != null) { WindowOptions = new MovingWindowOptions(this, movingWindowOptions); } }
/// <summary> /// Initialises a new instance with the given properties. /// </summary> /// /// <param name="name">The name of the item.</param> /// <param name="key">The Key of the item.</param> /// <param name="amount">The amount of the item exchanged.</param> /// <param name="itemIds">The ID's of the items that were added to removed from the player's inventory .</param> public PurchaseInventoryExchange(string name, string key, int amount, IList <string> itemIds) { ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(itemIds, "Item Ids cannot be null."); Name = name; Key = key; Amount = amount; ItemIds = Mutability.ToImmutable(itemIds); }
/// <summary> /// Initialises a new instance with the given properties. /// </summary> /// /// <param name="url">The URL that the Package can be downloaded from.</param> /// <param name="checksum">The package SHA1 Checksum.</param> /// <param name="size">The Package size in bytes.</param> /// <param name="files">A list of files contained in the Package.</param> public ZipPackageDefinitionPackage(string url, string checksum, int size, IList <ZipPackageDefinitionPackageFile> files) { ReleaseAssert.IsNotNull(url, "Url cannot be null."); ReleaseAssert.IsNotNull(checksum, "Checksum cannot be null."); ReleaseAssert.IsNotNull(files, "Files cannot be null."); Url = url; Checksum = checksum; Size = size; Files = Mutability.ToImmutable(files); }
// There is no ctors for series because they are read-only, // only factories in static Series class internal Series(Mutability mutability = Mutability.ReadOnly, KeySorting keySorting = KeySorting.Strong, KeyComparer <TKey> comparer = default) { if (keySorting != KeySorting.Strong) { throw new NotImplementedException(); } Flags = new Flags(ContainerLayout.Series, keySorting, mutability); _comparer = comparer; }
/// <summary> /// Initialises a new instance with the given required properties. /// </summary> /// /// <param name="key">The key of the item.</param> /// <param name="name">The name of the item.</param> /// <param name="tags">The tags of the item.</param> /// <param name="initialAllocation">The initial allocation of the item given to new players on creation.</param> public InventoryDefinitionDesc(string key, string name, IList <string> tags, int initialAllocation) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(tags, "Tags cannot be null."); Key = key; Name = name; Tags = Mutability.ToImmutable(tags); InitialAllocation = initialAllocation; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="tags">An array list of Tags for the player to search for.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public GetDlcUsingTagRequest(IList <string> tags, string connectAccessToken) { ReleaseAssert.IsNotNull(tags, "Tags cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Tags = Mutability.ToImmutable(tags); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/dlc/tag"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="userNames">An array of UserNames to look up. Maximum 10.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public LookupUserNamesRequest(IList <string> userNames, string connectAccessToken) { ReleaseAssert.IsNotNull(userNames, "User Names cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); UserNames = Mutability.ToImmutable(userNames); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/player/lookup/username"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="itemIds">Return only these items witihin the player's inventory.</param> /// <param name="connectAccessToken">A valid session AccessToken obtained through one of the login endpoints.</param> public GetInventoryForItemIdsRequest(IList <string> itemIds, string connectAccessToken) { ReleaseAssert.IsNotNull(itemIds, "Item Ids cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); ItemIds = Mutability.ToImmutable(itemIds); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/economy/inventory/get/items"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="groups">A list of Push Groups that the player belongs to, up to a maximum of 10.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public SetPushGroupsRequest(IList <string> groups, string connectAccessToken) { ReleaseAssert.IsNotNull(groups, "Groups cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Groups = Mutability.ToImmutable(groups); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/push/groups"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="events">An array of events.</param> /// <param name="metricsAccessToken">MetricsAccessToken as returned from a call to SessionStart.</param> public AddEventsRequest(IList <MetricsEvent> events, string metricsAccessToken) { ReleaseAssert.IsNotNull(events, "Events cannot be null."); ReleaseAssert.IsNotNull(metricsAccessToken, "Metrics Access Token cannot be null."); Events = Mutability.ToImmutable(events); MetricsAccessToken = metricsAccessToken; Url = "https://metrics.chilliconnect.com/1.0/events/batch"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="keys">Return only items with these Keys from the player's inventory. Maximum 5.</param> /// <param name="connectAccessToken">A valid session AccessToken obtained through one of the login endpoints.</param> public GetInventoryForKeysRequest(IList <string> keys, string connectAccessToken) { ReleaseAssert.IsNotNull(keys, "Keys cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Keys = Mutability.ToImmutable(keys); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/2.0/economy/inventory/get/keys"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance with the given required properties. /// </summary> /// /// <param name="key">The key of the MatchType.</param> /// <param name="name">The name of the MatchType.</param> /// <param name="turnTypes">The allowed TurnTypes.</param> /// <param name="defaultWaitingTimeout">Amount of time a Match in WAITING State will wait before entering State TIMEOUT.</param> /// <param name="defaultTurnTimeout">Amount of time before the Match will enter State TIMEOUT.</param> public MatchTypeDefinitionDesc(string key, string name, IList <string> turnTypes, int defaultWaitingTimeout, int defaultTurnTimeout) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(turnTypes, "Turn Types cannot be null."); Key = key; Name = name; TurnTypes = Mutability.ToImmutable(turnTypes); DefaultWaitingTimeout = defaultWaitingTimeout; DefaultTurnTimeout = defaultTurnTimeout; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="properties">A set of Key-Value pairs of the Player Properties to be set or updated. Keys and /// Value-types are defined in Game settings.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> /// <param name="serverUrl">The server url for this call.</param> public SetPlayerPropertiesRequest(IDictionary <string, MultiTypeValue> properties, string connectAccessToken, string serverUrl) { ReleaseAssert.IsNotNull(properties, "Properties cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Properties = Mutability.ToImmutable(properties); ConnectAccessToken = connectAccessToken; Url = serverUrl + "/1.0/player/properties/set"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="facebookIds">An array of FacebookIDs to look up. Maximum 10.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public LookupFacebookPlayersRequest(IList <string> facebookIds, string connectAccessToken) { ReleaseAssert.IsNotNull(facebookIds, "Facebook Ids cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); FacebookIds = Mutability.ToImmutable(facebookIds); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/player/lookup/facebook"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance with the given required properties. /// </summary> /// /// <param name="key">The key of the item.</param> /// <param name="name">The name of the item.</param> /// <param name="tags">The tags of the item.</param> /// <param name="patches">A map of UnrealMobilePatch Patches keyed by the patch label. Note: Patches are /// keyed by label to enable future multi-patch support. Currently a single Patch is /// available under the label 'Default'.</param> public UnrealMobilePatchDefinitionDesc(string key, string name, IList <string> tags, IDictionary <string, UnrealMobilePatchDefinitionPatch> patches) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(tags, "Tags cannot be null."); ReleaseAssert.IsNotNull(patches, "Patches cannot be null."); Key = key; Name = name; Tags = Mutability.ToImmutable(tags); Patches = Mutability.ToImmutable(patches); }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="keys">The Custom Data Keys for which to retrieve the values of.</param> /// <param name="connectAccessToken">A valid session ConnectAccessToken obtained through one of the login endpoints.</param> public GetPlayerDataRequest(IList <string> keys, string connectAccessToken) { ReleaseAssert.IsNotNull(keys, "Keys cannot be null."); ReleaseAssert.IsNotNull(connectAccessToken, "Connect Access Token cannot be null."); Keys = Mutability.ToImmutable(keys); ConnectAccessToken = connectAccessToken; Url = "https://connect.chilliconnect.com/1.0/data/player/get"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance with the given required properties. /// </summary> /// /// <param name="key">The key of the item.</param> /// <param name="name">The name of the item.</param> /// <param name="tags">The tags of the item.</param> /// <param name="initial">The initial balance of the item.</param> /// <param name="max">The maximum balance of the item. 0 means no limit.</param> public CurrencyDefinitionDesc(string key, string name, IList <string> tags, int initial, int max) { ReleaseAssert.IsNotNull(key, "Key cannot be null."); ReleaseAssert.IsNotNull(name, "Name cannot be null."); ReleaseAssert.IsNotNull(tags, "Tags cannot be null."); Key = key; Name = name; Tags = Mutability.ToImmutable(tags); Initial = initial; Max = max; }
/// <summary> /// Initialises a new instance of the request with the given properties. /// </summary> /// /// <param name="events">An array of events.</param> /// <param name="metricsAccessToken">MetricsAccessToken as returned from a Player login call.</param> /// <param name="serverUrl">The server url for this call.</param> public AddEventsRequest(IList <MetricsEvent> events, string metricsAccessToken, string serverUrl) { ReleaseAssert.IsNotNull(events, "Events cannot be null."); ReleaseAssert.IsNotNull(metricsAccessToken, "Metrics Access Token cannot be null."); Events = Mutability.ToImmutable(events); MetricsAccessToken = metricsAccessToken; Url = serverUrl + "/1.0/events/batch"; HttpRequestMethod = HttpRequestMethod.Post; }
/// <summary> /// Initialises a new instance with the given description. /// </summary> /// /// <param name="desc">The description.</param> public MetadataDefinition(MetadataDefinitionDesc desc) { ReleaseAssert.IsNotNull(desc, "A description object cannot be null."); ReleaseAssert.IsNotNull(desc.Key, "Key cannot be null."); ReleaseAssert.IsNotNull(desc.Name, "Name cannot be null."); ReleaseAssert.IsNotNull(desc.Tags, "Tags cannot be null."); Key = desc.Key; Name = desc.Name; Tags = Mutability.ToImmutable(desc.Tags); CustomData = desc.CustomData; }