Пример #1
0
        /// <summary>
        /// Adds a score to a leaderboard for the currently logged in player.
        /// </summary>
        ///
        /// <param name="desc">The request description.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void AddScore(AddScoreRequestDesc desc, Action <AddScoreRequest, AddScoreResponse> successCallback, Action <AddScoreRequest, AddScoreError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Add Score request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new AddScoreRequest(desc, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyAddScoreSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyAddScoreError(serverResponse, request, errorCallback);
                }
            });
        }
Пример #2
0
        /// <summary>
        /// Validate a Receipt from a successful purchase on an Amazon device.
        /// </summary>
        ///
        /// <param name="receiptId">ReceiptID returned from the Amazon App Store as a result of a successful
        /// purchase. See the Amazon Documentation at
        /// 'https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/implementing-iap-2.0'
        /// for more information to on how to access this value from your app.</param>
        /// <param name="userId">UserID returned from the Amazon App Store as a result of a successful purchase.
        /// See the Amazon Documentation at
        /// 'https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/implementing-iap-2.0'
        /// for more information to on how to access this value from your app.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void ValidateAmazonIap(string receiptId, string userId, Action <ValidateAmazonIapRequest, ValidateAmazonIapResponse> successCallback, Action <ValidateAmazonIapRequest, ValidateAmazonIapError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Validate Amazon Iap request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new ValidateAmazonIapRequest(receiptId, userId, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyValidateAmazonIapSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyValidateAmazonIapError(serverResponse, request, errorCallback);
                }
            });
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public GetPlayerPropertiesResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Properties
                if (entry.Key == "Properties")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        Properties = JsonSerialisation.DeserialiseMap((IDictionary <string, object>)entry.Value, (object element) =>
                        {
                            ReleaseAssert.IsTrue(element is object, "Invalid element type.");
                            return(new MultiTypeValue((object)element));
                        });
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Bring back a list of requested DLC packages along with their contained files.
        /// </summary>
        ///
        /// <param name="tags">An array list of Tags for the player to search for.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void GetDlcUsingTag(IList <string> tags, Action <GetDlcUsingTagRequest, GetDlcUsingTagResponse> successCallback, Action <GetDlcUsingTagRequest, GetDlcUsingTagError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Get Dlc Using Tag request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new GetDlcUsingTagRequest(tags, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyGetDlcUsingTagSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyGetDlcUsingTagError(serverResponse, request, errorCallback);
                }
            });
        }
Пример #5
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public AppStore(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ResponseCode"), "Json is missing required field 'ResponseCode'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ResponseMessage"), "Json is missing required field 'ResponseMessage'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ReceiptData"), "Json is missing required field 'ReceiptData'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Response Code
                if (entry.Key == "ResponseCode")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    ResponseCode = (int)(long)entry.Value;
                }

                // Response Message
                else if (entry.Key == "ResponseMessage")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ResponseMessage = (string)entry.Value;
                }

                // Receipt Data
                else if (entry.Key == "ReceiptData")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ReceiptData = (string)entry.Value;
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public ConvertCurrencyResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("AmountConverted"), "Json is missing required field 'AmountConverted'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ToBalance"), "Json is missing required field 'ToBalance'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FromBalance"), "Json is missing required field 'FromBalance'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Amount Converted
                if (entry.Key == "AmountConverted")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    AmountConverted = (int)(long)entry.Value;
                }

                // To Balance
                else if (entry.Key == "ToBalance")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    ToBalance = new CurrencyBalance((IDictionary <string, object>)entry.Value);
                }

                // From Balance
                else if (entry.Key == "FromBalance")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    FromBalance = new CurrencyBalance((IDictionary <string, object>)entry.Value);
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Retrieve scores for each of the currently logged in player's facebook friends.
        /// Friends are retrieved from Facebook using the AccessToken provided on the players
        /// last succesful login to Facebook. Returns an array of objects for each player
        /// with a score posted on the provided leaderboard.
        /// </summary>
        ///
        /// <param name="desc">The request description.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void GetScoresForFacebookFriends(GetScoresForFacebookFriendsRequestDesc desc, Action <GetScoresForFacebookFriendsRequest, GetScoresForFacebookFriendsResponse> successCallback, Action <GetScoresForFacebookFriendsRequest, GetScoresForFacebookFriendsError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Get Scores For Facebook Friends request.");

            var serverUrl          = m_dataStore.GetString("ConnectUrl");
            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new GetScoresForFacebookFriendsRequest(desc, connectAccessToken, serverUrl);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyGetScoresForFacebookFriendsSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyGetScoresForFacebookFriendsError(serverResponse, request, errorCallback);
                }
            });
        }
Пример #8
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public VerifyFacebookTokenResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Valid"), "Json is missing required field 'Valid'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookID"), "Json is missing required field 'FacebookID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookName"), "Json is missing required field 'FacebookName'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Valid
                if (entry.Key == "Valid")
                {
                    ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                    Valid = (bool)entry.Value;
                }

                // Facebook Id
                else if (entry.Key == "FacebookID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookId = (string)entry.Value;
                }

                // Facebook Name
                else if (entry.Key == "FacebookName")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookName = (string)entry.Value;
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public DlcPackageFile(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Name"), "Json is missing required field 'Name'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Location"), "Json is missing required field 'Location'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Size"), "Json is missing required field 'Size'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Checksum"), "Json is missing required field 'Checksum'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Name
                if (entry.Key == "Name")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Name = (string)entry.Value;
                }

                // Location
                else if (entry.Key == "Location")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Location = (string)entry.Value;
                }

                // Size
                else if (entry.Key == "Size")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Size = (int)(long)entry.Value;
                }

                // Checksum
                else if (entry.Key == "Checksum")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Checksum = (string)entry.Value;
                }
            }
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public ValidateAmazonIapResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Valid"), "Json is missing required field 'Valid'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Status"), "Json is missing required field 'Status'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ReceiptVerificationService"), "Json is missing required field 'ReceiptVerificationService'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Valid
                if (entry.Key == "Valid")
                {
                    ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                    Valid = (bool)entry.Value;
                }

                // Status
                else if (entry.Key == "Status")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Status = (string)entry.Value;
                }

                // Receipt Verification Service
                else if (entry.Key == "ReceiptVerificationService")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    ReceiptVerificationService = new ReceiptVerificationService((IDictionary <string, object>)entry.Value);
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MessageGifts(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Currencies"), "Json is missing required field 'Currencies'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Items"), "Json is missing required field 'Items'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Currencies
                if (entry.Key == "Currencies")
                {
                    ReleaseAssert.IsTrue(entry.Value is IList <object>, "Invalid serialised type.");
                    Currencies = JsonSerialisation.DeserialiseList((IList <object>)entry.Value, (object element) =>
                    {
                        ReleaseAssert.IsTrue(element is IDictionary <string, object>, "Invalid element type.");
                        return(new MessageSendCurrency((IDictionary <string, object>)element));
                    });
                }

                // Items
                else if (entry.Key == "Items")
                {
                    ReleaseAssert.IsTrue(entry.Value is IList <object>, "Invalid serialised type.");
                    Items = JsonSerialisation.DeserialiseList((IList <object>)entry.Value, (object element) =>
                    {
                        ReleaseAssert.IsTrue(element is IDictionary <string, object>, "Invalid element type.");
                        return(new MessageSendInventory((IDictionary <string, object>)element));
                    });
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #12
0
        /// <summary>
        /// Records a successfully completed IAP transaction.
        /// </summary>
        ///
        /// <param name="item">A string identifying the item that the player purchased.</param>
        /// <param name="localCost">The amount of local currency paid by the player for the IAP.</param>
        /// <param name="localCurrency">The local currency with which the player purchased the IAP. This must be a valid
        /// ISO-4217 currency code.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void AddIapEvent(string item, float localCost, string localCurrency, Action <AddIapEventRequest> successCallback, Action <AddIapEventRequest, AddIapEventError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Add Iap Event request.");

            var serverUrl          = m_dataStore.GetString("MetricsUrl");
            var metricsAccessToken = m_dataStore.GetString("MetricsAccessToken");
            var request            = new AddIapEventRequest(item, localCost, localCurrency, metricsAccessToken, serverUrl);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyAddIapEventSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyAddIapEventError(serverResponse, request, errorCallback);
                }
            });
        }
Пример #13
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MessageRewardCurrency(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Name"), "Json is missing required field 'Name'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Amount"), "Json is missing required field 'Amount'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Name
                if (entry.Key == "Name")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Name = (string)entry.Value;
                }

                // Key
                else if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }

                // Amount
                else if (entry.Key == "Amount")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Amount = (int)(long)entry.Value;
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #14
0
        /// <summary>
        /// Refreshes the current player session. Depending on ChilliConnect settings, the
        /// existing session could be refreshed, or a new session generated.
        /// </summary>
        ///
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void RefreshSession(Action successCallback, Action <RefreshSessionError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Refresh Session request.");

            var serverUrl          = m_dataStore.GetString("MetricsUrl");
            var metricsAccessToken = m_dataStore.GetString("MetricsAccessToken");
            var request            = new RefreshSessionRequest(metricsAccessToken, serverUrl);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyRefreshSessionSuccess(serverResponse, successCallback);
                }
                else
                {
                    NotifyRefreshSessionError(serverResponse, errorCallback);
                }
            });
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public SetCurrencyBalanceResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Name"), "Json is missing required field 'Name'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Balance"), "Json is missing required field 'Balance'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("WriteLock"), "Json is missing required field 'WriteLock'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Name
                if (entry.Key == "Name")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Name = (string)entry.Value;
                }

                // Key
                else if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }

                // Balance
                else if (entry.Key == "Balance")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Balance = (int)(long)entry.Value;
                }

                // Write Lock
                else if (entry.Key == "WriteLock")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    WriteLock = (string)entry.Value;
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Deletes a message. Direct access to this method from the SDKs is disabled by
        /// default and must be enabled from the ChilliConnect dashboard.
        /// </summary>
        ///
        /// <param name="messageId">An identifier for the message.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void DeleteMessage(string messageId, Action <DeleteMessageRequest> successCallback, Action <DeleteMessageRequest, DeleteMessageError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Delete Message request.");

            var serverUrl          = m_dataStore.GetString("ConnectUrl");
            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new DeleteMessageRequest(messageId, connectAccessToken, serverUrl);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyDeleteMessageSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyDeleteMessageError(serverResponse, request, errorCallback);
                }
            });
        }
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public ConversionRuleDefinition(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("CurrencyFrom"), "Json is missing required field 'CurrencyFrom'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("AmountFrom"), "Json is missing required field 'AmountFrom'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("CurrencyTo"), "Json is missing required field 'CurrencyTo'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("AmountTo"), "Json is missing required field 'AmountTo'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Currency From
                if (entry.Key == "CurrencyFrom")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    CurrencyFrom = new CurrencyDefinition((IDictionary <string, object>)entry.Value);
                }

                // Amount From
                else if (entry.Key == "AmountFrom")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    AmountFrom = (int)(long)entry.Value;
                }

                // Currency To
                else if (entry.Key == "CurrencyTo")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    CurrencyTo = new CurrencyDefinition((IDictionary <string, object>)entry.Value);
                }

                // Amount To
                else if (entry.Key == "AmountTo")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    AmountTo = (int)(long)entry.Value;
                }
            }
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public ValidateGoogleIapResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Valid"), "Json is missing required field 'Valid'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Status"), "Json is missing required field 'Status'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Valid
                if (entry.Key == "Valid")
                {
                    ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                    Valid = (bool)entry.Value;
                }

                // Status
                else if (entry.Key == "Status")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Status = (string)entry.Value;
                }
            }
        }
Пример #19
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public CreatePlayerResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ChilliConnectID"), "Json is missing required field 'ChilliConnectID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ChilliConnectSecret"), "Json is missing required field 'ChilliConnectSecret'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Chilli Connect Id
                if (entry.Key == "ChilliConnectID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ChilliConnectId = (string)entry.Value;
                }

                // Chilli Connect Secret
                else if (entry.Key == "ChilliConnectSecret")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ChilliConnectSecret = (string)entry.Value;
                }
            }
        }
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MatchTypePropertyDefinition(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Name"), "Json is missing required field 'Name'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Type"), "Json is missing required field 'Type'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Name
                if (entry.Key == "Name")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Name = (string)entry.Value;
                }

                // Type
                else if (entry.Key == "Type")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Type = (string)entry.Value;
                }
            }
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public AddInventoryItemResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ItemID"), "Json is missing required field 'ItemID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("WriteLock"), "Json is missing required field 'WriteLock'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Item Id
                if (entry.Key == "ItemID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ItemId = (string)entry.Value;
                }

                // Write Lock
                else if (entry.Key == "WriteLock")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    WriteLock = (string)entry.Value;
                }
            }
        }
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public PurchaseInventoryExchangeDefinition(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Item"), "Json is missing required field 'Item'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Amount"), "Json is missing required field 'Amount'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Item
                if (entry.Key == "Item")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    Item = new InventoryDefinition((IDictionary <string, object>)entry.Value);
                }

                // Amount
                else if (entry.Key == "Amount")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Amount = (int)(long)entry.Value;
                }
            }
        }
Пример #23
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public RedeemMessageRewardsResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Rewards"), "Json is missing required field 'Rewards'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Rewards
                if (entry.Key == "Rewards")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    Rewards = new MessageRewardRedeemed((IDictionary <string, object>)entry.Value);
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public LinkFacebookAccountResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookID"), "Json is missing required field 'FacebookID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookName"), "Json is missing required field 'FacebookName'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Facebook Id
                if (entry.Key == "FacebookID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookId = (string)entry.Value;
                }

                // Facebook Name
                else if (entry.Key == "FacebookName")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookName = (string)entry.Value;
                }
            }
        }
Пример #25
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public TestGroupDetails(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Name"), "Json is missing required field 'Name'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Name
                if (entry.Key == "Name")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Name = (string)entry.Value;
                }

                // Key
                else if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }
            }
        }
Пример #26
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public LinkMobileDeviceIdResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DeviceID"), "Json is missing required field 'DeviceID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Platform"), "Json is missing required field 'Platform'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Device I D
                if (entry.Key == "DeviceID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DeviceID = (string)entry.Value;
                }

                // Platform
                else if (entry.Key == "Platform")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Platform = (string)entry.Value;
                }
            }
        }
Пример #27
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public GetCatalogVersionResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Latest"), "Json is missing required field 'Latest'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Session"), "Json is missing required field 'Session'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Latest
                if (entry.Key == "Latest")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    Latest = new CatalogMeta((IDictionary <string, object>)entry.Value);
                }

                // Session
                else if (entry.Key == "Session")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    Session = new CatalogMeta((IDictionary <string, object>)entry.Value);
                }
            }
        }
Пример #28
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MessageSendInventory(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Amount"), "Json is missing required field 'Amount'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Key
                if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }

                // Amount
                else if (entry.Key == "Amount")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Amount = (int)(long)entry.Value;
                }
            }
        }
Пример #29
0
        /// <summary>
        /// Initialises the response with the given json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the JSON data.</param>
        public SendMessageFromPlayerResponse(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("MessageID"), "Json is missing required field 'MessageID'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Message Id
                if (entry.Key == "MessageID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    MessageId = (string)entry.Value;
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MessageSender(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Chilli Connect Id
                if (entry.Key == "ChilliConnectID")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        ChilliConnectId = (string)entry.Value;
                    }
                }

                // User Name
                else if (entry.Key == "UserName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        UserName = (string)entry.Value;
                    }
                }

                // Display Name
                else if (entry.Key == "DisplayName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DisplayName = (string)entry.Value;
                    }
                }
            }
        }