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
fbe72d25
Commit
fbe72d25
authored
Jun 07, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
插屏广告加入回调
parent
55f8d2d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
471 additions
and
366 deletions
+471
-366
AdManager.cs
Assets/AdSDK/AD/AD_Manager/AdManager.cs
+6
-6
ZXADInterstitialListener.cs
...AdSDK/AD/AD_Manager/Interface/ZXADInterstitialListener.cs
+13
-0
ZXADInterstitialListener.cs.meta
.../AD/AD_Manager/Interface/ZXADInterstitialListener.cs.meta
+11
-0
ZXADConfig.cs
Assets/AdSDK/AD/AD_Manager/ZXADConfig.cs
+2
-2
CSJInterstitialUtil.cs
Assets/AdSDK/AD/CSJ/CSJInterstitialUtil.cs
+14
-8
AdDemo.cs
Assets/AdSDK/AD/Demo/AdDemo.cs
+19
-1
GDTInterstitialAdUtil.cs
Assets/AdSDK/AD/GDT/GDTInterstitialAdUtil.cs
+18
-5
KsDemo.cs
Assets/AdSDK/AD/KS/KsDemo/KsDemo.cs
+2
-2
KsInterstitialAdUtils.cs
Assets/AdSDK/AD/KS/KsInterstitialAdUtils.cs
+8
-4
AndroidManifest.xml
Assets/Plugins/Android/AndroidManifest.xml
+15
-0
CallingNativeMethods.cs
Assets/UnityTool/CallingNativeMethods.cs
+4
-2
UnityPhoneUtils.java
Assets/UnityTool/Plugins/Android/UnityPhoneUtils.java
+15
-4
UnityPhoneUtils.cs
Assets/UnityTool/UnityPhoneUtils.cs
+331
-327
ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+13
-5
No files found.
Assets/AdSDK/AD/AD_Manager/AdManager.cs
View file @
fbe72d25
...
@@ -829,14 +829,14 @@ public class AdManager
...
@@ -829,14 +829,14 @@ public class AdManager
/// <summary>
/// <summary>
/// 播放缓存的插屏广告
/// 播放缓存的插屏广告
/// </summary>
/// </summary>
public
void
PlayCacheInterstitialAd
(
string
slotName
,
string
actionName
)
public
void
PlayCacheInterstitialAd
(
string
slotName
,
string
actionName
,
ZXADInterstitialListener
listener
)
{
{
AdEntity
entity
=
ZXADConfig
.
Instance
.
GetAdCache
(
slotName
,
""
);
AdEntity
entity
=
ZXADConfig
.
Instance
.
GetAdCache
(
slotName
,
""
);
if
(
entity
!=
null
)
if
(
entity
!=
null
)
{
{
entity
.
actionName
=
actionName
;
entity
.
actionName
=
actionName
;
ZXADConfig
.
Instance
.
RemoveAdCache
(
slotName
,
""
);
ZXADConfig
.
Instance
.
RemoveAdCache
(
slotName
,
""
);
mPlayCacheInterstitialAdPlatform
(
entity
,
new
Action
<
bool
>((
bl
)
=>
mPlayCacheInterstitialAdPlatform
(
entity
,
listener
,
new
Action
<
bool
>((
bl
)
=>
{
{
if
(
bl
)
if
(
bl
)
{
{
...
@@ -856,22 +856,22 @@ public class AdManager
...
@@ -856,22 +856,22 @@ public class AdManager
}
}
private
void
mPlayCacheInterstitialAdPlatform
(
AdEntity
entity
,
Action
<
bool
>
callback
)
private
void
mPlayCacheInterstitialAdPlatform
(
AdEntity
entity
,
ZXADInterstitialListener
listener
,
Action
<
bool
>
callback
)
{
{
switch
(
entity
.
adPlatform
)
switch
(
entity
.
adPlatform
)
{
{
case
ZXADConfig
.
PLANTFORM_AD_TT
:
case
ZXADConfig
.
PLANTFORM_AD_TT
:
//穿山甲插屏广告加载
//穿山甲插屏广告加载
CSJInterstitialUtil
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
);
CSJInterstitialUtil
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
,
listener
);
break
;
break
;
case
ZXADConfig
.
PLANTFORM_AD_GDT
:
case
ZXADConfig
.
PLANTFORM_AD_GDT
:
//广点通插屏广告加载
//广点通插屏广告加载
GDTInterstitialAdUtil
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
);
GDTInterstitialAdUtil
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
,
listener
);
break
;
break
;
#if UNITY_ANDROID
#if UNITY_ANDROID
case
ZXADConfig
.
PLANTFORM_AD_KUS
:
case
ZXADConfig
.
PLANTFORM_AD_KUS
:
//快手插屏广告加载
//快手插屏广告加载
KsInterstitialAdUtils
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
);
KsInterstitialAdUtils
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
callback
,
listener
);
break
;
break
;
#endif
#endif
default
:
default
:
...
...
Assets/AdSDK/AD/AD_Manager/Interface/ZXADInterstitialListener.cs
0 → 100644
View file @
fbe72d25
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
interface
ZXADInterstitialListener
{
//展示插屏广告
void
onInterstitialAdShow
();
//插屏广告Error
void
onInterstitialError
(
string
errorMsg
);
//插屏广告关闭
void
onInterstitialClose
();
}
Assets/AdSDK/AD/AD_Manager/Interface/ZXADInterstitialListener.cs.meta
0 → 100644
View file @
fbe72d25
fileFormatVersion: 2
guid: df6493c8cebe4674388300fe68e8d28c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/AdSDK/AD/AD_Manager/ZXADConfig.cs
View file @
fbe72d25
...
@@ -14,8 +14,8 @@ public class ZXADConfig
...
@@ -14,8 +14,8 @@ public class ZXADConfig
}
}
}
}
public
const
int
ZXAD_VC
=
13
6
;
public
const
int
ZXAD_VC
=
13
7
;
public
const
string
ZXAD_VN
=
"1.3.
6
"
;
public
const
string
ZXAD_VN
=
"1.3.
7
"
;
public
const
string
ADManagerTAG
=
"AdManager"
;
public
const
string
ADManagerTAG
=
"AdManager"
;
public
const
string
PLANTFORM_AD_TT
=
"chuanshanjia"
;
//穿山甲
public
const
string
PLANTFORM_AD_TT
=
"chuanshanjia"
;
//穿山甲
...
...
Assets/AdSDK/AD/CSJ/CSJInterstitialUtil.cs
View file @
fbe72d25
...
@@ -66,17 +66,18 @@ public class CSJInterstitialUtil
...
@@ -66,17 +66,18 @@ public class CSJInterstitialUtil
#else
#else
.
SetCodeId
(
entity
.
codeId
)
.
SetCodeId
(
entity
.
codeId
)
.
SetExpressViewAcceptedSize
(
350
,
0
)
.
SetExpressViewAcceptedSize
(
350
,
0
)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
#endif
#endif
.
SetSupportDeepLink
(
true
)
.
SetSupportDeepLink
(
true
)
.
SetAdCount
(
1
)
.
SetAdCount
(
1
)
.
SetImageAcceptedSize
(
1080
,
1920
)
.
SetImageAcceptedSize
(
1080
,
1920
)
.
Build
();
.
Build
();
this
.
AdNative
.
LoadExpressInterstitialAd
(
adSlot
,
new
InterstitialAdListener
(
entity
,
callback
));
this
.
AdNative
.
LoadExpressInterstitialAd
(
adSlot
,
new
InterstitialAdListener
(
entity
,
callback
));
}
}
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
)
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
,
ZXADInterstitialListener
listener
)
{
{
#if UNITY_IOS
#if UNITY_IOS
if
(
interstitialAdCacheListIOS
.
Count
>
0
)
if
(
interstitialAdCacheListIOS
.
Count
>
0
)
{
{
...
@@ -87,7 +88,7 @@ public class CSJInterstitialUtil
...
@@ -87,7 +88,7 @@ public class CSJInterstitialUtil
//{
//{
// y = 100; // 防止Demo里刘海遮挡
// y = 100; // 防止Demo里刘海遮挡
//}
//}
mInterstitialAd
.
SetExpressInteractionListener
(
new
ExpressAdInteractionListener
(
this
,
callback
,
entity
,
1
));
mInterstitialAd
.
SetExpressInteractionListener
(
new
ExpressAdInteractionListener
(
this
,
listener
,
callback
,
entity
,
1
));
mInterstitialAd
.
ShowExpressAd
(
x
,
y
);
mInterstitialAd
.
ShowExpressAd
(
x
,
y
);
}
}
else
else
...
@@ -100,14 +101,14 @@ public class CSJInterstitialUtil
...
@@ -100,14 +101,14 @@ public class CSJInterstitialUtil
if
(
interstitialAdCacheListAndroid
.
Count
>
0
)
if
(
interstitialAdCacheListAndroid
.
Count
>
0
)
{
{
mInterstitialAd
=
interstitialAdCacheListAndroid
.
Dequeue
();
mInterstitialAd
=
interstitialAdCacheListAndroid
.
Dequeue
();
ExpressAdInteractionListener
expressAdInteractionListener
=
new
ExpressAdInteractionListener
(
this
,
callback
,
entity
,
1
);
ExpressAdInteractionListener
expressAdInteractionListener
=
new
ExpressAdInteractionListener
(
this
,
listener
,
callback
,
entity
,
1
);
NativeAdManager
.
Instance
().
ShowExpressInterstitialAd
(
GetActivity
(),
mInterstitialAd
.
handle
,
expressAdInteractionListener
);
NativeAdManager
.
Instance
().
ShowExpressInterstitialAd
(
GetActivity
(),
mInterstitialAd
.
handle
,
expressAdInteractionListener
);
}
}
else
else
{
{
Debug
.
Log
(
"CSJ 插屏广告没有缓存数据了"
);
Debug
.
Log
(
"CSJ 插屏广告没有缓存数据了"
);
callback
(
false
);
callback
(
false
);
}
}
#endif
#endif
}
}
...
@@ -117,7 +118,7 @@ public class CSJInterstitialUtil
...
@@ -117,7 +118,7 @@ public class CSJInterstitialUtil
{
{
private
AdEntity
entity
;
private
AdEntity
entity
;
private
Action
<
bool
>
callback
;
private
Action
<
bool
>
callback
;
public
InterstitialAdListener
(
AdEntity
entity
,
Action
<
bool
>
callback
)
public
InterstitialAdListener
(
AdEntity
entity
,
Action
<
bool
>
callback
)
{
{
this
.
entity
=
entity
;
this
.
entity
=
entity
;
this
.
callback
=
callback
;
this
.
callback
=
callback
;
...
@@ -171,13 +172,15 @@ public class CSJInterstitialUtil
...
@@ -171,13 +172,15 @@ public class CSJInterstitialUtil
{
{
private
CSJInterstitialUtil
example
;
private
CSJInterstitialUtil
example
;
private
Action
<
bool
>
callback
;
private
Action
<
bool
>
callback
;
private
ZXADInterstitialListener
listener
;
private
AdEntity
entity
;
private
AdEntity
entity
;
int
type
;
//0:feed 1:banner 2:interstitial
int
type
;
//0:feed 1:banner 2:interstitial
public
ExpressAdInteractionListener
(
CSJInterstitialUtil
example
,
Action
<
bool
>
callback
,
AdEntity
entity
,
int
type
)
public
ExpressAdInteractionListener
(
CSJInterstitialUtil
example
,
ZXADInterstitialListener
listener
,
Action
<
bool
>
callback
,
AdEntity
entity
,
int
type
)
{
{
this
.
example
=
example
;
this
.
example
=
example
;
this
.
callback
=
callback
;
this
.
callback
=
callback
;
this
.
listener
=
listener
;
this
.
entity
=
entity
;
this
.
entity
=
entity
;
this
.
type
=
type
;
this
.
type
=
type
;
}
}
...
@@ -191,6 +194,7 @@ public class CSJInterstitialUtil
...
@@ -191,6 +194,7 @@ public class CSJInterstitialUtil
{
{
EventUtils
.
onEventShowSuccess
(
entity
);
EventUtils
.
onEventShowSuccess
(
entity
);
Debug
.
Log
(
"express OnAdShow,type:"
+
type
);
Debug
.
Log
(
"express OnAdShow,type:"
+
type
);
listener
.
onInterstitialAdShow
();
}
}
public
void
OnAdViewRenderError
(
ExpressAd
ad
,
int
code
,
string
message
)
public
void
OnAdViewRenderError
(
ExpressAd
ad
,
int
code
,
string
message
)
...
@@ -198,6 +202,7 @@ public class CSJInterstitialUtil
...
@@ -198,6 +202,7 @@ public class CSJInterstitialUtil
EventUtils
.
onEventShowFail
(
entity
);
EventUtils
.
onEventShowFail
(
entity
);
Debug
.
Log
(
"express OnAdViewRenderError,type:"
+
type
);
Debug
.
Log
(
"express OnAdViewRenderError,type:"
+
type
);
callback
(
false
);
callback
(
false
);
listener
.
onInterstitialError
(
"code "
+
code
+
" message "
+
message
);
}
}
public
void
OnAdViewRenderSucc
(
ExpressAd
ad
,
float
width
,
float
height
)
public
void
OnAdViewRenderSucc
(
ExpressAd
ad
,
float
width
,
float
height
)
...
@@ -209,6 +214,7 @@ public class CSJInterstitialUtil
...
@@ -209,6 +214,7 @@ public class CSJInterstitialUtil
{
{
EventUtils
.
onEventAdComplete
(
entity
);
EventUtils
.
onEventAdComplete
(
entity
);
Debug
.
Log
(
"express OnAdClose,type:"
+
type
);
Debug
.
Log
(
"express OnAdClose,type:"
+
type
);
listener
.
onInterstitialClose
();
}
}
public
void
onAdRemoved
(
ExpressAd
ad
)
public
void
onAdRemoved
(
ExpressAd
ad
)
...
...
Assets/AdSDK/AD/Demo/AdDemo.cs
View file @
fbe72d25
...
@@ -197,7 +197,25 @@ public class AdDemo : MonoBehaviour
...
@@ -197,7 +197,25 @@ public class AdDemo : MonoBehaviour
public
void
OnClickPlayInterAd
()
public
void
OnClickPlayInterAd
()
{
{
AdManager
.
Instance
.
PlayCacheInterstitialAd
(
Interstitial
,
"test"
);
AdManager
.
Instance
.
PlayCacheInterstitialAd
(
Interstitial
,
"test"
,
new
InterstitialAdListener
());
}
private
sealed
class
InterstitialAdListener
:
ZXADInterstitialListener
{
public
void
onInterstitialAdShow
()
{
Debug
.
unityLogger
.
Log
(
"onInterstitialAdShow"
);
}
public
void
onInterstitialClose
()
{
Debug
.
unityLogger
.
Log
(
"onInterstitialClose"
);
}
public
void
onInterstitialError
(
string
errorMsg
)
{
Debug
.
unityLogger
.
Log
(
"onInterstitialError"
);
}
}
}
public
void
OnClickLoadFullScreeVideoAd
()
public
void
OnClickLoadFullScreeVideoAd
()
...
...
Assets/AdSDK/AD/GDT/GDTInterstitialAdUtil.cs
View file @
fbe72d25
...
@@ -39,7 +39,7 @@ public class GDTInterstitialAdUtil
...
@@ -39,7 +39,7 @@ public class GDTInterstitialAdUtil
//string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id
//string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id
UnifiedInterstitialAd
ad
=
new
UnifiedInterstitialAd
(
entity
.
codeId
);
UnifiedInterstitialAd
ad
=
new
UnifiedInterstitialAd
(
entity
.
codeId
);
ad
.
SetListener
(
new
UnifiedInterstitialAdListener
(
entity
,
ad
,
callback
));
ad
.
SetListener
(
new
UnifiedInterstitialAdListener
(
entity
,
ad
,
null
,
callback
));
ad
.
LoadAd
();
ad
.
LoadAd
();
}
}
...
@@ -47,12 +47,12 @@ public class GDTInterstitialAdUtil
...
@@ -47,12 +47,12 @@ public class GDTInterstitialAdUtil
/// 播放缓存的插屏广告
/// 播放缓存的插屏广告
/// </summary>
/// </summary>
/// <param name="entity"></param>
/// <param name="entity"></param>
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
)
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
,
ZXADInterstitialListener
listener
)
{
{
if
(
interstitialAdCacheList
.
Count
>
0
)
if
(
interstitialAdCacheList
.
Count
>
0
)
{
{
UnifiedInterstitialAd
interAd
=
interstitialAdCacheList
.
Dequeue
();
UnifiedInterstitialAd
interAd
=
interstitialAdCacheList
.
Dequeue
();
interAd
.
SetListener
(
new
UnifiedInterstitialAdListener
(
entity
,
interAd
,
callback
));
interAd
.
SetListener
(
new
UnifiedInterstitialAdListener
(
entity
,
interAd
,
listener
,
callback
));
interAd
.
Show
();
interAd
.
Show
();
}
}
else
else
...
@@ -71,11 +71,13 @@ public class GDTInterstitialAdUtil
...
@@ -71,11 +71,13 @@ public class GDTInterstitialAdUtil
{
{
private
AdEntity
entity
;
private
AdEntity
entity
;
private
UnifiedInterstitialAd
ad
;
private
UnifiedInterstitialAd
ad
;
private
ZXADInterstitialListener
listener
;
private
Action
<
bool
>
callback
;
private
Action
<
bool
>
callback
;
public
UnifiedInterstitialAdListener
(
AdEntity
entity
,
UnifiedInterstitialAd
ad
,
Action
<
bool
>
callback
)
public
UnifiedInterstitialAdListener
(
AdEntity
entity
,
UnifiedInterstitialAd
ad
,
ZXADInterstitialListener
listener
,
Action
<
bool
>
callback
)
{
{
this
.
entity
=
entity
;
this
.
entity
=
entity
;
this
.
ad
=
ad
;
this
.
ad
=
ad
;
this
.
listener
=
listener
;
this
.
callback
=
callback
;
this
.
callback
=
callback
;
}
}
...
@@ -112,6 +114,10 @@ public class GDTInterstitialAdUtil
...
@@ -112,6 +114,10 @@ public class GDTInterstitialAdUtil
public
void
OnAdExposured
()
public
void
OnAdExposured
()
{
{
callback
(
true
);
callback
(
true
);
if
(
listener
!=
null
)
{
listener
.
onInterstitialAdShow
();
}
}
}
/// <summary>
/// <summary>
...
@@ -135,7 +141,10 @@ public class GDTInterstitialAdUtil
...
@@ -135,7 +141,10 @@ public class GDTInterstitialAdUtil
/// </summary>
/// </summary>
public
void
OnAdClosed
()
public
void
OnAdClosed
()
{
{
if
(
listener
!=
null
)
{
listener
.
onInterstitialClose
();
}
}
}
#if UNITY_ANDROID
#if UNITY_ANDROID
...
@@ -195,6 +204,10 @@ public class GDTInterstitialAdUtil
...
@@ -195,6 +204,10 @@ public class GDTInterstitialAdUtil
public
void
OnVideoError
()
public
void
OnVideoError
()
{
{
EventUtils
.
onEventShowFail
(
entity
);
EventUtils
.
onEventShowFail
(
entity
);
if
(
listener
!=
null
)
{
listener
.
onInterstitialError
(
"GDT 插屏播放时出现错误"
);
}
}
}
/// <summary>
/// <summary>
...
...
Assets/AdSDK/AD/KS/KsDemo/KsDemo.cs
View file @
fbe72d25
...
@@ -208,10 +208,10 @@ public class KsDemo : MonoBehaviour
...
@@ -208,10 +208,10 @@ public class KsDemo : MonoBehaviour
entity
.
codeGroup
=
"A"
;
entity
.
codeGroup
=
"A"
;
entity
.
slotName
=
"Tessss"
;
entity
.
slotName
=
"Tessss"
;
#
if
UNITY_ANDROID
#
if
UNITY_ANDROID
KsInterstitialAdUtils
.
Instance
.
PlayCacheInterstitialAd
(
entity
,
new
Action
<
bool
>((
cb
)
=>
{
//
KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, new Action<bool>((cb) => {
}));
//
}));
#endif
#endif
}
}
}
}
Assets/AdSDK/AD/KS/KsInterstitialAdUtils.cs
View file @
fbe72d25
...
@@ -41,13 +41,13 @@ public class KsInterstitialAdUtils
...
@@ -41,13 +41,13 @@ public class KsInterstitialAdUtils
/// 播放缓存的插屏广告
/// 播放缓存的插屏广告
/// </summary>
/// </summary>
/// <param name="entity"></param>
/// <param name="entity"></param>
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
)
public
void
PlayCacheInterstitialAd
(
AdEntity
entity
,
Action
<
bool
>
callback
,
ZXADInterstitialListener
listener
)
{
{
if
(
interstitialAdCacheList
.
Count
>
0
)
if
(
interstitialAdCacheList
.
Count
>
0
)
{
{
Debug
.
unityLogger
.
Log
(
"KS 插屏广告没有缓存数据了"
+
interstitialAdCacheList
.
Count
);
Debug
.
unityLogger
.
Log
(
"KS 插屏广告没有缓存数据了"
+
interstitialAdCacheList
.
Count
);
KsInterstitialAd
interAd
=
interstitialAdCacheList
.
Dequeue
();
KsInterstitialAd
interAd
=
interstitialAdCacheList
.
Dequeue
();
interAd
.
SetPlayListener
(
new
KsInterstitialPlayAdListener
(
callback
,
entity
));
interAd
.
SetPlayListener
(
new
KsInterstitialPlayAdListener
(
callback
,
listener
,
entity
));
interAd
.
ShowKsIntetstitialAd
();
interAd
.
ShowKsIntetstitialAd
();
}
}
else
else
...
@@ -86,11 +86,13 @@ public class KsInterstitialAdUtils
...
@@ -86,11 +86,13 @@ public class KsInterstitialAdUtils
private
sealed
class
KsInterstitialPlayAdListener
:
IKsUnityInterstitialPlayListener
private
sealed
class
KsInterstitialPlayAdListener
:
IKsUnityInterstitialPlayListener
{
{
private
Action
<
bool
>
callback
;
private
Action
<
bool
>
callback
;
private
ZXADInterstitialListener
listener
;
private
AdEntity
entity
;
private
AdEntity
entity
;
public
KsInterstitialPlayAdListener
(
Action
<
bool
>
callback
,
AdEntity
entity
)
public
KsInterstitialPlayAdListener
(
Action
<
bool
>
callback
,
ZXADInterstitialListener
listener
,
AdEntity
entity
)
{
{
this
.
callback
=
callback
;
this
.
callback
=
callback
;
this
.
listener
=
listener
;
this
.
entity
=
entity
;
this
.
entity
=
entity
;
}
}
public
void
onAdClicked
()
public
void
onAdClicked
()
...
@@ -100,12 +102,13 @@ public class KsInterstitialAdUtils
...
@@ -100,12 +102,13 @@ public class KsInterstitialAdUtils
public
void
onAdClosed
()
public
void
onAdClosed
()
{
{
listener
.
onInterstitialClose
();
}
}
public
void
onAdShow
()
public
void
onAdShow
()
{
{
EventUtils
.
onEventShowSuccess
(
entity
);
EventUtils
.
onEventShowSuccess
(
entity
);
listener
.
onInterstitialAdShow
();
}
}
public
void
onPageDismiss
()
public
void
onPageDismiss
()
...
@@ -127,6 +130,7 @@ public class KsInterstitialAdUtils
...
@@ -127,6 +130,7 @@ public class KsInterstitialAdUtils
{
{
EventUtils
.
onEventShowFail
(
entity
);
EventUtils
.
onEventShowFail
(
entity
);
callback
(
false
);
callback
(
false
);
listener
.
onInterstitialError
(
"code"
+
code
+
"msg"
+
msg
);
}
}
public
void
onVideoPlayStart
()
public
void
onVideoPlayStart
()
...
...
Assets/Plugins/Android/AndroidManifest.xml
View file @
fbe72d25
...
@@ -53,5 +53,20 @@
...
@@ -53,5 +53,20 @@
</intent-filter>
</intent-filter>
</activity>
</activity>
<!-- WebView -->
<!-- WebView -->
<provider
android:name=
"com.bytedance.sdk.openadsdk.TTFileProvider"
android:authorities=
"${applicationId}.TTFileProvider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
</provider>
<provider
android:name=
"com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
android:authorities=
"${applicationId}.TTMultiProvider"
android:exported=
"false"
/>
</application>
</application>
</manifest>
</manifest>
Assets/UnityTool/CallingNativeMethods.cs
View file @
fbe72d25
...
@@ -24,14 +24,16 @@ public class CallingNativeMethods
...
@@ -24,14 +24,16 @@ public class CallingNativeMethods
}
}
return
activity
;
return
activity
;
}
}
#if UNITY_IOS
//判断微信是否安装
//判断微信是否安装
[
DllImport
(
"__Internal"
)]
[
DllImport
(
"__Internal"
)]
private
static
extern
bool
_isWechatInstalled
();
private
static
extern
bool
_isWechatInstalled
();
[
DllImport
(
"__Internal"
)]
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_WechatLogin
(
string
appid
,
string
state
,
string
universalLink
);
private
static
extern
void
_WechatLogin
(
string
appid
,
string
state
,
string
universalLink
);
[
DllImport
(
"__Internal"
)]
[
DllImport
(
"__Internal"
)]
private
static
extern
void
ShowIOSWebView
(
string
urlStr
,
string
titleStr
);
private
static
extern
void
ShowIOSWebView
(
string
urlStr
,
string
titleStr
);
#endif
/// <summary>
/// <summary>
/// 注册初始化微信登录
/// 注册初始化微信登录
...
...
Assets/UnityTool/Plugins/Android/UnityPhoneUtils.java
View file @
fbe72d25
...
@@ -371,19 +371,30 @@ public class UnityPhoneUtils {
...
@@ -371,19 +371,30 @@ public class UnityPhoneUtils {
}
}
public
String
getDeviceId
(
Context
context
)
{
public
String
getDeviceId
(
Context
context
)
{
return
getMd5Value
(
getAndroidID
(
context
)
+
getImei
(
context
));
return
getMd5Value
(
getAndroidID
(
context
)
+
getImei
(
context
));
}
}
public
String
getMd5Value
(
String
sSecret
)
{
public
String
getMd5Value
(
String
sSecret
)
{
try
{
try
{
MessageDigest
bmd5
=
MessageDigest
.
getInstance
(
"MD5"
);
MessageDigest
bmd5
=
MessageDigest
.
getInstance
(
"MD5"
);
bmd5
.
update
(
sSecret
.
getBytes
());
bmd5
.
update
(
sSecret
.
getBytes
());
int
i
=
0
;
StringBuffer
buf
=
new
StringBuffer
();
byte
[]
b
=
bmd5
.
digest
();
for
(
int
j
=
0
;
j
<
b
.
length
;
j
++){
i
=
Integer
.
parseInt
(
b
[
j
]+
""
);
if
(
i
<
0
)
i
+=
256
;
if
(
i
<
16
)
buf
.
append
(
"0"
);
buf
.
append
(
Integer
.
toHexString
(
i
));
}
return
buf
.
toString
();
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
return
""
;
}
}
public
String
getImei
(
Context
context
)
{
public
String
getImei
(
Context
context
)
{
...
...
Assets/UnityTool/UnityPhoneUtils.cs
View file @
fbe72d25
This diff is collapsed.
Click to expand it.
ProjectSettings/ProjectSettings.asset
View file @
fbe72d25
...
@@ -41,6 +41,12 @@ PlayerSettings:
...
@@ -41,6 +41,12 @@ PlayerSettings:
height
:
1
height
:
1
m_SplashScreenLogos
:
[]
m_SplashScreenLogos
:
[]
m_VirtualRealitySplashScreen
:
{
fileID
:
0
}
m_VirtualRealitySplashScreen
:
{
fileID
:
0
}
m_ShowUnitySplashAds
:
0
m_AdsAndroidGameId
:
m_AdsIosGameId
:
m_ShowSplashAdsSlogan
:
0
m_SloganImage
:
{
fileID
:
0
}
m_SloganHeight
:
150
m_HolographicTrackingLossScreen
:
{
fileID
:
0
}
m_HolographicTrackingLossScreen
:
{
fileID
:
0
}
defaultScreenWidth
:
1920
defaultScreenWidth
:
1920
defaultScreenHeight
:
1080
defaultScreenHeight
:
1080
...
@@ -118,13 +124,14 @@ PlayerSettings:
...
@@ -118,13 +124,14 @@ PlayerSettings:
vulkanNumSwapchainBuffers
:
3
vulkanNumSwapchainBuffers
:
3
vulkanEnableSetSRGBWrite
:
0
vulkanEnableSetSRGBWrite
:
0
vulkanEnableLateAcquireNextImage
:
0
vulkanEnableLateAcquireNextImage
:
0
useSecurityBuild
:
0
m_SupportedAspectRatios
:
m_SupportedAspectRatios
:
4:3
:
1
4:3
:
1
5:4
:
1
5:4
:
1
16:10
:
1
16:10
:
1
16:9
:
1
16:9
:
1
Others
:
1
Others
:
1
bundleVersion
:
1.0.
7
bundleVersion
:
1.0.
0
preloadedAssets
:
[]
preloadedAssets
:
[]
metroInputSource
:
0
metroInputSource
:
0
wsaTransparentSwapchain
:
0
wsaTransparentSwapchain
:
0
...
@@ -168,7 +175,7 @@ PlayerSettings:
...
@@ -168,7 +175,7 @@ PlayerSettings:
androidSupportedAspectRatio
:
1
androidSupportedAspectRatio
:
1
androidMaxAspectRatio
:
2.1
androidMaxAspectRatio
:
2.1
applicationIdentifier
:
applicationIdentifier
:
Android
:
com.ym.
wdlc
Android
:
com.ym.
chxxx
Lumin
:
com.DefaultCompany.com.unity.template.mobile2D
Lumin
:
com.DefaultCompany.com.unity.template.mobile2D
Standalone
:
com.DefaultCompany.com.unity.template.mobile2D
Standalone
:
com.DefaultCompany.com.unity.template.mobile2D
iPhone
:
com.ym.iosawpdd
iPhone
:
com.ym.iosawpdd
...
@@ -177,7 +184,7 @@ PlayerSettings:
...
@@ -177,7 +184,7 @@ PlayerSettings:
Standalone
:
0
Standalone
:
0
iPhone
:
0
iPhone
:
0
tvOS
:
0
tvOS
:
0
AndroidBundleVersionCode
:
8
AndroidBundleVersionCode
:
1
AndroidMinSdkVersion
:
21
AndroidMinSdkVersion
:
21
AndroidTargetSdkVersion
:
0
AndroidTargetSdkVersion
:
0
AndroidPreferredInstallLocation
:
1
AndroidPreferredInstallLocation
:
1
...
@@ -263,7 +270,7 @@ PlayerSettings:
...
@@ -263,7 +270,7 @@ PlayerSettings:
AndroidEnableTango
:
0
AndroidEnableTango
:
0
androidEnableBanner
:
1
androidEnableBanner
:
1
androidUseLowAccuracyLocation
:
0
androidUseLowAccuracyLocation
:
0
androidUseCustomKeystore
:
0
androidUseCustomKeystore
:
1
m_AndroidBanners
:
m_AndroidBanners
:
-
width
:
320
-
width
:
320
height
:
180
height
:
180
...
@@ -366,6 +373,7 @@ PlayerSettings:
...
@@ -366,6 +373,7 @@ PlayerSettings:
m_Kind
:
2
m_Kind
:
2
m_SubKind
:
m_SubKind
:
m_BuildTargetBatching
:
[]
m_BuildTargetBatching
:
[]
m_BuildTargetEncrypting
:
[]
m_BuildTargetGraphicsJobs
:
m_BuildTargetGraphicsJobs
:
-
m_BuildTarget
:
MacStandaloneSupport
-
m_BuildTarget
:
MacStandaloneSupport
m_GraphicsJobs
:
0
m_GraphicsJobs
:
0
...
@@ -647,7 +655,7 @@ PlayerSettings:
...
@@ -647,7 +655,7 @@ PlayerSettings:
scriptingDefineSymbols
:
{}
scriptingDefineSymbols
:
{}
platformArchitecture
:
{}
platformArchitecture
:
{}
scriptingBackend
:
scriptingBackend
:
Android
:
0
Android
:
1
il2cppCompilerConfiguration
:
{}
il2cppCompilerConfiguration
:
{}
managedStrippingLevel
:
{}
managedStrippingLevel
:
{}
incrementalIl2cppBuild
:
{}
incrementalIl2cppBuild
:
{}
...
...
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