Beispiel #1
0
        private IEnumerator UploadWorld(string worldName)
        {
            string path = GetServerDataPath() + "/Worlds/" + worldName;

            if (!Directory.Exists(path))
            {
                Debug.LogError($"Could not find directory to upload: {path}");
                yield break;
            }

            uploadErrors     = false;
            uploadInProgress = true;
            uploadProgress   = 0;
            uploadStartTime  = DateTime.Now;
            uploadProgressId = Progress.Start("Uploading world");

            AWSUtil aws = new AWSUtil();

            yield return(aws.UploadDirectory(GetServerDataPath(), progress => uploadProgress = progress, "Worlds/" + worldName + "/*").AsCoroutine());

            yield return(PublishWorldUpdates(worldName));

            Progress.Remove(uploadProgressId);
            uploadInProgress = false;

            if (uploadErrors)
            {
                EditorUtility.DisplayDialog("Error", "Upload could not be completed due to errors. Check the console for details.", "OK");
            }
            else
            {
                string channelName = null;
                switch (preparedReleaseChannel)
                {
                case 0:
                    channelName = "PRODUCTION";
                    break;

                case 1:
                    channelName = "BETA";
                    break;

                case 2:
                    channelName = "ALPHA";
                    break;
                }
                EditorUtility.DisplayDialog("Success", $"Upload of {worldName} completed. Use the " + channelName + " app to test.", "OK");
            }
        }
        private IEnumerator UploadLevels()
        {
            if (!Directory.Exists(GetServerDataPath()))
            {
                Debug.LogError("Could not find directory to upload: " + GetServerDataPath());
                yield break;
            }

            uploadInProgress = true;
            uploadProgress   = 0;
            uploadStartTime  = DateTime.Now;

            AWSUtil aws = new AWSUtil();

            yield return(aws.UploadDirectory(GetServerDataPath(), progress => uploadProgress = progress).AsCoroutine());

            EditorUtility.ClearProgressBar();
            uploadInProgress = false;

            EditorUtility.DisplayDialog("Success", "Upload completed.", "OK");
        }