Exemplo n.º 1
0
        internal static string GetLocalIPAddressString()
        {
            if (ipAdress == null)
            {
                wwwIPCall             = new DelayedCall();
                wwwIPCall.wwwCallback = delegate(WWW obj)
                {
                    if (!string.IsNullOrEmpty(obj.text))
                    {
                        EditorPrefs.SetString(LAST_IP_ADDRESS_KEY, ipAdress);
                        ipAdress = obj.text;
                    }
                };
                EditorCoroutine.StartCoroutine(wwwIPCall.WWW("https://api.ipify.org"), wwwIPCall);

                if (EditorPrefs.HasKey(LAST_IP_ADDRESS_KEY))
                {
                    return(EditorPrefs.GetString(LAST_IP_ADDRESS_KEY));
                }
            }

            return(ipAdress);
        }
 static void CreateInstanceIfNeeded()
 {
     if (instance == null)
     {
         instance = new EditorCoroutine();
         instance.Initialize();
     }
 }