Beispiel #1
0
    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");
            SetSavesWithBytes(JsonUtility.FromJson <preJSON>(S2).b);
        }
        else
        {
            Debug.Log("não achou");
            new SaveDatesManager();
        }
        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());
    }
    // Use this for initialization
    void Start()
    {
        estaNoJolt = UrlVerify.DomainsContainString("gamejolt", myText);

        if (estaNoJolt)
        {
            blackcanvas.SetActive(false);
        }
        else
        {
            SaveDatesManager.Load();
            SceneManager.LoadScene("menuInicial");
        }

        if (!GameObject.Find("GameJoltAPI"))
        {
            JoltManager.SetActive(true);
        }

        EventAgregator.AddListener(EventKey.testLoadForJolt, OnRequestTestLoadForJolt);
    }
Beispiel #3
0
    public static void Save()
    {
#if UNITY_WEBGL //GameJolt
        if (UrlVerify.DomainsContainString("gamejolt"))
        {
            ForGameJoltDatesManager.Save(s);
        }
#endif
#if UNITY_N3DS
        if (s != null)
        {
            byte[]  sb  = SaveDatesForBytes();
            preJSON pre = new preJSON()
            {
                b = sb
            };
            UnityEngine.N3DS.FileSystemSave.Mount();

            StreamWriter sw = File.CreateText(Application.persistentDataPath + "/file1");
            sw.WriteLine(JsonUtility.ToJson(pre));
            sw.Close();
            UnityEngine.N3DS.FileSystemSave.Unmount();
        }
#endif
#if !UNITY_N3DS && !UNITY_WEBGL
        if (s != null && !GlobalController.g.EmTeste)
        {
            byte[]  sb  = SaveDatesForBytes();
            preJSON pre = new preJSON()
            {
                b = sb
            };

            PlayerPrefs.SetString("dates_RK", JsonUtility.ToJson(pre));

            PlayerPrefs.Save();
        }
#endif
    }