From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1

---
 Main/Utility/DeviceUtility.cs |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Main/Utility/DeviceUtility.cs b/Main/Utility/DeviceUtility.cs
index 3d50384..b44fb1f 100644
--- a/Main/Utility/DeviceUtility.cs
+++ b/Main/Utility/DeviceUtility.cs
@@ -7,6 +7,7 @@
 using System.Net.Sockets;
 using System.IO;
 using System.Text.RegularExpressions;
+using Cysharp.Threading.Tasks;
 
 #if UNITY_IOS
 using UnityEngine.iOS;
@@ -40,7 +41,7 @@
 
     static string ipPattern = "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}";
     static string ip = string.Empty;
-    public static string GetIp()
+    public static async UniTask<string> GetIp()
     {
         try
         {
@@ -50,10 +51,10 @@
                 WebRequest wRequest = WebRequest.Create(url);
                 wRequest.Method = "GET";
                 wRequest.ContentType = "text/html;charset=UTF-8";
-                WebResponse wResponse = wRequest.GetResponse();
+                WebResponse wResponse = await wRequest.GetResponseAsync();
                 Stream stream = wResponse.GetResponseStream();
                 StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
-                string str = reader.ReadToEnd();
+                string str = await reader.ReadToEndAsync();
 
                 reader.Close();
                 wResponse.Close();
@@ -64,12 +65,12 @@
                     ip = match.Value;
                 }
             }
+
         }
         catch (Exception ex)
         {
             Debug.Log(ex);
         }
-
         return ip;
     }
 

--
Gitblit v1.8.0