Esempio n. 1
0
        public async Task <bool> UploadVc()
        {
            LogToFile("Uploading Virtual Currency Settings...");
            if (string.IsNullOrEmpty(currencyPath))
            {
                LogToFile("irtual Currency Settings File Path is Null ");
                return(true);
            }
            var parsedFile = ParseFile(currencyPath);
            var vcData     = JsonWrapper.DeserializeObject <List <VirtualCurrencyData> >(parsedFile);
            var request    = new AddVirtualCurrencyTypesRequest
            {
                VirtualCurrencies = vcData
            };

            if (token.IsCancellationRequested)
            {
                return(true);
            }

            var updateVcTask = await PlayFabAdminAPI.AddVirtualCurrencyTypesAsync(request);

            //updateVcTask.Wait();

            if (updateVcTask.Error != null)
            {
                OutputPlayFabError("\tVC Upload Error: ", updateVcTask.Error);
                return(false);
            }

            LogToFile("\tUploaded VC!", ConsoleColor.Green);
            return(true);
        }
Esempio n. 2
0
        public static void UpdateCurrencyData(string titleId, List <VirtualCurrencyData> currencyData, Action <bool> callback)
        {
            var currentPlayFabTitleId = PlayFabSettings.TitleId;
            var currentDevKey         = PlayFabSettings.DeveloperSecretKey;

            var title = FindTitle(titleId);

            PlayFabSettings.TitleId            = titleId;
            PlayFabSettings.DeveloperSecretKey = title.SecretKey;
            var task = PlayFabAdminAPI.AddVirtualCurrencyTypesAsync(new AddVirtualCurrencyTypesRequest()
            {
                VirtualCurrencies = currencyData
            })
                       .ContinueWith(
                (result) =>
            {
                PlayFabSettings.TitleId            = currentPlayFabTitleId;
                PlayFabSettings.DeveloperSecretKey = currentDevKey;
                if (result.Result.Error != null)
                {
                    //Console.WriteLine(PlayFabUtil.GetErrorReport(result.Result.Error));
                    callback(false);
                    return;
                }
                if (result.IsCompleted)
                {
                    callback(true);
                }
            });
        }
        private async Task <bool> VirtualCurrency(string parsedFile, CancellationToken token)
        {
            var vcData  = JsonWrapper.DeserializeObject <List <VirtualCurrencyData> >(parsedFile);
            var request = new AddVirtualCurrencyTypesRequest
            {
                VirtualCurrencies = vcData
            };

            var updateVcTask = await PlayFabAdminAPI.AddVirtualCurrencyTypesAsync(request);

            if (updateVcTask.Error != null)
            {
                OutputPlayFabError("\tVC Upload Error: ", updateVcTask.Error);
                return(false);
            }

            LogToFile("\tUploaded VC!");
            return(true);
        }
Esempio n. 4
0
        private static bool UploadVc()
        {
            LogToFile("Uploading Virtual Currency Settings...");
            var parsedFile = ParseFile(currencyPath);
            var vcData     = JsonWrapper.DeserializeObject <List <VirtualCurrencyData> >(parsedFile);
            var request    = new AddVirtualCurrencyTypesRequest
            {
                VirtualCurrencies = vcData
            };

            var updateVcTask = PlayFabAdminAPI.AddVirtualCurrencyTypesAsync(request);

            updateVcTask.Wait();

            if (updateVcTask.Result.Error != null)
            {
                OutputPlayFabError("\tVC Upload Error: ", updateVcTask.Result.Error);
                return(false);
            }

            LogToFile("\tUploaded VC!", ConsoleColor.Green);
            return(true);
        }
Esempio n. 5
0
        async public static Task <BlankResult> UpdateCurrencyData(string titleId, List <VirtualCurrencyData> currencyData)
        {
            var currentPlayFabTitleId = PlayFabSettings.TitleId;
            var currentDevKey         = PlayFabSettings.DeveloperSecretKey;

            var title = FindTitle(titleId);

            PlayFabSettings.TitleId            = titleId;
            PlayFabSettings.DeveloperSecretKey = title.SecretKey;
            var result = await PlayFabAdminAPI.AddVirtualCurrencyTypesAsync(new AddVirtualCurrencyTypesRequest()
            {
                VirtualCurrencies = currencyData
            });

            PlayFabSettings.TitleId            = currentPlayFabTitleId;
            PlayFabSettings.DeveloperSecretKey = currentDevKey;
            if (result.Error != null)
            {
                Console.WriteLine(PlayFabUtil.GetErrorReport(result.Error));
                return(null);
            }
            return(result.Result);
        }