| | |
| | | using System.IO; |
| | | using System.Net; |
| | | using System.Text; |
| | | using Cysharp.Threading.Tasks; |
| | | using UnityEngine; |
| | | using UnityEngine.Networking; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //回合战报 |
| | | public void UnityWebRequestTurnFightGet(string _url, string guid, int timeout = 5, Action<bool, string, byte[]> _result = null) |
| | | { |
| | | GetDataBEx(_url, guid, timeout, _result).Forget(); |
| | | } |
| | | |
| | | async UniTask GetDataBEx(string remoteURL, string guid, int timeout, Action<bool, string, byte[]> _result = null) |
| | | { |
| | | UnityWebRequest request = UnityWebRequest.Get(remoteURL); |
| | | request.timeout = timeout; |
| | | await request.SendWebRequest(); |
| | | |
| | | if (request.isDone) |
| | | { |
| | | if (request.result == UnityWebRequest.Result.Success) |
| | | { |
| | | _result(true, guid, request.downloadHandler.data); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("GetDataBEx 失败 " + request.result.ToString()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | static StringBuilder buffer = new StringBuilder(); |
| | | public static string HashtablaToString(IDictionary<string, string> parameters) |