Esempio n. 1
0
    private T LoadRecords <T>(string path)  where T : new()
    {
        T t = StreamTools.DeserializeObject <T>(path);

        if (t == null)
        {
            Debug.Log("File : " + path + " does not exist, now create.");
            t = new T();
        }
        return(t);
    }
Esempio n. 2
0
    public static PoolDataAsset GetPoolDatas()
    {
#if !UNITY_ANDROID || UNITY_EDITOR
        if (PoolDatas == null)
        {
            PoolDatas = StreamTools.DeserializeObject <PoolDataAsset>(StreamTools.GetStreamingAssetsPath() + PoolDataAssetsFile);
            if (PoolDatas == null)
            {
                UnityEngine.Debug.Log("Pool asset data is null");
                PoolDatas = new PoolDataAsset();
            }
        }
#endif
        return(PoolDatas);
    }
Esempio n. 3
0
    IEnumerator LoadPoolAsset(Delegate1Args <PoolDataAsset> onloaded)
    {
        WWW www = new WWW(ConstantData.PoolDataAssetsFile);

        Debug.Log("load file : " + ConstantData.PoolDataAssetsFile);
        yield return(www);

        if (string.IsNullOrEmpty(www.error))
        {
            Debug.Log("load file success");
            onloaded(StreamTools.DeserializeObject <PoolDataAsset>(www.bytes));
        }
        else
        {
            Debug.LogError(www.error);
        }
    }
Esempio n. 4
0
    public static IEnumerator LoadBytes <T>(string filePath, Delegate1Args <T> onloaded) where T : new()
    {
        WWW www = new WWW(filePath);

        Debug.Log("Loading file : " + filePath);
        yield return(www);

        if (string.IsNullOrEmpty(www.error))
        {
            Debug.Log("Load file success : " + filePath);
            onloaded(StreamTools.DeserializeObject <T>(www.bytes));
        }
        else
        {
            Debug.Log(www.error);
            onloaded(default(T));
        }
    }