C++RAW #include "UnityPrefix.h" #include "Runtime/Math/Vector2.h" #include "Runtime/Scripting/ScriptingUtility.h" using namespace Unity; CSRAW using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Collections; namespace UnityEngine { CONDITIONAL UNITY_IPHONE_API CLASS ADBannerView C++RAW extern void* UnityAD_CreateBanner(int, int); C++RAW extern void UnityAD_DestroyBanner(void*); C++RAW extern void UnityAD_ShowBanner(void*, bool); C++RAW extern void UnityAD_MoveBanner(void*, float, float); C++RAW extern void UnityAD_LayoutBanner(void*, int); C++RAW extern bool UnityAD_BannerTypeAvailable(int); C++RAW extern void UnityAD_BannerPosition(void*, float*, float*); C++RAW extern void UnityAD_BannerSize(void*, float*, float*); C++RAW extern bool UnityAD_BannerAdLoaded(void*); C++RAW extern bool UnityAD_BannerAdVisible(void*); CUSTOM private static IntPtr Native_CreateBanner(int type, int layout) { return UnityAD_CreateBanner(type, layout); } CUSTOM private static void Native_ShowBanner(IntPtr view, bool show) { UnityAD_ShowBanner(view, show); } CUSTOM private static void Native_MoveBanner(IntPtr view, Vector2 pos) { UnityAD_MoveBanner(view, pos.x, pos.y); } CUSTOM private static void Native_LayoutBanner(IntPtr view, int layout) { UnityAD_LayoutBanner(view, layout); } CUSTOM private static bool Native_BannerTypeAvailable(int type) { return UnityAD_BannerTypeAvailable(type); } CUSTOM private static void Native_BannerPosition(IntPtr view, out Vector2 pos){ UnityAD_BannerPosition(view, &pos->x, &pos->y); } CUSTOM private static void Native_BannerSize(IntPtr view, out Vector2 pos) { UnityAD_BannerSize(view, &pos->x, &pos->y); } CUSTOM private static bool Native_BannerAdLoaded(IntPtr view) { return UnityAD_BannerAdLoaded(view); } CUSTOM private static bool Native_BannerAdVisible(IntPtr view) { return UnityAD_BannerAdVisible(view); } THREAD_SAFE CUSTOM private static void Native_DestroyBanner(IntPtr view) { UnityAD_DestroyBanner(view); } END CONDITIONAL UNITY_IPHONE_API CLASS ADInterstitialAd C++RAW extern void* UnityAD_CreateInterstitial(bool); C++RAW extern void UnityAD_DestroyInterstitial(void*); C++RAW extern void UnityAD_ShowInterstitial(void*); C++RAW extern void UnityAD_ReloadInterstitial(void*); C++RAW extern bool UnityAD_InterstitialAvailable(); C++RAW extern bool UnityAD_InterstitialAdLoaded(void*); CUSTOM private static IntPtr Native_CreateInterstitial(bool autoReload) { return UnityAD_CreateInterstitial(autoReload); } CUSTOM private static void Native_ShowInterstitial(IntPtr view) { UnityAD_ShowInterstitial(view); } CUSTOM private static void Native_ReloadInterstitial(IntPtr view) { UnityAD_ReloadInterstitial(view); } CUSTOM private static bool Native_InterstitialAdLoaded(IntPtr view) { return UnityAD_InterstitialAdLoaded(view); } CUSTOM private static bool Native_InterstitialAvailable() { return UnityAD_InterstitialAvailable(); } THREAD_SAFE CUSTOM private static void Native_DestroyInterstitial(IntPtr view) { UnityAD_DestroyInterstitial(view); } END CSRAW } C++RAW #if !UNITY_IPHONE void* UnityAD_CreateBanner(int, int) { return 0; } void UnityAD_DestroyBanner(void*) {} void UnityAD_ShowBanner(void*, bool) {} void UnityAD_MoveBanner(void*, float, float) {} void UnityAD_LayoutBanner(void*, int) {} bool UnityAD_BannerTypeAvailable(int) { return false; } void UnityAD_BannerPosition(void*, float*, float*) {} void UnityAD_BannerSize(void*, float*, float*) {} bool UnityAD_BannerAdLoaded(void*) { return false; } bool UnityAD_BannerAdVisible(void*) { return false; } void* UnityAD_CreateInterstitial(bool) { return 0; } void UnityAD_DestroyInterstitial(void*) {} void UnityAD_ShowInterstitial(void*) {} void UnityAD_ReloadInterstitial(void*) {} bool UnityAD_InterstitialAvailable() { return false; } bool UnityAD_InterstitialAdLoaded(void*) { return false; } #endif