Esempio n. 1
0
        public static void GetCloudScript(string titleId, Action <bool, List <CloudScriptFile> > callback)
        {
            var currentPlayFabTitleId = PlayFabSettings.TitleId;
            var currentDevKey         = PlayFabSettings.DeveloperSecretKey;

            var title = FindTitle(titleId);

            PlayFabSettings.TitleId            = titleId;
            PlayFabSettings.DeveloperSecretKey = title.SecretKey;

            var task = PlayFabAdminAPI.GetCloudScriptRevisionAsync(new GetCloudScriptRevisionRequest())
                       .ContinueWith(
                (result) =>
            {
                PlayFabSettings.TitleId            = currentPlayFabTitleId;
                PlayFabSettings.DeveloperSecretKey = currentDevKey;
                if (result.Result.Error != null)
                {
                    Console.WriteLine(PlayFabUtil.GetErrorReport(result.Result.Error));
                    callback(false, null);
                    return;
                }
                if (result.IsCompleted)
                {
                    callback(true, result.Result.Result.Files);
                }
            });
        }
Esempio n. 2
0
        public void GetCloudScriptRevision(bool showOutput = true)
        {
            var cloudRevsionRequest = new GetCloudScriptRevisionRequest();

            PlayFabAdminAPI.GetCloudScriptRevisionAsync(cloudRevsionRequest).ContinueWith((resultTask) =>
            {
                if (resultTask.IsCompleted)
                {
                    if (!resultTask.IsFaulted)
                    {
                        if (resultTask.Result.Result != null)
                        {
                            ToolSettings.CloudScriptRevision = resultTask.Result.Result.Revision;
                            ToolSettings.CloudScriptVersion  = resultTask.Result.Result.Version;
                            _cloudScriptFiles = resultTask.Result.Result.Files;

                            var sdkVer = PlayFab.Internal.PlayFabVersion.getVersionString();
                            if (showOutput)
                            {
                                Console.WriteLine(string.Format("{2} - Cloud Script - Revision:{0} Version:{1}", ToolSettings.CloudScriptRevision, ToolSettings.CloudScriptVersion, sdkVer));
                                CommandManager.Prompt();
                            }
                        }
                        else
                        {
                            Console.WriteLine(resultTask.Result.Error.ErrorMessage);
                            CommandManager.Prompt();
                        }
                    }
                    else
                    {
                        try
                        {
                            Console.WriteLine(resultTask.Result.Error.ErrorMessage);
                            CommandManager.Prompt();
                        }
                        catch (Exception e)
                        {
                            if (e.InnerException != null)
                            {
                                Console.WriteLine(HandleErrorMessage(e.InnerException.Message));
                            }
                            else
                            {
                                Console.WriteLine(e.Message);
                            }
                            CommandManager.Prompt();
                        }
                    }
                }
            });
        }
Esempio n. 3
0
        async public static Task <List <CloudScriptFile> > GetCloudScript(string titleId)
        {
            var currentPlayFabTitleId = PlayFabSettings.TitleId;
            var currentDevKey         = PlayFabSettings.DeveloperSecretKey;

            var title = FindTitle(titleId);

            PlayFabSettings.TitleId            = titleId;
            PlayFabSettings.DeveloperSecretKey = title.SecretKey;

            var result = await PlayFabAdminAPI.GetCloudScriptRevisionAsync(new GetCloudScriptRevisionRequest());

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