コード例 #1
0
ファイル: DataManager.cs プロジェクト: RelinkaKing/UnityPC
    public void PreAssets()
    {
        DebugLog.DebugLogInfo("preasset---------------------------------");

        PublicClass.DataManagerStatus = DataIntState.StreamCopying;

        string source_path = string.Empty;

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        source_path = PublicClass.fileLocalStreamingPath.Replace("file://", "");
#elif UNITY_IOS
        source_path = PublicClass.fileLocalStreamingPath;
#elif UNITY_ANDROID
        source_path = PublicClass.fileLocalStreamingPath;
#endif
        string target_path = PublicClass.filePath;
        try
        {
            Vesal_DirFiles.DelectDirFiles(target_path, new List <string> {
                "PPT", "temp"
            });
            DebugLog.DebugLogInfo("delete files ok---------------------------------");
            UnityEngine.Debug.Log(source_path);
            UnityEngine.Debug.Log(copy_list.Count);
            PublicClass.InitDirFiles();

            stream_copy_list = PublicTools.DeepCopy <List <string> >(copy_list);
            for (int i = 0; i < stream_copy_list.Count; i++)
            {
                stream_copy_list[i] = source_path + stream_copy_list[i];
            }
            if (copy_list.Count > 0)
            {
                string source = stream_copy_list[stream_copy_count];
                string target = target_path + copy_list[stream_copy_count];
                StartCoroutine(Vesal_DirFiles.Vesal_FileCopy(source, target, count_stream_copy));
            }
            else
            {
                DebugLog.DebugLogInfo("stream copy 异常--------------------------------");

                PublicClass.DataManagerStatus = DataIntState.FetchDb;
            }
        }
        catch (Exception e)
        {
            UnityEngine.Debug.Log("current count :" + stream_copy_count);
            UnityEngine.Debug.Log(e.Message);
            UnityEngine.Debug.Log(e.StackTrace);
            PublicClass.DataManagerStatus = DataIntState.FetchDb;
        }
    }