From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1
---
Main/System/Login/ServerListParser.cs | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/Main/System/Login/ServerListParser.cs b/Main/System/Login/ServerListParser.cs
index bbfd2e0..e1daf9e 100644
--- a/Main/System/Login/ServerListParser.cs
+++ b/Main/System/Login/ServerListParser.cs
@@ -1,7 +1,7 @@
锘縰sing System.Collections;
using System.Collections.Generic;
+using Cysharp.Threading.Tasks;
using UnityEngine;
-using System.Threading;
using LitJson;
public class ServerListParser : SingletonMonobehaviour<ServerListParser>
@@ -15,11 +15,14 @@
public void PushCommonServerListRawData(string content)
{
hasCommonResult = false;
- ThreadPool.QueueUserWorkItem((object aaa) =>
- {
- serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(content);
- hasCommonResult = true;
- });
+ ParseCommonServerListAsync(content).Forget();
+ }
+
+ private async UniTaskVoid ParseCommonServerListAsync(string content)
+ {
+ await UniTask.Yield();
+ serverInfoCommon = JsonMapper.ToObject<ServerInfoCommon>(content);
+ hasCommonResult = true;
}
public void PushPlayerServerListRawData(string content)
@@ -32,12 +35,15 @@
if (RankArr["player"]["group_list"].Count == 0)
return;
- ThreadPool.QueueUserWorkItem((object aaa) =>
- {
- serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(content);
- hasPlayerResult = true;
- SetIsInWhiteList();
- });
+ ParsePlayerServerListAsync(content).Forget();
+ }
+
+ private async UniTaskVoid ParsePlayerServerListAsync(string content)
+ {
+ await UniTask.Yield();
+ serverInfoPlayer = JsonMapper.ToObject<ServerInfoPlayer>(content);
+ hasPlayerResult = true;
+ SetIsInWhiteList();
}
public void ReportCommonResult()
--
Gitblit v1.8.0