This commit is contained in:
账号名 2023-11-23 14:27:17 +08:00
commit cd148c30b5
2 changed files with 6 additions and 10 deletions

View File

@ -160,9 +160,7 @@ public class GameManager : MonoSingleton<GameManager>
private IEnumerator WaitSpawn(string msg) private IEnumerator WaitSpawn(string msg)
{ {
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
Debug.Log(msg);
string[] data = msg.Split(','); string[] data = msg.Split(',');
switch (data[0]) switch (data[0])
{ {
case "online": case "online":
@ -287,7 +285,7 @@ public class GameManager : MonoSingleton<GameManager>
{ {
if (string.IsNullOrWhiteSpace(obj)) return; if (string.IsNullOrWhiteSpace(obj)) return;
string[] data = obj.Split(';'); string[] data = obj.Split(';');
Debug.Log("datas=" + data[0]); //Debug.Log("datas=" + data[0]);
for (int i = 0; i < data.Length; i++) for (int i = 0; i < data.Length; i++)
{ {
int index = i; int index = i;
@ -303,9 +301,7 @@ public class GameManager : MonoSingleton<GameManager>
userIds.Add(ulong.Parse(userInfo[0])); userIds.Add(ulong.Parse(userInfo[0]));
} }
} }
SpawnDevice(); SpawnDevice();
string msg = $"send2room online,{ulong.Parse(GlobalFlag.currentUser.user_id)},{GlobalFlag.currentUser.login_name},{ulong.Parse(GlobalFlag.roomID)}"; string msg = $"send2room online,{ulong.Parse(GlobalFlag.currentUser.user_id)},{GlobalFlag.currentUser.login_name},{ulong.Parse(GlobalFlag.roomID)}";
_ = SyncCreateRoom.SendMessageAsync(msg); _ = SyncCreateRoom.SendMessageAsync(msg);
} }

View File

@ -17,7 +17,7 @@ public static class AsyncWebReq
var getRequest = CreateRequest(endpoint); var getRequest = CreateRequest(endpoint);
await getRequest.SendWebRequest(); await getRequest.SendWebRequest();
#if UNITY_EDITOR #if UNITY_EDITOR
Debug.Log("async Get req : " + getRequest.downloadHandler.text); //Debug.Log("async Get req : " + getRequest.downloadHandler.text);
#endif #endif
T result = JsonUtility.FromJson<T>(getRequest.downloadHandler.text); T result = JsonUtility.FromJson<T>(getRequest.downloadHandler.text);
getRequest.Dispose(); getRequest.Dispose();
@ -30,8 +30,8 @@ public static class AsyncWebReq
var postRequest = CreateRequest(endpoint, RequestType.POST, payload); var postRequest = CreateRequest(endpoint, RequestType.POST, payload);
await postRequest.SendWebRequest(); await postRequest.SendWebRequest();
#if UNITY_EDITOR #if UNITY_EDITOR
Debug.Log("async Post req : " + postRequest.downloadHandler.text); //Debug.Log("async Post req : " + postRequest.downloadHandler.text);
Debug.Log("endpoint : " + endpoint); //Debug.Log("endpoint : " + endpoint);
#endif #endif
T result = JsonUtility.FromJson<T>(postRequest.downloadHandler.text); T result = JsonUtility.FromJson<T>(postRequest.downloadHandler.text);
postRequest.Dispose(); postRequest.Dispose();
@ -45,7 +45,7 @@ public static class AsyncWebReq
{ {
string reqJson = JsonConvert.SerializeObject(data); string reqJson = JsonConvert.SerializeObject(data);
#if UNITY_EDITOR #if UNITY_EDITOR
Debug.Log($"async req json : {reqJson}"); //Debug.Log($"async req json : {reqJson}");
#endif #endif
var bodyRaw = Encoding.UTF8.GetBytes(reqJson); var bodyRaw = Encoding.UTF8.GetBytes(reqJson);
request.uploadHandler = new UploadHandlerRaw(bodyRaw); request.uploadHandler = new UploadHandlerRaw(bodyRaw);
@ -70,7 +70,7 @@ public static class AsyncWebReq
yield return request.SendWebRequest();//发送请求 yield return request.SendWebRequest();//发送请求
if (request.isNetworkError || request.isHttpError) if (request.isNetworkError || request.isHttpError)
{ {
Debug.Log("cannot get data:" + request.responseCode); //Debug.Log("cannot get data:" + request.responseCode);
action(null); action(null);
} }
else else