兼容android

This commit is contained in:
yangjing 2022-06-09 18:28:58 +08:00
parent 1bac3ee23c
commit 148ac4f0dc
3 changed files with 12 additions and 2 deletions

View File

@ -201,11 +201,16 @@ public class TKGUtils
public static bool IsNativeReady()
{
#if UNITY_IOS
return ToukaAdManager.Instance.IsReadyNative;
#else
return false;
#endif
}
public static void ShowNative(Vector3 pTL, Vector3 pBR, string pAdPos, Camera pCam = null)
{
#if UNITY_IOS
Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, pTL);
Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, pBR);
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);
}
#endif
}
public static void RemoveNative()
{
#if UNITY_IOS
ToukaAdManager.Instance.HideNative(false);
#endif
}
#endregion
#endregion
}

View File

@ -131,6 +131,7 @@ namespace Touka
/// <param name="_canShowBanner"></param>
public void ShowOrHideBanner(bool _canShowBanner)
{
#if UNITY_IOS
if (_canShowBanner)
{
Debug.Log("这个场景要显示banner");
@ -143,6 +144,7 @@ namespace Touka
ToukaAdManager.isCurrCanShowBanner = false;
ToukaAdManager.Instance.HideBanner(true);
}
#endif
}

View File

@ -192,7 +192,7 @@ PlayerSettings:
buildNumber:
Standalone: 1
iPhone: 1
AndroidBundleVersionCode: 2
AndroidBundleVersionCode: 3
AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 30
AndroidPreferredInstallLocation: 1