Beispiel #1
0
    public void LoadNextScene(bool quickLoad, bool getUserDataFromServer = false)
    {
        // get user data from server before loading the next scene
        // NOTE: state is held in Main Memory throughtout the game so: only do this as needed
        //       (ie game startup)
        if (getUserDataFromServer)
        {
            Debug.Log("Checking if Client is Logged In...");
        }
        else
        {
            Debug.Log("WARNING: Loading next scene without getting user data from server...");
        }
        // every new scene (except the splash scene) will result in a pull of the users data from playfab
        if (PlayFabClientAPI.IsClientLoggedIn() && getUserDataFromServer)
        {
            Debug.Log("Yes Client is Logged In  ...Cool.");

            // Load Game Player Related Data
            LoadPlayerSettings();

            // Load Game Player Related Data
            LoadGameSettings();

            // Load Game Title Scoped Data
            LoadTitleData();

            // Use game data to figure out what scene we need to load first
            // for example is story has never been shown we might start player
            // off in the story scene
            AssignDefaultData();
        }

        LoadingSceneManager loadSceneManager = Object.FindObjectOfType <LoadingSceneManager>();

        if (loadSceneManager != null)
        {
            GameState.Instance.CurrentScene = (string)GameManager.Instance.GetLastSceneInBreadCrumb();
            Debug.Log("Loading the Next Scene (" + GameState.Instance.CurrentScene + ")...");
            loadSceneManager.LoadNextScene(GameState.Instance.CurrentScene, quickLoad);
        }
    }