Пример #1
0
    void MasterClientInit()
    {
        SaveGameToLoad saveGameToLoad = FindObjectOfType <SaveGameToLoad>();
        string         bundleId       = GameBuilderApplication.CurrentGameOptions.bundleIdToLoad;

        if (saveGameToLoad)
        {
            Debug.Log("Loading saved game!");
            saveLoad.Load(saveGameToLoad.saved, saveGameToLoad.voosFilePath);
            GameObject.Destroy(saveGameToLoad.gameObject);
        }
        else if (!bundleId.IsNullOrEmpty())
        {
            Debug.Log($"Loading game bundle {bundleId}");
            string voosPath = gameBundleLibrary.GetBundle(bundleId).GetVoosPath();
            saveLoad.Load(SaveLoadController.ReadSaveGame(voosPath), voosPath);
#if !USE_STEAMWORKS
            workshop.Load(gameBundleLibrary.GetBundle(bundleId).GetAssetsPath());
#endif
            lastLoadedBundleId = bundleId;
        }
        else
        {
            SaveLoadController.SaveGame save = SaveLoadController.ReadSaveGame(GameBuilderSceneController.GetMinimalScenePath(mode == Mode.Online));
            saveLoad.Load(save);
        }

        using (Util.Profile("SpawnLocalobjects"))
            SpawnLocalObjects();
        StartCoroutine(LoadingSequence());
    }
Пример #2
0
    public void RestartAndLoad(string filePath, GameBuilderApplication.GameOptions gameOptions = new GameBuilderApplication.GameOptions())
    {
        SaveLoadController.SaveGame save = SaveLoadController.ReadSaveGame(filePath);

        LoadMainSceneAsync(gameOptions);

        // TODO couldn't I put this in gameOptions instead..?
        // And then, we need to communicate the desire to load, so we use this SaveGameToLoad object.
        GameObject loadMe = new GameObject("LoadMePlease");

        GameObject.DontDestroyOnLoad(loadMe);
        var tag = loadMe.AddComponent <SaveGameToLoad>();

        tag.voosFilePath = filePath;
        tag.saved        = save;
    }