2024年5月4日发(作者:)

public void SendPost(EOPERATION op, Dictionary dic)

{

//根据协议号获取完整路径

string url = ipAddress + mURLs[op];

StartCoroutine(Post(url, dic, op));

}

///

/// 获取数据

///

///

public void SendGet(EOPERATION op, string name = "")

{

string url = ipAddress + mURLs[op] + "/" + name;

StartCoroutine(Get(url, op, name));

}

///

/// 获取下载进度

///

///

public float GetProgress()

{

if (request == null || !isStartDownload)

return 0;

return adProgress;

}

private IEnumerator Get(string url, EOPERATION op, string name)

{

if (!OrEmpty(url))

{

using (request = (url))

{

isStartDownload = true;

//设置超时 链接超时返回 且isNetworkError为true

t = 30;

yield return bRequest();

isStartDownload = false;

//结果回传给具体实现

if (Error || orkError)

{

();

}

else

{

_handers;

}

};

}

}

//private WWW http;

private IEnumerator Post(string url, Dictionary dic, EOPERATION op)

{

if (!OrEmpty(url))

{

WWWForm form = new WWWForm();

foreach (var item in dic)

{

ld(, );

}

using (request = (url, form))

{

yield return bRequest();

//结果回传给具体实现

if (Error || orkError)

{

();