예제 #1
0
        /// <summary>
        /// Called right before the build process starts
        /// </summary>
        /// <param name="report">A summary of the build process</param>
        public void OnPreprocessBuild(BuildReport report)
        {
            if (report.summary.platform != BuildTarget.WebGL)
            {
                return;
            }
            AnalyticsHelper.BuildStarted(buildStartedFromTool);

            if (buildStartedFromTool)
            {
                return;
            }
            //then we need to wait until the build process finishes, in order to get the proper BuildReport
            EditorCoroutineUtility.StartCoroutineOwnerless(WaitUntilBuildFinishes(report));
        }
        static void CheckProgress(Store <AppState> store, string key)
        {
            var token = UnityConnectSession.instance.GetAccessToken();

            if (token.Length == 0)
            {
                CheckLoginStatus(store);
                return;
            }

            key = key ?? store.state.key;
            string baseUrl = GetAPIBaseUrl();

            var uploadRequest = UnityWebRequest.Get($"{baseUrl + QueryProgressEndpoint}?key={key}");

            uploadRequest.SetRequestHeader("Authorization", $"Bearer {token}");
            uploadRequest.SetRequestHeader("X-Requested-With", "XMLHTTPREQUEST");
            var op = uploadRequest.SendWebRequest();

            op.completed += operation =>
            {
#if UNITY_2020
                if ((uploadRequest.result == UnityWebRequest.Result.ConnectionError) ||
                    (uploadRequest.result == UnityWebRequest.Result.ProtocolError))
#else
                if (uploadRequest.isNetworkError || uploadRequest.isHttpError)
#endif
                {
                    AnalyticsHelper.UploadCompleted(UploadResult.Failed);
                    Debug.LogError(uploadRequest.error);
                    StopUploadAction();
                    return;
                }
                var response = JsonUtility.FromJson <GetProgressResponse>(op.webRequest.downloadHandler.text);

                store.Dispatch(new QueryProgressResponseAction {
                    response = response
                });
                if (response.progress == 100 || !string.IsNullOrEmpty(response.error))
                {
                    SaveProjectID(response.projectId);
                    return;
                }
                EditorCoroutineUtility.StartCoroutineOwnerless(RefreshProcessingProgress(1.5f, store));
            };
        }
예제 #3
0
        void OnDeleteClicked(string buildPath, string gameTitle)
        {
            if (!Directory.Exists(buildPath))
            {
                Store.Dispatch(new OnErrorAction()
                {
                    errorMsg = Localization.Tr("ERROR_BUILD_NOT_FOUND")
                });
                return;
            }

            if (ShowDeleteBuildPopup(gameTitle))
            {
                AnalyticsHelper.ButtonClicked(string.Format("{0}_Delete_RemoveFromList", CurrentTab));
                PublisherUtils.RemoveBuildDirectory(buildPath);
                SetupUploadTab();
            }
        }
예제 #4
0
        void OnPublishClicked(string gameBuildPath, string gameTitle)
        {
            AnalyticsHelper.ButtonClicked(string.Format("{0}_Publish", CurrentTab));
            if (!PublisherUtils.BuildIsValid(gameBuildPath))
            {
                Store.Dispatch(new OnErrorAction()
                {
                    errorMsg = Localization.Tr("ERROR_BUILD_CORRUPTED")
                });
                return;
            }

            this.gameTitle = gameTitle;
            FormatGameTitle();
            Store.Dispatch(new PublishStartAction()
            {
                title = gameTitle, buildPath = gameBuildPath
            });
        }
예제 #5
0
        void OnLocateBuildClicked()
        {
            AnalyticsHelper.ButtonClicked(string.Format("{0}_LocateBuild", CurrentTab));

            string lastBuildPath = PublisherUtils.GetFirstValidBuildPath();

            if (string.IsNullOrEmpty(lastBuildPath) && PublisherBuildProcessor.CreateDefaultBuildsFolder)
            {
                lastBuildPath = PublisherBuildProcessor.DefaultBuildsFolderPath;
                if (!Directory.Exists(lastBuildPath))
                {
                    Directory.CreateDirectory(lastBuildPath);
                }
            }

            string buildPath = EditorUtility.OpenFolderPanel(Localization.Tr("DIALOG_CHOOSE_FOLDER"), lastBuildPath, string.Empty);

            if (string.IsNullOrEmpty(buildPath))
            {
                return;
            }
            if (!PublisherUtils.BuildIsValid(buildPath))
            {
                Store.Dispatch(new OnErrorAction()
                {
                    errorMsg = Localization.Tr("ERROR_BUILD_CORRUPTED")
                });
                return;
            }
            PublisherUtils.AddBuildDirectory(buildPath);
            if (CurrentTab != TabUpload)
            {
                return;
            }
            SetupUploadTab();
        }
예제 #6
0
 void OnOpenBuildFolderClicked(string buildPath)
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_OpenBuildFolder", CurrentTab));
     EditorUtility.RevealInFinder(buildPath);
 }
예제 #7
0
 void OnCancelUploadClicked()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_CancelUpload", CurrentTab));
     AnalyticsHelper.UploadCompleted(UploadResult.Cancelled);
     Store.Dispatch(new StopUploadAction());
 }
예제 #8
0
 void OnFinishClicked()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_Finish", CurrentTab));
     Store.Dispatch(new DestroyAction());
 }
예제 #9
0
 void OnOpenBuildSettingsClicked()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_OpenBuildSettings", CurrentTab));
     BuildPlayerWindow.ShowBuildPlayerWindow();
 }
예제 #10
0
 void OnToggleAutoPublish()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_ToggleAutoPublish", CurrentTab));
     autoPublishSuccessfulBuilds.SetValue(!autoPublishSuccessfulBuilds);
     SetupBuildButtonInUploadTab();
 }
예제 #11
0
 void OnOpenHelpClicked()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_OpenHelp", CurrentTab));
     Application.OpenURL("https://learn.unity.com/tutorial/fps-mod-share-your-game-on-the-web?projectId=5d9c91a4edbc2a03209169ab#5db306f5edbc2a001f7a307d");
 }
예제 #12
0
 void OnSignInClicked()
 {
     AnalyticsHelper.ButtonClicked(string.Format("{0}_SignIn", CurrentTab));
     UnityConnectSession.instance.ShowLogin();
 }