Пример #1
0
    //
#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();
        }
    }
Пример #2
0
 public override void OnDestroy()
 {
     base.OnDestroy();
     instance     = null;
     background   = null;
     progressText = null;
     isCreate     = false;
 }
Пример #3
0
 /// <summary>
 /// 本UI设计单例,便于访问操作等
 /// </summary>
 /// <returns></returns>
 public static UICopyingAssetHelper Instance()
 {
     if (null == instance)
     {
         instance = new UICopyingAssetHelper();
     }
     return(instance);
 }
Пример #4
0
 // 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);
 }
Пример #5
0
 // 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);
 }
Пример #6
0
 /// <summary>
 /// 所有的资源拷贝完成之后的回调
 /// </summary>
 private void OnCopyAssetDirectoryFinished()
 {
     UICopyingAssetHelper.Instance().Close();
     gameManager.InitGameCore(gameObject);
 }