单点登录不在进程内运行问题;gps取定位服务的;点击图标显示毫秒
This commit is contained in:
1 parent
42e23e2f84
commit
5ba176725f
19 files changed
+1738
-1392
No files matched your search
@@ -453,8 +453,11 @@ namespace Assets.Scripts
|
||||
{
|
||||
// convert it to byte array
|
||||
byte[] texByte = System.Convert.FromBase64String(base64Tex);
|
||||
Texture2D tex = new Texture2D(2, 2);
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
Texture2D tex = new Texture2D(4, 4, TextureFormat.ASTC_RGB_4x4,false);
|
||||
#else
|
||||
Texture2D tex = new Texture2D(4, 4, TextureFormat.DXT5,false);
|
||||
#endif
|
||||
//load texture from byte array
|
||||
if (tex.LoadImage(texByte))
|
||||
{
|
||||
@@ -648,5 +651,48 @@ namespace Assets.Scripts
|
||||
#endif
|
||||
}
|
||||
}
|
||||
public static IEnumerator StartLocation(Action<LocationInfo> action = null)
|
||||
{
|
||||
// Check if the user has location service enabled.
|
||||
if (!Input.location.isEnabledByUser)
|
||||
yield break;
|
||||
|
||||
// Starts the location service.
|
||||
Input.location.Start();
|
||||
|
||||
// Waits until the location service initializes
|
||||
int maxWait = 20;
|
||||
while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(1);
|
||||
maxWait--;
|
||||
}
|
||||
|
||||
// If the service didn't initialize in 20 seconds this cancels location service use.
|
||||
if (maxWait < 1)
|
||||
{
|
||||
Debug.Log("Timed out");
|
||||
yield break;
|
||||
}
|
||||
|
||||
// If the connection failed this cancels location service use.
|
||||
if (Input.location.status == LocationServiceStatus.Failed)
|
||||
{
|
||||
Debug.Log("Unable to determine device location");
|
||||
yield break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the connection succeeded, this retrieves the device's current location and displays it in the Console window.
|
||||
Debug.Log("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
|
||||
if (action != null)
|
||||
{
|
||||
action.Invoke(Input.location.lastData);
|
||||
}
|
||||
}
|
||||
|
||||
// Stops the location service if there is no need to query location updates continuously.
|
||||
Input.location.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user