Example #1
0
    public static void Load()
    {
#if UNITY_WEBGL //GameJolt
        if (Manager.Instance.CurrentUser != null)
        {
            DataStore.Get(Manager.Instance.CurrentUser.ID.ToString(), true, (string S2) => {
                if (!string.IsNullOrEmpty(S2))
                {
                    Debug.Log("Dados Carregados do Jolt");
                    SaveDatesForJolt.SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
                }
                else
                {
                    Debug.Log("string nula do Jolt");
                    new SaveDatesForJolt();
                }

                GameObject.FindObjectOfType <LoginJoltManager>().StartCoroutine(Carregado());
            });
        }
#endif
#if UNITY_N3DS
        UnityEngine.N3DS.FileSystemSave.Mount();
        string S2 = string.Empty;
        if (File.Exists(Application.persistentDataPath + "/file1"))
        {
            StreamReader sr = File.OpenText(Application.persistentDataPath + "/file1");
            S2 = sr.ReadLine();
            sr.Close();
        }



        UnityEngine.N3DS.FileSystemSave.Unmount();

        if (!string.IsNullOrEmpty(S2))
        {
            Debug.Log("não é null");
            SaveDatesForJolt.SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
        }
        else
        {
            Debug.Log("não achou");
            new SaveDatesForJolt();
        }
        Debug.Log("sou um N3DS");
        GameObject.FindObjectOfType <LoginJoltManager>().StartCoroutine(Carregado());
#endif

#if !UNITY_N3DS && !UNITY_WEBGL
        string S2 = PlayerPrefs.GetString("dates_RK", string.Empty);

        if (!string.IsNullOrEmpty(S2))
        {
            SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
        }
        else
        {
            Debug.Log("nada encontrado");
            new SaveDatesManager();
        }

        //  GlobalController.g.StartCoroutine(Carregado());
#endif
        //    GlobalController.g.StartCoroutine(Carregado());
    }
    public static void Load()
    {
#if UNITY_WEBGL //GameJolt
        //Colocado posteriormente para corrigir bugs
        new SaveDatesManager();

        if (UrlVerify.DomainsContainString("gamejolt"))
        {
            ForGameJoltDatesManager.Load();
            EventAgregator.Publish(new StandardSendGameEvent(EventKey.testLoadForJolt, "Url foi sim encontrada"));
        }
        else
        {
            EventAgregator.Publish(new StandardSendGameEvent(EventKey.testLoadForJolt, "Url não encontrado na segunda chamada"));
        }
#endif
#if UNITY_N3DS
        UnityEngine.N3DS.FileSystemSave.Mount();
        string S2 = string.Empty;
        if (File.Exists(Application.persistentDataPath + "/file1"))
        {
            StreamReader sr = File.OpenText(Application.persistentDataPath + "/file1");
            S2 = sr.ReadLine();
            sr.Close();
        }



        UnityEngine.N3DS.FileSystemSave.Unmount();

        if (!string.IsNullOrEmpty(S2))
        {
            Debug.Log("não é null");
            SaveDatesForJolt.SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
        }
        else
        {
            Debug.Log("não achou");
            new SaveDatesForJolt();
        }
        Debug.Log("sou um N3DS");
        GameObject.FindObjectOfType <LoginJoltManager>().StartCoroutine(Carregado());
#endif

#if !UNITY_N3DS && !UNITY_WEBGL
        string S2 = PlayerPrefs.GetString("dates_RK", string.Empty);

        if (!string.IsNullOrEmpty(S2))
        {
            SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
        }
        else
        {
            Debug.Log("nada encontrado");
            new SaveDatesManager();
        }

        //  GlobalController.g.StartCoroutine(Carregado());
#endif
        //    GlobalController.g.StartCoroutine(Carregado());
    }