yyl
2026-03-26 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7
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;
    }