Exemple #1
0
 void LoadLibraryBundle(GameBundleLibrary.Entry entry, GameBuilderApplication.PlayOptions playOpts)
 {
     loadingScreen.ShowAndDo(() =>
     {
         sceneController.RestartAndLoadLibraryBundle(entry, playOpts);
     });
 }
Exemple #2
0
 private void OnRecoverAutosaveClicked()
 {
     if (autosaveId == null)
     {
         return;                 // Shouldn't happen
     }
     scenes.RestartAndLoadLibraryBundle(gameBundleLibrary.GetBundleEntry(autosaveId), new GameBuilderApplication.PlayOptions());
 }
    public override void OnConnectionFail(DisconnectCause cause)
    {
        if (cause == DisconnectCause.InvalidRegion)
        {
            OnInvalidJoinCodeRegion();
        }
        else
        {
            voosEngine.HackyForceSetIsRunning(false);

            if (Time.unscaledTime > 10f)
            {
                autosaves.SetPaused(true);
                autosaves.TriggerAutosave(autosaveBundleId =>
                {
                    if (numOthersWhenConnected == 0)
                    {
                        string userMessage = $"Woops! You were disconnected. Reason:\n{cause.ToString()}\nWe've auto-saved the project, so you can recover it and restart the multiplayer session.";
                        Util.LogError(userMessage);
                        popups.ShowTwoButtons(userMessage,
                                              "Recover Autosave",
                                              () =>
                        {
                            scenes.RestartAndLoadLibraryBundle(gameBundleLibrary.GetBundleEntry(autosaveBundleId), new GameBuilderApplication.PlayOptions());
                        },
                                              "Go to Main Menu",
                                              () => scenes.LoadSplashScreen(),
                                              800f
                                              );
                    }
                    else
                    {
                        string userMessage = $"Woops! You were disconnected. Reason:\n{cause.ToString()}. Please reconnect.\n<size=80%><color=#888888>NOTE: If the multiplayer game is gone, you can recover the autosave in your Game Library.</color></size>";
                        Util.LogError(userMessage);
                        popups.ShowTwoButtons(
                            userMessage,
                            $"Reconnect to {roomNameWhenConnected}",
                            () => scenes.JoinMultiplayerGameByCode(roomNameWhenConnected),
                            "Go to Main Menu",
                            () => scenes.LoadSplashScreen(),
                            800f);
                    }
                });
            }
            else
            {
                string userMessage = $"Woops! You were disconnected. Reason:\n{cause.ToString()}.";
                Util.LogError(userMessage);
                popups.Show(userMessage, "Back to Main Menu", () =>
                {
                    scenes.LoadSplashScreen();
                });
            }
        }
    }
    void GameResuming.ResumeOptionHandler.HandleBundleId(string bundleId)
    {
        if (!library.BundleExists(bundleId))
        {
            return;
        }
        var entry = library.GetBundleEntry(bundleId);

        // tutorialButton.gameObject.SetActive(false);
        resumeButton.gameObject.SetActive(true);
        resumeButton.SetThumbnail(entry.bundle.GetThumbnail());
        resumeButton.SetName(entry.bundle.GetMetadata().name);
        resumeButton.OnClick = () =>
        {
            popups.AskHowToPlay(playOpts =>
            {
                loadingScreen.ShowAndDo(() =>
                {
                    scenes.RestartAndLoadLibraryBundle(entry, playOpts);
                });
            });
        };
    }