// #if UNITY_ANDROID && (!UNITY_EDITOR) /// <summary> /// 复制StreamingAsset资源 /// </summary> private void CopyAssetDirectory() { if (GloablDefine.resbasePathList.Count > 0 && resbaseIndex < GloablDefine.resbasePathList.Count) { var resbasePath = GloablDefine.resbasePathList[resbaseIndex]; var fullresbasePath = Path.Combine(StreamingAssetHelper.AssetPathDir, resbasePath); DirectoryInfo directoryInfo = new DirectoryInfo(fullresbasePath); resbaseIndex++; //Debug.LogWarning("------------------------>resbasePath" + fullresbasePath); //Debug.LogWarning("------------------------>resbasePath Is Exist" + directoryInfo.Exists); if (!directoryInfo.Exists) { UICopyingAssetHelper.Instance().UpdateUI(resbaseIndex, GloablDefine.resbasePathList.Count, "首次运行游戏正在解压资源..."); StreamingAssetHelper.CopyAssetDirectoryInThread(resbasePath, resbasePath, OnCopyAssetDirectoryNext); } else { OnCopyAssetDirectoryNext(true); } } else { OnCopyAssetDirectoryFinished(); } }
// Use this for initialization void Start() { timerID = Timer.RunPerSecond((time) => { if (index <= totalCount) { UICopyingAssetHelper.Instance().UpdateUI(index, totalCount, "正在拷贝资源..."); index++; } else { UICopyingAssetHelper.Instance().Close(); Timer.Cancel(timerID); } }, null); }
// Use this for initialization void Start() { timerID = TimeHelper.SetRepeatTimer(() => { if (index <= totalCount) { UICopyingAssetHelper.Instance().UpdateUI(index, totalCount, "正在拷贝资源..."); index++; } else { UICopyingAssetHelper.Instance().Close(); TimeHelper.KillTimer(timerID); } }, 1.0f); }
/// <summary> /// 所有的资源拷贝完成之后的回调 /// </summary> private void OnCopyAssetDirectoryFinished() { UICopyingAssetHelper.Instance().Close(); gameManager.InitGameCore(gameObject); }