12345678910111213141516171819202122232425262728293031323334 |
- using MRStore.Util;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- namespace XRTool.Util
- {
- /// <summary>
- /// 自定义下载器
- /// 支持大文件断点续传
- /// </summary>
- public class DataDownLoadHandler : DownloadHandlerScript
- {
- /// <summary>
- /// 接收到数据
- /// </summary>
- public event Action<byte[], int> OnReceiveData;
- /// <summary>
- /// 接收数据
- /// </summary>
- /// <param name="data"></param>
- /// <param name="dataLength"></param>
- /// <returns></returns>
- protected override bool ReceiveData(byte[] data, int dataLength)
- {
- if (data != null && data.Length > 0)
- {
- OnReceiveData?.Invoke(data, dataLength);
- }
- return base.ReceiveData(data, dataLength);
- }
- }
- }
|