ios and bug fix
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Coolape;
|
||||
using UnityEngine.Android;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// My location.通过百度定位取得定位信息
|
||||
@@ -43,16 +44,16 @@ public class MyLocation : MonoBehaviour
|
||||
return GCJ0Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !UNITY_EDITOR && UNITY_IOS
|
||||
[System.Runtime.InteropServices.DllImport("__Internal")]
|
||||
private static extern void _init(string ak, string goName, int coorType);
|
||||
[System.Runtime.InteropServices.DllImport("__Internal")]
|
||||
private static extern void _getMyLocation();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if UNITY_ANDROID
|
||||
static AndroidJavaClass _androidJavaClass;
|
||||
public static AndroidJavaClass androidJavaClass
|
||||
@@ -66,14 +67,18 @@ public class MyLocation : MonoBehaviour
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _init(string ak4Ios, string goName, int coorType);
|
||||
#endif
|
||||
public void init(int coorType)
|
||||
{
|
||||
this.coorType = coorType;
|
||||
this.coorType = coorType;
|
||||
#if UNITY_ANDROID
|
||||
androidJavaClass.CallStatic("init", gameObject.name, CoorType.getCoorTypeName(coorType));
|
||||
#elif UNITY_IOS
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
_init(ak4Ios, gameObject.name, coorType);
|
||||
#endif
|
||||
}
|
||||
@@ -108,15 +113,19 @@ public class MyLocation : MonoBehaviour
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
private static extern void _getMyLocation();
|
||||
#endif
|
||||
public void getMyLocation(object callback)
|
||||
{
|
||||
checkUserPermission();
|
||||
this.callback = callback;
|
||||
#if UNITY_ANDROID
|
||||
androidJavaClass.CallStatic("getMyLocation", CoorType.getCoorTypeName(coorType));
|
||||
#elif UNITY_IOS
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
_getMyLocation();
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user