Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
ZxAd_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
王雪伟
ZxAd_Unity
Commits
2d774dc4
Commit
2d774dc4
authored
Jul 29, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新AdManager
parent
3e40dba3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
20 deletions
+51
-20
AdManager.cs
Assets/AdSDK/AD/AD_Manager/AdManager.cs
+51
-20
No files found.
Assets/AdSDK/AD/AD_Manager/AdManager.cs
View file @
2d774dc4
...
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using
UnityEngine
;
using
System
;
using
Tencent.GDT
;
using
System.Runtime.InteropServices
;
using
ByteDance.Union
;
using
ZXHC
;
using
LitJson
;
...
...
@@ -58,8 +57,8 @@ public class AdManager
private
bool
IsFirstLoadFSAd
=
false
;
public
void
InitAd
(
Action
<
bool
>
callback
)
{
IsFirstLoadRewardAd
=
true
;
IsFirstLoadFSAd
=
true
;
//
IsFirstLoadRewardAd = true;
//
IsFirstLoadFSAd = true;
//paras.Clear();
//paras.Add("pkg", "com.ym.xynt");
//获取广告配置
...
...
@@ -117,7 +116,7 @@ public class AdManager
return
;
#endif
//穿山甲
if
(
ZXADConfig
.
Instance
.
CSJ_AD_APP_ID
!=
null
&&
ZXADConfig
.
Instance
.
CSJ_AD_APP_ID
!=
""
)
if
(
ZXADConfig
.
Instance
.
CSJ_AD_APP_ID
!=
null
&&
ZXADConfig
.
Instance
.
CSJ_AD_APP_ID
!=
""
)
{
#if UNITY_ANDROID
...
...
@@ -153,7 +152,7 @@ public class AdManager
ZXHCADManager
.
Init
(
ZXADConfig
.
Instance
.
HC_AD_APP_ID
,
Constant
.
Instance
.
IsTestNet
);
#endif
}
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"ZXADConfig.Instance.HC_AD_APP_ID "
+
ZXADConfig
.
Instance
.
HC_AD_APP_ID
);
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"ZXADConfig.Instance.HC_AD_APP_ID "
+
ZXADConfig
.
Instance
.
HC_AD_APP_ID
);
//风行
#if UNITY_ANDROID
AndroidJavaClass
jc3
=
new
AndroidJavaClass
(
"com.ym.admodule.fs.FunShionManager"
);
...
...
@@ -195,17 +194,19 @@ public class AdManager
}),
new
Action
<
string
,
string
>((
code
,
errMsg
)
=>
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"Splash 请求失败"
+
errMsg
);
if
(
defaultSplashJson
!=
null
)
{
List
<
AdEntity
>
AdConfigList
=
JsonMapper
.
ToObject
<
List
<
AdEntity
>>(
defaultSplashJson
);
LoadSplashConfigAd
(
listener
,
AdConfigList
);
}
else
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"Splash 没有默认配置"
);
listener
.
onError
(
"code"
+
code
+
"没有默认配置 errMsg"
+
errMsg
);
listener
.
onLastError
();
}
//if (defaultSplashJson != null)
//{
// List<AdEntity> AdConfigList = JsonMapper.ToObject<List<AdEntity>>(defaultSplashJson);
// LoadSplashConfigAd(listener, AdConfigList);
//}
//else
//{
// Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 没有默认配置");
// listener.onError("code" + code + "没有默认配置 errMsg" + errMsg);
// listener.onLastError();
//}
listener
.
onError
(
code
+
"errormsg"
+
errMsg
);
listener
.
onLastError
();
}));
}
...
...
@@ -245,6 +246,14 @@ public class AdManager
listener
.
onLastError
();
return
;
}
//adList.Reverse();
//// 首次启动时倒序加载
//if (PlayerPrefs.GetInt("isFirstLoadSplashAd") != 1)
//{
// adList.Reverse();
// PlayerPrefs.SetInt("isFirstLoadSplashAd", 1);
//}
List
<
AdEntity
>
totalEntityList
=
adList
;
AdEntity
entity
=
totalEntityList
[
0
];
...
...
@@ -296,7 +305,7 @@ public class AdManager
CSJSplshADUtils
.
Instance
.
LoadSplshAd
(
entity
,
GetActivity
(),
GetSplashAdManager
(),
listener
,
callback
);
#elif UNITY_IOS
//加载穿山甲开屏广告
CSJSplshADUtils
.
Instance
.
LoadSplshAd
(
entity
,
null
,
null
,
listener
,
callback
);
CSJSplshADUtils
.
Instance
.
LoadSplshAd
(
entity
,
null
,
null
,
listener
,
callback
);
#endif
break
;
...
...
@@ -584,7 +593,7 @@ public class AdManager
if
(
bl
)
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"大图缓存成功 "
+
entity
.
adPlatform
+
" CodeID "
+
entity
.
codeId
);
//保存
插屏
缓存数据
//保存
大图
缓存数据
ZXADConfig
.
Instance
.
SetAdCache
(
sloatName
,
entity
,
""
);
}
else
...
...
@@ -655,7 +664,9 @@ public class AdManager
}
else
{
#if UNITY_ANDROID
LoadCacheFeedAd
(
slotName
);
#endif
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"展示大图失败 缓存的信息为null"
);
}
}
...
...
@@ -838,7 +849,7 @@ public class AdManager
{
entity
.
actionName
=
actionName
;
ZXADConfig
.
Instance
.
RemoveAdCache
(
slotName
,
""
);
mPlayCacheInterstitialAdPlatform
(
entity
,
listener
,
new
Action
<
bool
>((
bl
)
=>
mPlayCacheInterstitialAdPlatform
(
entity
,
listener
,
new
Action
<
bool
>((
bl
)
=>
{
if
(
bl
)
{
...
...
@@ -873,7 +884,7 @@ public class AdManager
#if UNITY_ANDROID
case
ZXADConfig
.
PLANTFORM_AD_KUS
:
//快手插屏广告加载
KsInterstitialAdUtils
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
,
listener
);
KsInterstitialAdUtils
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
,
listener
);
break
;
#endif
default
:
...
...
@@ -1277,6 +1288,15 @@ public class AdManager
if
(
adList
==
null
||
adList
.
Count
==
0
)
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"激励视频A组没有数据"
);
ADLoading
.
Instance
().
loadFailCount
++;
if
(
ADLoading
.
Instance
().
loadFailCount
==
2
)
{
ADLoading
.
Instance
().
HideADLoading
();
ADLoading
.
Instance
().
loadFailCount
=
0
;
}
return
;
}
if
(
IsFirstLoadRewardAd
)
...
...
@@ -1321,6 +1341,7 @@ public class AdManager
if
(
ADLoading
.
Instance
().
loadFailCount
==
2
)
{
ADLoading
.
Instance
().
HideADLoading
();
ADLoading
.
Instance
().
loadFailCount
=
0
;
}
}
...
...
@@ -1341,6 +1362,15 @@ public class AdManager
if
(
adList
==
null
||
adList
.
Count
==
0
)
{
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"激励视频B组没有数据"
);
ADLoading
.
Instance
().
loadFailCount
++;
if
(
ADLoading
.
Instance
().
loadFailCount
==
2
)
{
ADLoading
.
Instance
().
HideADLoading
();
ADLoading
.
Instance
().
loadFailCount
=
0
;
}
return
;
}
List
<
AdEntity
>
totalEntityList
=
adList
;
...
...
@@ -1378,6 +1408,7 @@ public class AdManager
if
(
ADLoading
.
Instance
().
loadFailCount
==
2
)
{
ADLoading
.
Instance
().
HideADLoading
();
ADLoading
.
Instance
().
loadFailCount
=
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