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
3d69bb09
Commit
3d69bb09
authored
May 19, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复快手闪退
parent
be803ec4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
147 deletions
+36
-147
AdManager.cs
Assets/AdSDK/AD/AD_Manager/AdManager.cs
+1
-3
AdUtils.cs
Assets/AdSDK/AD/Demo/AdUtils.cs
+0
-104
AdUtils.cs.meta
Assets/AdSDK/AD/Demo/AdUtils.cs.meta
+0
-11
KsUnityFeedAd.java
Assets/AdSDK/AD/KS/KsSDK/Scripts/Feed/KsUnityFeedAd.java
+31
-26
KsAdSDK.cs
Assets/AdSDK/AD/KS/KsSDK/Scripts/KsAdSDK.cs
+1
-0
EditorBuildSettings.asset
ProjectSettings/EditorBuildSettings.asset
+2
-2
ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+1
-1
No files found.
Assets/AdSDK/AD/AD_Manager/AdManager.cs
View file @
3d69bb09
...
...
@@ -109,12 +109,10 @@ public class AdManager
#endif
break
;
case
ZXADConfig
.
PLANTFORM_AD_KUS
:
#if UNITUY_ANDROD
if
(
id
.
codeAppId
!=
null
&&
id
.
codeAppId
!=
""
)
if
(
id
.
codeAppId
!=
null
&&
id
.
codeAppId
!=
""
)
{
KsAdSDK
.
InitKsAdSDK
(
id
.
codeAppId
,
Application
.
identifier
);
}
#endif
break
;
default
:
Debug
.
unityLogger
.
Log
(
ZXADConfig
.
ADManagerTAG
,
"不支持初始化"
+
id
.
adPlatform
+
"的广告"
);
...
...
Assets/AdSDK/AD/Demo/AdUtils.cs
deleted
100644 → 0
View file @
be803ec4
using
System
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
AdUtils
{
private
AdUtils
()
{
}
private
static
readonly
AdUtils
singleInstance
=
new
AdUtils
();
public
static
AdUtils
Instance
{
get
{
return
singleInstance
;
}
}
private
void
InitAd
()
{
AdManager
.
Instance
.
InitAd
(
new
Action
<
bool
>((
cb
)=>
{
if
(
cb
)
{
AdManager
.
Instance
.
LoadCacheRewardVideoAd
(
"video"
);
}
}));
}
/// <summary>
/// 播放开屏广告
/// </summary>
public
void
ShowSplashAd
(
Action
<
bool
>
callback
)
{
AdManager
.
Instance
.
LoadSplashAd
(
new
SplshAdListener
(
callback
));
}
/// <summary>
/// 播放激励视频广告
/// </summary>
public
void
ShowRewardAd
(
string
action
,
Action
<
bool
>
callback
)
{
AdManager
.
Instance
.
PlayCacheRewardVideoAd
(
"video"
,
"test"
,
new
RewardAdListener
(
callback
));
}
private
sealed
class
SplshAdListener
:
ZXADSplashListener
{
private
Action
<
bool
>
callback
;
public
SplshAdListener
(
Action
<
bool
>
callback
)
{
this
.
callback
=
callback
;
}
public
void
onAdShow
()
{
}
public
void
onAdSkip
()
{
callback
(
true
);
}
public
void
onError
(
string
errorMsg
)
{
}
public
void
onLastError
()
{
callback
(
true
);
}
}
public
sealed
class
RewardAdListener
:
ZXADRewardVideoListener
{
private
Action
<
bool
>
callback
;
public
RewardAdListener
(
Action
<
bool
>
callback
)
{
this
.
callback
=
callback
;
}
public
void
onAdClose
(
AdEntity
entity
)
{
AdManager
.
Instance
.
LoadCacheRewardVideoAd
(
"video"
);
callback
(
true
);
}
public
void
onAdShow
()
{
}
public
void
onAdVideoBarClick
()
{
}
public
void
onError
(
string
errorMsg
)
{
AdManager
.
Instance
.
LoadCacheRewardVideoAd
(
"video"
);
callback
(
false
);
}
public
void
onSuccess
()
{
}
}
}
Assets/AdSDK/AD/Demo/AdUtils.cs.meta
deleted
100644 → 0
View file @
be803ec4
fileFormatVersion: 2
guid: 7254c6703a47f6f438d80ec0dc944695
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/AdSDK/AD/KS/KsSDK/Scripts/Feed/KsUnityFeedAd.java
View file @
3d69bb09
...
...
@@ -49,37 +49,42 @@ public class KsUnityFeedAd {
public
void
ShowFeedAd
(
Activity
activity
,
KsUnityFeedShowListener
listener
)
{
if
(
feedAd
!=
null
)
{
feedAd
.
setAdInteractionListener
(
new
KsFeedAd
.
AdInteractionListener
()
{
activity
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
onAdClicked
()
{
listener
.
onAdClicked
();
}
public
void
run
()
{
feedAd
.
setAdInteractionListener
(
new
KsFeedAd
.
AdInteractionListener
()
{
@Override
public
void
onAdClicked
()
{
listener
.
onAdClicked
();
}
@Override
public
void
onAdShow
()
{
listener
.
onAdShow
();
}
@Override
public
void
onAdShow
()
{
listener
.
onAdShow
();
}
@Override
public
void
onDislikeClicked
()
{
removeAdView
(
activity
,
feedlinearLayout
);
listener
.
onDislikeClicked
();
@Override
public
void
onDislikeClicked
()
{
removeAdView
(
activity
,
feedlinearLayout
);
listener
.
onDislikeClicked
();
}
});
feedVidw
=
feedAd
.
getFeedView
(
activity
);
LinearLayout
.
LayoutParams
lp
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
lp
.
gravity
=
Gravity
.
BOTTOM
;
feedVidw
.
setLayoutParams
(
lp
);
if
(
feedVidw
!=
null
)
{
feedlinearLayout
=
new
LinearLayout
(
activity
);
LinearLayout
.
LayoutParams
layoutParams
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
feedlinearLayout
.
setLayoutParams
(
layoutParams
);
feedlinearLayout
.
addView
(
feedVidw
);
ViewGroup
root
=
getRootLayout
(
activity
);
if
(
feedVidw
!=
null
)
{
root
.
addView
(
feedlinearLayout
);
}
}
}
});
feedVidw
=
feedAd
.
getFeedView
(
activity
);
LinearLayout
.
LayoutParams
lp
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
lp
.
gravity
=
Gravity
.
BOTTOM
;
feedVidw
.
setLayoutParams
(
lp
);
if
(
feedVidw
!=
null
)
{
feedlinearLayout
=
new
LinearLayout
(
activity
);
LinearLayout
.
LayoutParams
layoutParams
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
feedlinearLayout
.
setLayoutParams
(
layoutParams
);
feedlinearLayout
.
addView
(
feedVidw
);
ViewGroup
root
=
getRootLayout
(
activity
);
if
(
feedVidw
!=
null
)
{
root
.
addView
(
feedlinearLayout
);
}
}
}
else
{
listener
.
onShowError
(-
1
,
"没有大图广告数据"
);
}
...
...
Assets/AdSDK/AD/KS/KsSDK/Scripts/KsAdSDK.cs
View file @
3d69bb09
...
...
@@ -7,6 +7,7 @@ public class KsAdSDK
{
public
static
void
InitKsAdSDK
(
string
AppId
,
string
AppName
)
{
Debug
.
unityLogger
.
Log
(
"快手Appid"
+
AppId
+
"AppName"
+
AppName
);
#if UNITY_ANDROID&&!UNITY_EDITOR
AndroidJavaClass
splashAd
=
new
AndroidJavaClass
(
"com.ym.unitykssdk.KsAdSDKInitUtil"
);
splashAd
.
CallStatic
(
"initSDK"
,
Utils
.
GetActivity
(),
AppId
,
AppName
);
...
...
ProjectSettings/EditorBuildSettings.asset
View file @
3d69bb09
...
...
@@ -5,7 +5,7 @@ EditorBuildSettings:
m_ObjectHideFlags
:
0
serializedVersion
:
2
m_Scenes
:
-
enabled
:
1
-
enabled
:
0
path
:
Assets/AdSDK/AD/CSJ/Example/Example.unity
guid
:
1e4f8457b1266154e80399e42b932ceb
-
enabled
:
0
...
...
@@ -17,7 +17,7 @@ EditorBuildSettings:
-
enabled
:
0
path
:
Assets/AdSDK/SplashDemo/Splash.unity
guid
:
37af8cf3fb373478ab04e3ee2f3b700a
-
enabled
:
0
-
enabled
:
1
path
:
Assets/AdSDK/AD/Demo/AdDemo.unity
guid
:
ef80a35d44f809e4a8957d1ed9571fd2
-
enabled
:
0
...
...
ProjectSettings/ProjectSettings.asset
View file @
3d69bb09
...
...
@@ -175,7 +175,7 @@ PlayerSettings:
androidSupportedAspectRatio
:
1
androidMaxAspectRatio
:
2.1
applicationIdentifier
:
Android
:
com.ym.w
dlc
Android
:
com.ym.w
yymf
Lumin
:
com.DefaultCompany.com.unity.template.mobile2D
Standalone
:
com.DefaultCompany.com.unity.template.mobile2D
iPhone
:
com.DefaultCompany.com.unity.template.mobile2D
...
...
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