Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
W
wdlc_mjb_unity
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
wdlc_mjb_unity
Commits
d11d3714
Commit
d11d3714
authored
Jun 25, 2021
by
zhangzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改广告
parent
76c3a59c
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
7 deletions
+78
-7
AdManager.cs
Assets/Base/AdSDK/AD/AD_Manager/AdManager.cs
+2
-0
CSJSplshADUtils.cs
Assets/Base/AdSDK/AD/CSJ/CSJSplshADUtils.cs
+3
-1
Example.cs
Assets/Base/AdSDK/AD/CSJ/Example/Example.cs
+9
-0
AdNative.cs
...K/AD/CSJ/PangleAdapterScripts/Scripts/Android/AdNative.cs
+6
-0
ISplashAdListener.cs
.../AD/CSJ/PangleAdapterScripts/Scripts/ISplashAdListener.cs
+2
-0
GDTFeedAdUtil.cs
Assets/Base/AdSDK/AD/GDT/GDTFeedAdUtil.cs
+23
-5
GDTAdViewManager.mm
...se/AdSDK/AD/GDT/UnionDemo/Scripts/iOS/GDTAdViewManager.mm
+32
-0
GDTAdViewManager.mm.meta
...SDK/AD/GDT/UnionDemo/Scripts/iOS/GDTAdViewManager.mm.meta
+1
-0
GraphicsSettings.asset
ProjectSettings/GraphicsSettings.asset
+0
-1
No files found.
Assets/Base/AdSDK/AD/AD_Manager/AdManager.cs
View file @
d11d3714
...
@@ -665,7 +665,9 @@ public class AdManager
...
@@ -665,7 +665,9 @@ public class AdManager
}
}
else
else
{
{
#if UNITY_ANDROID
LoadCacheFeedAd
(
slotName
);
LoadCacheFeedAd
(
slotName
);
#endif
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"展示大图失败 缓存的信息为null"
);
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"展示大图失败 缓存的信息为null"
);
}
}
}
}
...
...
Assets/Base/AdSDK/AD/CSJ/CSJSplshADUtils.cs
View file @
d11d3714
...
@@ -133,7 +133,9 @@ public class CSJSplshADUtils
...
@@ -133,7 +133,9 @@ public class CSJSplshADUtils
}
}
public
void
onTimeout
()
public
void
onTimeout
()
{
{
listener
.
onError
(
"CSJ SplshAd timeout"
);
EventUtils
.
onEventPullFail
(
entity
,
"-1"
,
"网络超时"
);
listener
.
onError
(
"CSJ SplshAd code -1 message 网络超时"
);
Debug
.
Log
(
"splash load Onerror: -1 : 网络超时"
);
callback
(
false
);
callback
(
false
);
}
}
...
...
Assets/Base/AdSDK/AD/CSJ/Example/Example.cs
View file @
d11d3714
...
@@ -1699,6 +1699,10 @@ public sealed class Example : MonoBehaviour
...
@@ -1699,6 +1699,10 @@ public sealed class Example : MonoBehaviour
#endif
#endif
}
}
public
void
onTimeout
()
{
throw
new
System
.
NotImplementedException
();
}
private
sealed
class
SplashAdInteractionListener
:
ISplashAdInteractionListener
private
sealed
class
SplashAdInteractionListener
:
ISplashAdInteractionListener
{
{
...
@@ -1809,6 +1813,11 @@ public sealed class Example : MonoBehaviour
...
@@ -1809,6 +1813,11 @@ public sealed class Example : MonoBehaviour
}
}
#endif
#endif
}
}
public
void
onTimeout
()
{
throw
new
System
.
NotImplementedException
();
}
}
}
private
sealed
class
ExpressSplashAdInteractionListener
:
ISplashAdInteractionListener
private
sealed
class
ExpressSplashAdInteractionListener
:
ISplashAdInteractionListener
...
...
Assets/Base/AdSDK/AD/CSJ/PangleAdapterScripts/Scripts/Android/AdNative.cs
View file @
d11d3714
...
@@ -331,6 +331,12 @@ namespace ByteDance.Union
...
@@ -331,6 +331,12 @@ namespace ByteDance.Union
()
=>
this
.
listener
.
OnError
(
code
,
message
));
()
=>
this
.
listener
.
OnError
(
code
,
message
));
}
}
public
void
onTimeout
()
{
UnityDispatcher
.
PostTask
(
()
=>
this
.
listener
.
onTimeout
());
}
public
void
onSplashAdLoad
(
AndroidJavaObject
handle
)
public
void
onSplashAdLoad
(
AndroidJavaObject
handle
)
{
{
var
ad
=
new
BUSplashAd
(
handle
);
var
ad
=
new
BUSplashAd
(
handle
);
...
...
Assets/Base/AdSDK/AD/CSJ/PangleAdapterScripts/Scripts/ISplashAdListener.cs
View file @
d11d3714
...
@@ -17,6 +17,8 @@ namespace ByteDance.Union
...
@@ -17,6 +17,8 @@ namespace ByteDance.Union
/// </summary>
/// </summary>
void
OnError
(
int
code
,
string
message
);
void
OnError
(
int
code
,
string
message
);
void
onTimeout
();
/// <summary>
/// <summary>
/// Invoke when the Ad load success.
/// Invoke when the Ad load success.
/// </summary>
/// </summary>
...
...
Assets/Base/AdSDK/AD/GDT/GDTFeedAdUtil.cs
View file @
d11d3714
...
@@ -20,13 +20,14 @@ public class GDTFeedAdUtil
...
@@ -20,13 +20,14 @@ public class GDTFeedAdUtil
}
}
//FeedAd
//FeedAd
private
NativeExpressAdView
feedAd
;
private
static
NativeExpressAdView
feedAd
;
/// <summary>
/// <summary>
/// 大图广告缓存队列
/// 大图广告缓存队列
/// </summary>
/// </summary>
private
static
Queue
<
NativeExpressAdView
>
feedAdCacheList
=
new
Queue
<
NativeExpressAdView
>();
private
static
Queue
<
NativeExpressAdView
>
feedAdCacheList
=
new
Queue
<
NativeExpressAdView
>();
public
NativeExpressAd
nativeExpressAd
;
/// <summary>
/// <summary>
...
@@ -40,6 +41,7 @@ public class GDTFeedAdUtil
...
@@ -40,6 +41,7 @@ public class GDTFeedAdUtil
//string PosId = Constants.nativeExpressVideoPosId;//带视频的大图广告
//string PosId = Constants.nativeExpressVideoPosId;//带视频的大图广告
NativeExpressAd
ad
=
new
NativeExpressAd
(
entity
.
codeId
,
GetAdSize
());
NativeExpressAd
ad
=
new
NativeExpressAd
(
entity
.
codeId
,
GetAdSize
());
nativeExpressAd
=
ad
;
ad
.
SetListener
(
new
FeedAdListener
(
entity
,
callback
));
ad
.
SetListener
(
new
FeedAdListener
(
entity
,
callback
));
ad
.
LoadAd
(
1
);
ad
.
LoadAd
(
1
);
}
}
...
@@ -62,16 +64,21 @@ public class GDTFeedAdUtil
...
@@ -62,16 +64,21 @@ public class GDTFeedAdUtil
/// <param name="entity"></param>
/// <param name="entity"></param>
public
void
ShowCacheFeedAd
(
AdEntity
entity
,
Action
<
bool
>
callback
)
public
void
ShowCacheFeedAd
(
AdEntity
entity
,
Action
<
bool
>
callback
)
{
{
CloseFeedAd
();
//CloseFeedAd();
if
(
feedAdCacheList
.
Count
>
0
)
#if UNITY_IOS
if
(
feedAd
!=
null
)
#else
if
(
feedAdCacheList
.
Count
>
0
)
#endif
{
{
feedAd
=
feedAdCacheList
.
Dequeue
();
#if UNITY_IOS
#if UNITY_IOS
// iOS 广告加载完毕即可展示
// iOS 广告加载完毕即可展示
feedAd
.
Render
();
feedAd
.
Render
();
IOSDemoUtils
.
ShowView
(
feedAd
.
GetIOSNativeView
());
IOSDemoUtils
.
ShowView
(
feedAd
.
GetIOSNativeView
());
#else
#else
// Android 可直接展示,代码如下
// Android 可直接展示,代码如下
feedAd
=
feedAdCacheList
.
Dequeue
();
feedAd
.
Render
();
feedAd
.
Render
();
AndroidDemoUtils
.
ShowView
(
feedAd
.
GetAndroidNativeView
(),
true
);
AndroidDemoUtils
.
ShowView
(
feedAd
.
GetAndroidNativeView
(),
true
);
callback
(
true
);
callback
(
true
);
...
@@ -101,7 +108,14 @@ public class GDTFeedAdUtil
...
@@ -101,7 +108,14 @@ public class GDTFeedAdUtil
{
{
#if UNITY_IOS
#if UNITY_IOS
// iOS 暂不支持自适应宽高
// iOS 暂不支持自适应宽高
return
new
AdSize
(
350
,
200
);
if
(
Screen
.
width
>
1000
)
{
return
new
AdSize
(
Screen
.
width
/
3
,
(
Screen
.
width
/
3
)
*
9
/
16
);
}
else
{
return
new
AdSize
(
Screen
.
width
/
2
,
(
Screen
.
width
/
2
)
*
9
/
16
);
}
#else
#else
return
new
AdSize
(
AdSize
.
FULL_WIDTH
,
AdSize
.
AUTO_HEIGHT
);
return
new
AdSize
(
AdSize
.
FULL_WIDTH
,
AdSize
.
AUTO_HEIGHT
);
#endif
#endif
...
@@ -140,7 +154,11 @@ public class GDTFeedAdUtil
...
@@ -140,7 +154,11 @@ public class GDTFeedAdUtil
view
.
PreloadVideo
();
view
.
PreloadVideo
();
}
}
#endif
#endif
#if UNITY_IOS
feedAd
=
view
;
#else
feedAdCacheList
.
Enqueue
(
view
);
feedAdCacheList
.
Enqueue
(
view
);
#endif
callback
(
true
);
callback
(
true
);
string
msg1
=
"OnAdLoaded"
;
string
msg1
=
"OnAdLoaded"
;
Debug
.
unityLogger
.
Log
(
Constants
.
tagForLog
,
msg1
);
Debug
.
unityLogger
.
Log
(
Constants
.
tagForLog
,
msg1
);
...
...
Assets/Base/AdSDK/AD/GDT/UnionDemo/Scripts/iOS/GDTAdViewManager.mm
View file @
d11d3714
...
@@ -14,7 +14,39 @@ extern "C" {
...
@@ -14,7 +14,39 @@ extern "C" {
#endif
#endif
void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) {
void GDT_UnionPlatform_Ad_ShowAdView(UIView *adView) {
[GetAppController().rootViewController.view addSubview:adView];
[GetAppController().rootViewController.view addSubview:adView];
static dispatch_source_t _timer;
if (_timer)
{
dispatch_source_cancel(_timer);
_timer = nil;
}
//设置时间间隔
NSTimeInterval period = 0.05f;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), period * NSEC_PER_SEC, 0);
// 事件回调
dispatch_source_set_event_handler(_timer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
CGFloat width = adView.frame.size.width;
CGFloat height = adView.frame.size.height;
CGFloat x = (GetAppController().rootViewController.view.frame.size.width - width) / 2.0f;
CGFloat y = GetAppController().rootViewController.view.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);
}
});
});
// 开启定时器
dispatch_resume(_timer);
}
}
#if defined (__cplusplus)
#if defined (__cplusplus)
...
...
Assets/Base/AdSDK/AD/GDT/UnionDemo/Scripts/iOS/GDTAdViewManager.mm.meta
View file @
d11d3714
...
@@ -9,6 +9,7 @@ PluginImporter:
...
@@ -9,6 +9,7 @@ PluginImporter:
isPreloaded: 0
isPreloaded: 0
isOverridable: 0
isOverridable: 0
isExplicitlyReferenced: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
platformData:
- first:
- first:
Any:
Any:
...
...
ProjectSettings/GraphicsSettings.asset
View file @
d11d3714
...
@@ -34,7 +34,6 @@ GraphicsSettings:
...
@@ -34,7 +34,6 @@ GraphicsSettings:
-
{
fileID
:
16000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
16000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
16001
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
16001
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
17000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
17000
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
16003
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_PreloadedShaders
:
[]
m_PreloadedShaders
:
[]
m_SpritesDefaultMaterial
:
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
m_SpritesDefaultMaterial
:
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
type
:
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment