ios and bug fix

This commit is contained in:
2020-07-10 16:43:24 +08:00
parent 9549990b66
commit 17ce14b01a
331 changed files with 1801 additions and 576 deletions

View File

@@ -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
}