Example #1
0
        public static void SetPublisherData(string publisherDataKey, string publisherDataValue)
        {
            if (string.IsNullOrEmpty(publisherDataValue))
            {
                publisherDataValue = null; // Ensure that this field is removed
            }
            if (!PfSharedModelEx.defaultPublisherKeys.Contains(publisherDataKey))
            {
                throw new Exception("TEMPORARY LIMITATION: Add this key to defaultPublisherKeys:" + publisherDataKey + ".  You must keep track of the keys you create, because GetPublisherData won't return keys you don't explicitly ask for.");
            }

            // This api-call updates one PublisherData key at a time.
            // You can remove a key by setting the value to null.
            var updateRequest = new ServerModels.SetPublisherDataRequest();

            updateRequest.Key   = publisherDataKey;
            updateRequest.Value = publisherDataValue;

            PlayFabServerAPI.SetPublisherData(updateRequest, SetPublisherDataCallback, PfSharedControllerEx.FailCallback("SetPublisherData"));
        }
Example #2
0
        public static Action SetPublisherData(string PublisherDataKey, string PublisherDataValue)
        {
            if (string.IsNullOrEmpty(PublisherDataValue))
                PublisherDataValue = null; // Ensure that this field is removed

            Action output = () =>
            {
                // This api-call updates one PublisherData key at a time.
                // You can remove a key by setting the value to null.
                var updateRequest = new ServerModels.SetPublisherDataRequest();
                updateRequest.Key = PublisherDataKey;
                updateRequest.Value = PublisherDataValue;

                PlayFabServerAPI.SetPublisherData(updateRequest, SetPublisherDataCallback, PfSharedControllerEx.FailCallback("SetPublisherData"));
            };
            return output;
        }