兼容android
This commit is contained in:
parent
1bac3ee23c
commit
148ac4f0dc
|
@ -201,11 +201,16 @@ public class TKGUtils
|
||||||
|
|
||||||
public static bool IsNativeReady()
|
public static bool IsNativeReady()
|
||||||
{
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
return ToukaAdManager.Instance.IsReadyNative;
|
return ToukaAdManager.Instance.IsReadyNative;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowNative(Vector3 pTL, Vector3 pBR, string pAdPos, Camera pCam = null)
|
public static void ShowNative(Vector3 pTL, Vector3 pBR, string pAdPos, Camera pCam = null)
|
||||||
{
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, pTL);
|
Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, pTL);
|
||||||
Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, pBR);
|
Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, pBR);
|
||||||
float tWidth = Mathf.Abs(tBottomRight.x - tTopLeft.x);
|
float tWidth = Mathf.Abs(tBottomRight.x - tTopLeft.x);
|
||||||
|
@ -221,11 +226,14 @@ public class TKGUtils
|
||||||
{
|
{
|
||||||
ToukaAdManager.Instance.ShowNative(tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight, pAdPos);
|
ToukaAdManager.Instance.ShowNative(tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight, pAdPos);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RemoveNative()
|
public static void RemoveNative()
|
||||||
{
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
ToukaAdManager.Instance.HideNative(false);
|
ToukaAdManager.Instance.HideNative(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
|
@ -131,6 +131,7 @@ namespace Touka
|
||||||
/// <param name="_canShowBanner"></param>
|
/// <param name="_canShowBanner"></param>
|
||||||
public void ShowOrHideBanner(bool _canShowBanner)
|
public void ShowOrHideBanner(bool _canShowBanner)
|
||||||
{
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
if (_canShowBanner)
|
if (_canShowBanner)
|
||||||
{
|
{
|
||||||
Debug.Log("这个场景要显示banner");
|
Debug.Log("这个场景要显示banner");
|
||||||
|
@ -143,6 +144,7 @@ namespace Touka
|
||||||
ToukaAdManager.isCurrCanShowBanner = false;
|
ToukaAdManager.isCurrCanShowBanner = false;
|
||||||
ToukaAdManager.Instance.HideBanner(true);
|
ToukaAdManager.Instance.HideBanner(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ PlayerSettings:
|
||||||
buildNumber:
|
buildNumber:
|
||||||
Standalone: 1
|
Standalone: 1
|
||||||
iPhone: 1
|
iPhone: 1
|
||||||
AndroidBundleVersionCode: 2
|
AndroidBundleVersionCode: 3
|
||||||
AndroidMinSdkVersion: 21
|
AndroidMinSdkVersion: 21
|
||||||
AndroidTargetSdkVersion: 30
|
AndroidTargetSdkVersion: 30
|
||||||
AndroidPreferredInstallLocation: 1
|
AndroidPreferredInstallLocation: 1
|
||||||
|
|
Loading…
Reference in New Issue