void RebuildFrontend()
        {
            if (currentShareStep != store.state.shareState.step)
            {
                currentShareStep = store.state.shareState.step;
            }

            bool loggedOut = (currentShareStep == ShareStep.Login);

            if (loggedOut)
            {
                LoadTab(TAB_NOT_LOGGED_IN);
                return;
            }

            bool buildIsUnavailable = !SharePackageUtils.LastBuildIsValid();

            if (buildIsUnavailable)
            {
                LoadTab(TAB_NO_BUILD);
                return;
            }

            string projectUrl = store.state.shareState.url;

            if (!string.IsNullOrEmpty(projectUrl))
            {
                LoadTab(TAB_SUCCESS);
                return;
            }

            string errorMsg = store.state.shareState.errorMsg;

            if (!string.IsNullOrEmpty(errorMsg))
            {
                LoadTab(TAB_ERROR);
                return;
            }

            if (currentShareStep == ShareStep.Upload)
            {
                LoadTab(TAB_UPLOADING);
                return;
            }

            if (currentShareStep == ShareStep.Process)
            {
                LoadTab(TAB_PROCESSING);
                return;
            }

            LoadTab(TAB_UPLOAD);
        }
Example #2
0
        private static void ZipAndShare(string title, Store <AppState> store)
        {
            store.Dispatch(new TitleChangeAction {
                title = title
            });

            if (!SharePackageUtils.LastBuildIsValid())
            {
                store.Dispatch(new OnErrorAction {
                    errorMsg = "Please build project first!"
                });
                return;
            }

            string buildOutputDir = SharePackageUtils.GetBuildOutputDirectory();

            if (!Zip(store, buildOutputDir))
            {
                return;
            }
            store.Dispatch(new UploadStartAction());
        }
        void OnShareClicked()
        {
            if (!SharePackageUtils.LastBuildIsValid() && !SharePackageUtils.WasBuildWarningDisplayed())
            {
                bool userWantsToBuild = DisplayDialogWindow
                                        (
                    "Are you sure?",
                    "Building the game may take several minutes, and the editor will not respond to any input in the meanwhile. Are you sure you want to build the game now?",
                    "Yes!",
                    "Not really"
                                        );
                if (!userWantsToBuild)
                {
                    return;
                }
            }

            if (!ModuleManagerProxy.IsBuildPlatformInstalled(BuildTarget.WebGL))
            {
                bool userWantsToInstallWebGL = DisplayDialogWindow
                                               (
                    "Missing Build Platform",
                    "Your Unity Editor does not have the WebGL module installed. Therefore, it is not possible to make a WebGL build.\nWould you like to install it now?",
                    "Yes!",
                    "Not really"
                                               );

                if (userWantsToInstallWebGL)
                {
                    SharePackageUtils.TellUnityHubToInstallWebGL();
                }
                return;
            }
            store.Dispatch(new ShareStartAction()
            {
                title = gameTitle
            });
        }
        void SetupUploadTab()
        {
            SetupButton("btnShare", OnShareClicked, true);
            SetupButton("btnSelectImage", OnSelectImageClicked, true);
            SetupImage("imgThumbnail", SharePackageUtils.GetThumbnailPath());

            TextField txtProjectName = root.Query <TextField>("txtProjectName");

            txtProjectName.RegisterValueChangedCallback(OnGameTitleChanged);
            txtProjectName.value = gameTitle;

            if (SharePackageUtils.LastBuildIsValid())
            {
                string lastOutputDirectory = SharePackageUtils.GetBuildOutputDirectory();
                SetupLabel(
                    "lblLastBuildInfo",
                    $"Last build located at {lastOutputDirectory}, created {File.GetLastWriteTime(lastOutputDirectory)}"
                    );
                return;
            }

            //[NOTE]: you should never get here
            SetupLabel("lblLastBuildInfo", "No previous build available...");
        }