Ejemplo n.º 1
0
    private void Awake()
    {
        BetterStreamingAssets.Initialize();

        localPath = string.Format("{0}/GymnasticVideo", Application.persistentDataPath);

        //get gymnastic file list
        files = new List <string>();

#if UNITY_EDITOR
        StreamReader sReader = new StreamReader(Path.Combine(Application.streamingAssetsPath, "GymnasticInfo.csv"));
#elif UNITY_ANDROID
        StreamReader sReader = BetterStreamingAssets.OpenText("GymnasticInfo.csv");
#endif
        string readData;

        if (sReader == null)
        {
            Debug.LogWarning("sReader null");
        }
        else
        {
            while ((readData = sReader.ReadLine()) != null)
            {
                //Debug.LogWarning("data : " + sReader.ReadLine());
                try
                {
                    files.Add(readData.Split(',')[0]);
                }
                catch (Exception e)
                {
                    //Debug.LogWarning("not pose data in " + idx + " : " + e.Message);
                }
            }
            sReader.Close();
            sReader = null;
        }
        //end

        //check directory
        if (!Directory.Exists(localPath))
        {
            Directory.CreateDirectory(localPath);
        }

        //check exist files & file download contain under coroutine
        StartCoroutine(StartDownLoad());
    }