Commit 3e0233d7 authored by zhangzhe's avatar zhangzhe

广告修改

parent f5b25075
...@@ -6,9 +6,48 @@ ...@@ -6,9 +6,48 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "GDTUnifiedBannerView.h"
#import "UnityAppController.h" #import "UnityAppController.h"
// MARK: - 判断机型
//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
//判断iPhoneX
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr/iPhone11
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs/iPhone11 Pro
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max/iPhone11 Pro Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone12 mini
#define IS_IPHONE_1080_2340 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1080, 2340), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone12/12 Pro
#define IS_IPHONE_1170_2532 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1170, 2532), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhone12 Pro Max
#define IS_IPHONE_1284_2778 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1284, 2778), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPad Pro3rd
#define IS_IPAD_PRO_3RD ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(2048, 2732), [[UIScreen mainScreen] currentMode].size) && isPad : NO)
// 没有Home键的机型
#define NO_HOME_IPHONE (IS_IPHONE_X==YES || IS_IPHONE_Xr ==YES || IS_IPHONE_Xs== YES || IS_IPHONE_Xs_Max== YES || IS_IPHONE_1080_2340== YES || IS_IPHONE_1170_2532== YES || IS_IPHONE_1284_2778== YES || IS_IPAD_PRO_3RD)
// MARK: - 适配
// 屏幕宽
#define kscreenWidth [UIScreen mainScreen].bounds.size.width
// 屏幕高(无刘海的机型在打电话等情况下状态栏会变高, 这里处理了这种情况)
#define kscreenheight (NO_HOME_IPHONE ? [UIScreen mainScreen].bounds.size.height : ([UIScreen mainScreen].bounds.size.height - ([[UIApplication sharedApplication] statusBarFrame].size.height == 40 ? 20 : 0)))
// 有navigationBar没有tabbar的页面的高度
#define kscreenheightNoNANoTab kscreenheight - SafeAreaTopHeight
#define ScreenWidth [UIScreen mainScreen].bounds.size.width
#define ScreenHeight [UIScreen mainScreen].bounds.size.height
// 安全距离
#define SafeAreaTopHeight (NO_HOME_IPHONE ? (IS_IPAD_PRO_3RD ? 74 : 88) : 64) //iPhone X上NavigationBar高度不一样
#define SafeAreaBottomHeight (NO_HOME_IPHONE ? (IS_IPAD_PRO_3RD ? 20 : 34) : 0) //iPhone X上底部有一段距离
#if defined (__cplusplus) #if defined (__cplusplus)
extern "C" { extern "C" {
#endif #endif
...@@ -21,6 +60,7 @@ void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) { ...@@ -21,6 +60,7 @@ void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) {
if (_timer) if (_timer)
{ {
NSLog(@"大图走没走这里");
dispatch_source_cancel(_timer); dispatch_source_cancel(_timer);
_timer = nil; _timer = nil;
} }
...@@ -36,11 +76,12 @@ void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) { ...@@ -36,11 +76,12 @@ void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) {
CGFloat width = adView.frame.size.width; CGFloat width = adView.frame.size.width;
CGFloat height = adView.frame.size.height; CGFloat height = adView.frame.size.height;
CGFloat x = (GetAppController().rootViewController.view.frame.size.width - width) / 2.0f; CGFloat x = (GetAppController().rootViewController.view.frame.size.width - width) / 2.0f;
CGFloat y = GetAppController().rootViewController.view.frame.size.height - height; CGFloat y = GetAppController().rootViewController.view.frame.size.height - height - SafeAreaBottomHeight;
if (adView.frame.origin.x != x || adView.frame.origin.y != y || adView.frame.size.width != width || adView.frame.size.height != height) if (adView.frame.origin.x != x || adView.frame.origin.y != y || adView.frame.size.width != width || adView.frame.size.height != height)
{ {
adView.frame = CGRectMake(x, y, width, height); adView.frame = CGRectMake(x, y, width, height);
NSLog(@"大图改变frame");
} }
}); });
}); });
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.analytics": { "com.unity.analytics": {
"version": "3.3.5", "version": "3.3.5",
...@@ -28,21 +28,21 @@ ...@@ -28,21 +28,21 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.collab-proxy": { "com.unity.collab-proxy": {
"version": "1.2.16", "version": "1.2.16",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.6", "version": "1.0.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.rider": { "com.unity.ide.rider": {
"version": "1.1.4", "version": "1.1.4",
...@@ -51,14 +51,14 @@ ...@@ -51,14 +51,14 @@
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.1" "com.unity.test-framework": "1.1.1"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.vscode": { "com.unity.ide.vscode": {
"version": "1.2.3", "version": "1.2.3",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.multiplayer-hlapi": { "com.unity.multiplayer-hlapi": {
"version": "1.0.8", "version": "1.0.8",
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
"dependencies": { "dependencies": {
"nuget.mono-cecil": "0.1.6-preview" "nuget.mono-cecil": "0.1.6-preview"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.purchasing": { "com.unity.purchasing": {
"version": "2.2.1", "version": "2.2.1",
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.20", "version": "1.1.20",
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.textmeshpro": { "com.unity.textmeshpro": {
"version": "2.1.1", "version": "2.1.1",
...@@ -96,14 +96,14 @@ ...@@ -96,14 +96,14 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.2.17", "version": "1.2.17",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
...@@ -122,14 +122,14 @@ ...@@ -122,14 +122,14 @@
"com.unity.modules.vr": "1.0.0", "com.unity.modules.vr": "1.0.0",
"com.unity.modules.xr": "1.0.0" "com.unity.modules.xr": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"nuget.mono-cecil": { "nuget.mono-cecil": {
"version": "0.1.6-preview", "version": "0.1.6-preview",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment