Commit 8104362d authored by erwin's avatar erwin

集成风行广告

parent 84859580
No preview for this file type
No preview for this file type
...@@ -99,6 +99,10 @@ public class AdManager ...@@ -99,6 +99,10 @@ public class AdManager
} }
#endif #endif
break; break;
case ZXADConfig.PLANTFORM_AD_FS:
AndroidJavaClass jc3 = new AndroidJavaClass("com.ym.admodule.fs.FunShionManager");
jc3.CallStatic("init");
break;
default: default:
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持初始化" + id.adPlatform + "的广告"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持初始化" + id.adPlatform + "的广告");
...@@ -232,6 +236,10 @@ public class AdManager ...@@ -232,6 +236,10 @@ public class AdManager
//掌心汇川开屏广告 //掌心汇川开屏广告
ZXHCSplashUtil.Instance.LoadSplshAd(entity, listener, callback); ZXHCSplashUtil.Instance.LoadSplshAd(entity, listener, callback);
break; break;
//风行开屏广告
case ZXADConfig.PLANTFORM_AD_FS:
FSSplashUtil.Instance.loadSplashAd(entity, listener, callback);
break;
default: default:
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持加载" + entity.adPlatform + "的Splash广告"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持加载" + entity.adPlatform + "的Splash广告");
callback(false); callback(false);
...@@ -1115,6 +1123,10 @@ public class AdManager ...@@ -1115,6 +1123,10 @@ public class AdManager
//优良宝激励视频广告加载 //优良宝激励视频广告加载
YLBRewardAdUtil.Instance.LoadCacheRewardAd(entity, callback); YLBRewardAdUtil.Instance.LoadCacheRewardAd(entity, callback);
break; break;
//风行激励视频广告
case ZXADConfig.PLANTFORM_AD_FS:
FSRewardUtils.Instance.LoadCacheRewardAd(entity, callback);
break;
default: default:
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持加载" + entity.adPlatform + "的激励视频广告"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持加载" + entity.adPlatform + "的激励视频广告");
callback(null); callback(null);
...@@ -1221,6 +1233,10 @@ public class AdManager ...@@ -1221,6 +1233,10 @@ public class AdManager
//优良宝激励视频广告播放 //优良宝激励视频广告播放
YLBRewardAdUtil.Instance.playCacheRewardAd(entity, listener, callback); YLBRewardAdUtil.Instance.playCacheRewardAd(entity, listener, callback);
break; break;
//风行激励视频广告
case ZXADConfig.PLANTFORM_AD_FS:
FSRewardUtils.Instance.playCacheRewardAd(entity, listener, callback);
break;
default: default:
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持Show" + entity.adPlatform + "的激励视频广告"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持Show" + entity.adPlatform + "的激励视频广告");
callback(false); callback(false);
......
...@@ -29,7 +29,7 @@ public class ZXADConfig ...@@ -29,7 +29,7 @@ public class ZXADConfig
public const string PLANTFORM_AD_RS = "ruishi";//瑞狮 public const string PLANTFORM_AD_RS = "ruishi";//瑞狮
public const string PLANTFORM_AD_NEWS = "news";//新闻站 public const string PLANTFORM_AD_NEWS = "news";//新闻站
public const string PLANTFORM_AD_ZXHC = "zxhc";//掌心汇川 public const string PLANTFORM_AD_ZXHC = "zxhc";//掌心汇川
public const string PLANTFORM_AD_FS = "fengxing";//
......
...@@ -24,7 +24,7 @@ public class AdDemo : MonoBehaviour ...@@ -24,7 +24,7 @@ public class AdDemo : MonoBehaviour
{ {
AdManager.Instance.InitAd(new System.Action<bool>((cb) => { AdManager.Instance.InitAd(new System.Action<bool>((cb) => {
OnClickPlaySplshAd(); //OnClickPlaySplshAd();
})); }));
} }
public void OnClickLoadRewardAd() public void OnClickLoadRewardAd()
......
fileFormatVersion: 2
guid: 457ea78b7ebbf4690996713e9ab573f9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using Tencent.GDT;
#if UNITY_ANDROID
public class FSManager
{
/**激励视频**/
private AndroidJavaObject fsManager = new AndroidJavaObject("com.ym.admodule.fs.FunShionManager");
private FSRewardVideoAdListenerProxy listenerProxy = new FSRewardVideoAdListenerProxy();
private FSRewardVideoAdLoadListenerProxy listenerLoadProxy = new FSRewardVideoAdLoadListenerProxy();
private FSSplashAdListenerProxy splashProxy = new FSSplashAdListenerProxy();
public void SetSplashListener(IFSSplashAdListener listener) {
splashProxy.listener = listener;
}
public void SetLoadListener(IFSRewardVideoAdLoadListener listener)
{
listenerLoadProxy.listener = listener;
}
public void SetPlayListener(IFSRewardVideoAdListener listener)
{
listenerProxy.listener = listener;
}
// 加载激励视频
public void LoadAd(string codeId, string codeGroup)
{
//if (this.rewardVideoAd == null)
//{
// // 由于 Android 的静音参数不允许动态设置,故只能延迟初始化
// rewardVideoAd = new AndroidJavaObject("com.ym.admodule.ylb.YLBManager");
// //Utils.GetActivity(), posId, listenerProxy, volumeOn);
//}
fsManager.Call("loadReward", Utils.GetActivity(), codeId, listenerLoadProxy);
}
// 展示激励视频
public void ShowAD(string codeId, string codeGroup)
{
//if (this.rewardVideoAd == null)
//{
// // 由于 Android 的静音参数不允许动态设置,故只能延迟初始化
// rewardVideoAd = new AndroidJavaObject("com.ym.admodule.ylb.YLBManager");
// //Utils.GetActivity(), posId, listenerProxy, volumeOn);
//}
fsManager.Call("showReward", Utils.GetActivity(), codeId, codeGroup, listenerProxy);
}
public void loadSplash(string codeId, string codeGroup)
{
fsManager.Call("loadSplash", Utils.GetActivity(),codeId, splashProxy);
}
}
#endif
fileFormatVersion: 2
guid: 0439fcfe32220480eae9bf36aa241f70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FSRewardUtils
{
private FSRewardUtils() { }
private static readonly FSRewardUtils singleInstance = new FSRewardUtils();
public static FSRewardUtils Instance
{
get
{
return singleInstance;
}
}
/// <summary>
/// 加载缓存激励视频
/// </summary>
/// <param name="entity"></param>
/// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<AdEntity> callback)
{
#if UNITY_ANDROID
FSManager rewardVideoAd = new FSManager();
rewardVideoAd.SetLoadListener(new RewardVideoAdLoadListener(this, entity, rewardVideoAd, callback));
rewardVideoAd.LoadAd(entity.codeId, entity.codeGroup);
#elif UNITY_IOS
callback(false);
#endif
}
/// <summary>
/// 播放缓存的激励视频
/// </summary>
/// <param name="entity"></param>
/// <param name="listener"></param>
/// <param name="callback"></param>
public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback)
{
FSManager rewardVideoAd = GetRewardVideoAd(entity.codeGroup + entity.slotName);
if (rewardVideoAd != null)
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.codeGroup + "YLB Not NUll");
#if UNITY_ANDROID
rewardVideoAd.SetPlayListener(new RewardVideoAdListener(entity, callback, listener));
rewardVideoAd.ShowAD(entity.codeId, entity.codeGroup);
#elif UNITY_IOS
callback(false);
#endif
}
else
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.codeGroup + "YLB NUll");
callback(false);
}
}
private sealed class RewardVideoAdLoadListener : IFSRewardVideoAdLoadListener
{
private FSRewardUtils adUtil;
private AdEntity entity;
private FSManager rewardVideo;
private Action<AdEntity> callback;
//public RewardVideoAdLoadListener(YLBRewardAdUtil adUtil, AdEntity entity, YLBRewardAD rewardVideo, Action<AdEntity> callback)
//{
// this.adUtil = adUtil;
// this.entity = entity;
// this.rewardVideo = rewardVideo;
// this.callback = callback;
//}
//public void onError(int code, string message)
//{
// Debug.unityLogger.Log(entity.codeGroup + " codeID " + entity.codeId + "YLB Error code" + code + "message" + message);
// EventUtils.onEventPullFail(entity, code.ToString(), message);
// callback(null);
//}
//public void onLoad()
//{
// EventUtils.onEventPullSuccess(entity);
// adUtil.SetRewardVideoAd(entity.codeGroup + entity.slotName, this.rewardVideo);
// callback(entity);
//}
public RewardVideoAdLoadListener(FSRewardUtils adUtil, AdEntity entity, FSManager rewardVideo, Action<AdEntity> callback)
{
this.adUtil = adUtil;
this.entity = entity;
this.rewardVideo = rewardVideo;
this.callback = callback;
}
public void onError(int code, string message)
{
Debug.unityLogger.Log(entity.codeGroup + " codeID " + entity.codeId + "YLB Error code" + code + "message" + message);
EventUtils.onEventPullFail(entity, code.ToString(), message);
callback(null);
}
public void onLoad()
{
EventUtils.onEventPullSuccess(entity);
adUtil.SetRewardVideoAd(entity.codeGroup + entity.slotName, this.rewardVideo);
callback(entity);
}
}
private sealed class RewardVideoAdListener : IFSRewardVideoAdListener
{
private AdEntity entity;
private Action<bool> callback;
private ZXADRewardVideoListener listener;
public RewardVideoAdListener(AdEntity entity, Action<bool> callback, ZXADRewardVideoListener listener)
{
this.entity = entity;
this.callback = callback;
this.listener = listener;
}
public void onAdClose(string codeId)
{
listener.onAdClose(entity);
}
public void onAdShow()
{
callback(true);
EventUtils.onEventShowSuccess(entity);
listener.onAdShow();
}
public void onAdVideoBarClick()
{
EventUtils.onEventAdClick(entity);
listener.onAdVideoBarClick();
}
public void onError(string message)
{
callback(false);
EventUtils.onEventShowFail(entity);
listener.onError(message);
}
public void onSuccess()
{
EventUtils.onEventAdComplete(entity);
listener.onSuccess();
}
}
/// <summary>
/// 激励视频缓存队列
/// </summary>
private Dictionary<string, Queue<FSManager>> mRewardCacheMap = new Dictionary<string, Queue<FSManager>>();
/// <summary>
/// 保存缓存的激励视频
/// </summary>
/// <param name="codeId"></param>
/// <param name="reward"></param>
private void SetRewardVideoAd(string codeId, FSManager reward)
{
if (codeId == null || codeId == "")
{
return;
}
Queue<FSManager> mRewardQueue;
if (mRewardCacheMap.ContainsKey(codeId))
{
mRewardQueue = mRewardCacheMap[codeId];
}
else
{
mRewardQueue = new Queue<FSManager>();
}
mRewardQueue.Enqueue(reward);
mRewardCacheMap[codeId] = mRewardQueue;
}
/// <summary>
/// 取出缓存的激励视频
/// </summary>
/// <param name="codeId"></param>
/// <returns></returns>
private FSManager GetRewardVideoAd(string codeId)
{
if (mRewardCacheMap.ContainsKey(codeId))
{
Queue<FSManager> mRewardQueue = mRewardCacheMap[codeId];
if (mRewardQueue != null && mRewardQueue.Count > 0)
{
return mRewardQueue.Dequeue();
}
}
return null;
}
}
fileFormatVersion: 2
guid: 91b588c94af9c484d91ea6cc78b188d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.fs;
public interface FSRewardVideoAdListener {
//获取广告成功
void onSuccess();
//获取广告失败
void onError(String errorMsg);
//广告展示
void onAdShow();
//广告点击
void onAdVideoBarClick();
//关闭广告
void onAdClose(String codeId);
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: b1c037060738b4c28a608a88b066dccb guid: 6ed4091059cfa4ec5bacb92944ff92e2
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
......
#if UNITY_ANDROID
using UnityEngine;
internal class FSRewardVideoAdListenerProxy : AndroidJavaProxy
{
internal IFSRewardVideoAdListener listener = null;
public FSRewardVideoAdListenerProxy() : base("com.ym.admodule.fs.FSRewardVideoAdListener") { }
public void onSuccess()
{
if (listener == null)
{
return;
}
listener.onSuccess();
}
public void onError(string errorMsg)
{
if (listener == null)
{
return;
}
listener.onError(errorMsg);
}
public void onAdShow()
{
if (listener == null)
{
return;
}
listener.onAdShow();
}
public void onAdVideoBarClick()
{
if (listener == null)
{
return;
}
listener.onAdVideoBarClick();
}
public void onAdClose(string codeId)
{
if (listener == null)
{
return;
}
listener.onAdClose(codeId);
}
}
#endif
\ No newline at end of file
fileFormatVersion: 2
guid: bfaef70f3195045839c32ff1a2767084
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.fs;
public interface FSRewardVideoAdLoadListener {
void onError(int code, String message);
void onLoad();
}
fileFormatVersion: 2
guid: dfe8f1c5205344a6396cf483213e302d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
#if UNITY_ANDROID
using UnityEngine;
internal class FSRewardVideoAdLoadListenerProxy : AndroidJavaProxy
{
internal IFSRewardVideoAdLoadListener listener = null;
public FSRewardVideoAdLoadListenerProxy() : base("com.ym.admodule.fs.FSRewardVideoAdLoadListener") { }
public void onLoad()
{
if (listener == null)
{
return;
}
listener.onLoad();
}
public void onError(int code, string message)
{
if (listener == null)
{
return;
}
listener.onError(code, message);
}
}
#endif
\ No newline at end of file
fileFormatVersion: 2
guid: ae5fbb08eb2704b658e99be7cf4d2f46
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
#if UNITY_ANDROID
using UnityEngine;
internal class FSSplashAdListenerProxy : AndroidJavaProxy
{
internal IFSSplashAdListener listener = null;
public FSSplashAdListenerProxy() : base("com.ym.admodule.fs.FsADSplashListener") { }
public void onAdSkip()
{
if (listener == null)
{
return;
}
listener.onAdSkip();
}
public void onError(string errorMsg)
{
if (listener == null)
{
return;
}
listener.onError(errorMsg);
}
public void onAdShow()
{
if (listener == null)
{
return;
}
listener.onAdShow();
}
}
#endif
fileFormatVersion: 2
guid: 4d3604dd1d7e340d5b673565696bd2cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.fs;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.fun.xm.ad.fsadview.FSSplashAD;
public class FSSplashAdManager {
private Handler mHandler;
private static volatile FSSplashAdManager sManager;
private RequestQueue mQueue;
private Context mContext;
private View mSplashView;
private FSSplashAdManager() {
if (mHandler == null) {
mHandler = new Handler(Looper.getMainLooper());
}
}
public static FSSplashAdManager getSplashAdManager() {
if (sManager == null) {
synchronized (FSSplashAdManager.class) {
if (sManager == null) {
sManager = new FSSplashAdManager();
}
}
}
return sManager;
}
public ViewGroup getRootLayout(Activity context) {
if (context == null) {
return null;
}
ViewGroup rootGroup = null;
rootGroup = context.findViewById(android.R.id.content);
return rootGroup;
}
public void addAdView(Activity context, View adView, ViewGroup.LayoutParams layoutParams) {
if (context == null || adView == null || layoutParams == null) {
return;
}
ViewGroup group = getRootLayout(context);
if (group == null) {
return;
}
group.addView(adView, layoutParams);
}
public void removeAdView(Activity context, View adView) {
if (context == null || adView == null) {
return;
}
ViewGroup group = getRootLayout(context);
if (group == null) {
return;
}
group.removeView(adView);
}
//广告使用完毕后,比如关闭或移除后,请调用destory释放资源。
//相关调用注意放在主线程
public void showSplashAd(final Context context, final FSSplashAD ad) {
if (context == null || ad == null) {
return;
}
mContext = context;
if (mQueue == null) {
mQueue = Volley.newRequestQueue(mContext);
}
mHandler.post(new Runnable() {
@Override
public void run() {
mSplashView = ad;
removeAdView((Activity) context, mSplashView);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER;
addAdView((Activity) context, mSplashView, layoutParams);
}
});
}
//操作UI相关放在主线程
public void destorySplashView(final Activity context) {
if (context == null || mHandler == null) {
return;
}
mHandler.post(new Runnable() {
@Override
public void run() {
if (mSplashView != null) {
removeAdView(context, mSplashView);
mSplashView = null;
}
}
});
}
}
fileFormatVersion: 2
guid: 23bd599c6ff714a998008f79cff72772
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FSSplashUtil
{
private FSSplashUtil() { }
private static readonly FSSplashUtil singleInstance = new FSSplashUtil();
public static FSSplashUtil Instance
{
get
{
return singleInstance;
}
}
/// <summary>
/// 加载缓存激励视频
/// </summary>
/// <param name="entity"></param>
/// <param name="callback"></param>
public void loadSplashAd(AdEntity entity, ZXADSplashListener listener, Action<bool> callback)
{
#if UNITY_ANDROID
FSManager rewardVideoAd = new FSManager();
rewardVideoAd.SetSplashListener(new SplshAdListener( entity, this,listener, callback));
rewardVideoAd.loadSplash(entity.codeId, entity.codeGroup);
#elif UNITY_IOS
callback(false);
#endif
}
/// <summary>
/// ZXHC开屏回调
/// </summary>
private sealed class SplshAdListener : IFSSplashAdListener
{
private AdEntity entity;
private ZXADSplashListener listener;
private FSSplashUtil hcAdUtils;
private Action<bool> callback;
public SplshAdListener(AdEntity entity, FSSplashUtil hcAdUtils, ZXADSplashListener listener, Action<bool> callback)
{
this.entity = entity;
this.listener = listener;
this.hcAdUtils = hcAdUtils;
this.callback = callback;
}
//public void OnAdClicked()
//{
// EventUtils.onEventAdClick(entity);
//}
//public void OnAdClosed()
//{
// EventUtils.onEventAdComplete(entity);
// this.listener.onAdSkip();
//}
//public void OnAdLoaded()
//{
//}
//public void OnAdShow()
//{
// EventUtils.onEventShowSuccess(entity);
// this.listener.onAdShow();
//}
public void onAdShow()
{
callback(true);
}
public void onAdSkip()
{
this.listener.onAdSkip();
}
public void onError(string errorMsg)
{
EventUtils.onEventPullFail(entity, "123", errorMsg);
this.listener.onError("FS Splsh Error Code" + " Msg " + errorMsg);
callback(false);
}
}
}
fileFormatVersion: 2
guid: bef9214e586d14dd68728d5276928555
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.fs;
/**
* Created by erwin on 2021/4/16
*/
interface FsADSplashListener {
void onAdShow();
//获取开屏广告 跳过 广告
void onAdSkip();
//获取广告 错误 广告
void onError(String errorMsg);
}
fileFormatVersion: 2
guid: 89fc7a190cb1e4574b4cd9b6d1abd50d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.fs;
import android.app.Activity;
import com.fun.xm.ad.FSAD;
import com.fun.xm.ad.FSThirdAd;
import com.fun.xm.ad.adloader.FSRewardVideoAdLoader;
import com.fun.xm.ad.adloader.FSSplashAdLoader;
import com.fun.xm.ad.callback.FSSplashAdCallBack;
import com.fun.xm.ad.fsadview.FSRewardVideoView;
import com.fun.xm.ad.fsadview.FSSplashAD;
import com.fun.xm.ad.listener.FSRewardVideoADListener;
import com.unity.adcommon.unity.AndroidPreference;
import com.unity.adcommon.unity.AppliContext;
import java.util.ArrayList;
import java.util.List;
/**
* Created by erwin on 2021/4/16
*/
public class FunShionManager {
public static void init(){
FSAD.init(AppliContext.get());
}
private FSSplashAD mFSSplashAD = null;
private ArrayList<FSRewardVideoView> rewradArray = new ArrayList<>();
public void loadSplash(Activity activity,String codeId, FsADSplashListener listener){
FSSplashAdLoader fsSplashAdLoader = new FSSplashAdLoader(activity);
fsSplashAdLoader.loadAD(codeId, AndroidPreference.getOaid(), new FSSplashAdCallBack() {
@Override
public void onAdsTimeUpdate(int sec) {
mFSSplashAD.setSkipViewContent("跳过 " + sec / 1000);
if (sec / 1000 == 0) {
listener.onAdSkip();
}
}
@Override
public void onClose() {
if (mFSSplashAD != null) {
mFSSplashAD.destroy();
mFSSplashAD = null;
}
listener.onAdSkip();
}
@Override
public void onAdLoadSuccess() {
}
@Override
public void onZoomOut() {
}
@Override
public void onClick() {
}
@Override
public void onCreate(FSSplashAD fsSplashAD) {
mFSSplashAD = fsSplashAD;
FSSplashAdManager.getSplashAdManager().showSplashAd(activity,fsSplashAD);
}
@Override
public void onADShow() {
listener.onAdShow();
}
@Override
public void onAdLoadedFail(int i, String s) {
listener.onError("code: "+i+" errorMsg: "+s);
}
@Override
public void onCreateThirdAD(List<FSThirdAd> list) {
}
});
}
public void loadReward(Activity activity,String codeId,FSRewardVideoAdLoadListener listener){
FSRewardVideoAdLoader fsRewardVideoAdLoader = new FSRewardVideoAdLoader(activity);
fsRewardVideoAdLoader.loadAD(codeId, AndroidPreference.getOaid(), new FSRewardVideoADListener() {
@Override
public void onLoadStart() {
}
@Override
public void onLoadSuccess(FSRewardVideoView fsADView) {
if (fsADView != null) {
rewradArray.add(fsADView);
listener.onLoad();
}else {
listener.onError(110,"loadSuccess but FSRewardVideoView obj is null");
}
if(fsListener!=null){
fsListener.onSuccess();
}
}
@Override
public void onADClicked() {
if(fsListener!=null){
fsListener.onAdVideoBarClick();
}
}
@Override
public void onADComplete() {
if(fsListener!=null){
fsListener.onAdClose(codeId);
}
}
@Override
public void onADShow() {
if(fsListener!=null){
fsListener.onAdShow();
}
}
@Override
public void onAdLoadedFail(int i, String s) {
listener.onError(i,s);
if(fsListener!=null){
fsListener.onError(s);
}
}
@Override
public void onCreateThirdAD(List<FSThirdAd> list) {
}
});
}
private FSRewardVideoAdListener fsListener;
public void showReward(Activity activity, String codeId, String codeGroup, FSRewardVideoAdListener listener){
if (activity != null && codeId != null &&rewradArray != null && !rewradArray.isEmpty() && rewradArray.get(rewradArray.size()-1) != null) {
FSRewardVideoView mTTad = rewradArray.get(rewradArray.size()-1);
if (mTTad != null) {
this.fsListener = listener;
mTTad.showAD();
}
}else{
//没有缓存的情况
loadRewardVideo(activity,codeId,codeGroup,listener);
}
}
private void loadRewardVideo(Activity activity, String codeId, String codeGroup, FSRewardVideoAdListener fsListener){
FSRewardVideoAdLoader fsRewardVideoAdLoader = new FSRewardVideoAdLoader(activity);
fsRewardVideoAdLoader.loadAD(codeId, AndroidPreference.getOaid(), new FSRewardVideoADListener() {
@Override
public void onLoadStart() {
}
@Override
public void onLoadSuccess(FSRewardVideoView fsADView) {
if(fsADView!=null){
fsADView.showAD();
}
if(fsListener!=null){
fsListener.onSuccess();
}
}
@Override
public void onADClicked() {
if(fsListener!=null){
fsListener.onAdVideoBarClick();
}
}
@Override
public void onADComplete() {
if(fsListener!=null){
fsListener.onAdClose(codeId);
}
}
@Override
public void onADShow() {
if(fsListener!=null){
fsListener.onAdShow();
}
}
@Override
public void onAdLoadedFail(int i, String s) {
if(fsListener!=null){
fsListener.onError(s);
}
}
@Override
public void onCreateThirdAD(List<FSThirdAd> list) {
}
});
}
}
fileFormatVersion: 2
guid: 6c3ba4a8c5692435fbbf99087683694e
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IFSRewardVideoAdListener
{
//获取广告成功
void onSuccess();
//获取广告失败
void onError(string errorMsg);
//广告展示
void onAdShow();
//广告点击
void onAdVideoBarClick();
//关闭广告
void onAdClose(string codeId);
}
fileFormatVersion: 2
guid: e97f893064ee54aa593ba8b1e209cef0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public interface IFSRewardVideoAdLoadListener
{
void onLoad();
void onError(int code, string message);
}
fileFormatVersion: 2
guid: a8feacdcccea949549c0fe7212788339
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IFSSplashAdListener
{
void onAdShow();
//获取开屏广告 跳过 广告
void onAdSkip();
//获取广告 错误 广告
void onError(string errorMsg);
}
fileFormatVersion: 2
guid: bd075ad6f99af4e7799f9fae91f79740
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 79cba7fa1bb1f457ebded5c2713dab8a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fabac4f2df8774f6496a0a7357625528
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7ebf295ee40f741e6a55e0b06594ced2
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4c1e6544e8bca43918bac694387996f0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7180bdbef6bf440f698afbdb63a06f9f
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 313bb0c6c369747158b3e1a958090eed
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 130433df080354ee7821a2c56dee1e11
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 178b3ca1035f54694959507206f9c7c5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3895512c28ffe48578f5acbf4309126d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
...@@ -8,13 +8,13 @@ EditorBuildSettings: ...@@ -8,13 +8,13 @@ EditorBuildSettings:
- enabled: 0 - enabled: 0
path: Assets/AdSDK/AD/CSJ/Example/Example.unity path: Assets/AdSDK/AD/CSJ/Example/Example.unity
guid: 1e4f8457b1266154e80399e42b932ceb guid: 1e4f8457b1266154e80399e42b932ceb
- enabled: 0 - enabled: 1
path: Assets/AdSDK/AD/GDT/UnionDemo/UnionExample.unity path: Assets/AdSDK/AD/GDT/UnionDemo/UnionExample.unity
guid: 6c963ae210fa3c3438c2f6770ee81fc9 guid: 6c963ae210fa3c3438c2f6770ee81fc9
- enabled: 0 - enabled: 0
path: Assets/AdSDK/SplashDemo/Splash.unity path: Assets/AdSDK/SplashDemo/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 1 - enabled: 0
path: Assets/AdSDK/AD/Demo/AdDemo.unity path: Assets/AdSDK/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2 guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 0 - enabled: 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