Commit e2b40cf5 authored by 王雪伟's avatar 王雪伟

加入YLB 广告

parent da84ac26
......@@ -78,13 +78,22 @@ public class AdManager
GDTSDKManager.Init(id.codeAppId);
}
break;
case ZXADConfig.PLANTFORM_AD_YLB:
#if UNITY_ANDROID
if (id.codeAppId != null && id.codeAppId != "")
{
AndroidJavaClass jc2 = new AndroidJavaClass("com.unity.adcommon.unity.TTADManager");
jc2.CallStatic("initYLB", id.codeAppId);
}
#endif
break;
}
}
IsInitAd = true;
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, code+"AdInit 请求失败" + errMsg);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, code + "AdInit 请求失败" + errMsg);
}));
}
......@@ -162,11 +171,11 @@ public class AdManager
entity = totalEntityList[0];
entity.actionName = "开屏";
totalEntityList.RemoveAt(0);
mLoadSplashPlatform(entity, listener,SplashAdCallBack);
mLoadSplashPlatform(entity, listener, SplashAdCallBack);
}
}
});
mLoadSplashPlatform(entity, listener,SplashAdCallBack);
mLoadSplashPlatform(entity, listener, SplashAdCallBack);
}
......@@ -289,7 +298,7 @@ public class AdManager
/// <summary>
/// 展示缓存的Banner广告
/// </summary>
public void ShowCacheBannerAd(string slotName,string actionName)
public void ShowCacheBannerAd(string slotName, string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
if (entity != null)
......@@ -322,7 +331,7 @@ public class AdManager
{
case ZXADConfig.PLANTFORM_AD_TT:
//穿山甲Banner广告加载
CSJBannerUtil.Instance.ShowCacheBannerAd(entity,callback);
CSJBannerUtil.Instance.ShowCacheBannerAd(entity, callback);
break;
case ZXADConfig.PLANTFORM_AD_GDT:
//广点通Banner广告加载
......@@ -424,7 +433,7 @@ public class AdManager
/// <summary>
/// 展示缓存的大图广告
/// </summary>
public void ShowCacheFeedAd(string slotName,string actionName)
public void ShowCacheFeedAd(string slotName, string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
if (entity != null)
......@@ -457,7 +466,7 @@ public class AdManager
{
case ZXADConfig.PLANTFORM_AD_TT:
//穿山甲大图广告加载
CSJFeedUtil.Instance.ShowCacheFeedAd(entity,callback);
CSJFeedUtil.Instance.ShowCacheFeedAd(entity, callback);
break;
case ZXADConfig.PLANTFORM_AD_GDT:
//广点通大图广告加载
......@@ -541,7 +550,7 @@ public class AdManager
mLoadInterstitialAdPlatform(entity, InterstitialAdCallBack);
}
private void mLoadInterstitialAdPlatform(AdEntity entity,Action<bool> callback)
private void mLoadInterstitialAdPlatform(AdEntity entity, Action<bool> callback)
{
switch (entity.adPlatform)
{
......@@ -559,9 +568,9 @@ public class AdManager
/// <summary>
/// 播放缓存的插屏广告
/// </summary>
public void PlayCacheInterstitialAd(string slotName,string actionName)
public void PlayCacheInterstitialAd(string slotName, string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName,"");
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
if (entity != null)
{
entity.actionName = actionName;
......@@ -586,17 +595,17 @@ public class AdManager
}
private void mPlayCacheInterstitialAdPlatform(AdEntity entity,Action<bool> callback)
private void mPlayCacheInterstitialAdPlatform(AdEntity entity, Action<bool> callback)
{
switch (entity.adPlatform)
{
case ZXADConfig.PLANTFORM_AD_TT:
//穿山甲插屏广告加载
CSJInterstitialUtil.Instance.PlayCacheInterstitialAd(entity,callback);
CSJInterstitialUtil.Instance.PlayCacheInterstitialAd(entity, callback);
break;
case ZXADConfig.PLANTFORM_AD_GDT:
//广点通插屏广告加载
GDTInterstitialAdUtil.Instance.PlayCacheInterstitialAd(entity,callback);
GDTInterstitialAdUtil.Instance.PlayCacheInterstitialAd(entity, callback);
break;
}
}
......@@ -658,7 +667,7 @@ public class AdManager
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "全屏视频请求失败"+errMsg);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "全屏视频请求失败" + errMsg);
}));
}
......@@ -786,7 +795,7 @@ public class AdManager
if (entityA != null && entityB != null)
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "全屏视频 A组 B组 都有缓存数据");
if (entityA.codePrice > entityB.codePrice)
if (entityA.codePrice >= entityB.codePrice)
{
entity = entityA;
ZXADConfig.Instance.RemoveAdCache(slotName, "A");
......@@ -908,6 +917,7 @@ public class AdManager
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频请求失败" + errMsg);
}));
}
/// <summary>
/// 根据广告List开始加载激励视频缓存A组
/// </summary>
......@@ -1009,6 +1019,10 @@ public class AdManager
//广点通激励视频广告加载
GDTRewardAdUtil.Instance.LoadCacheRewardAd(entity, callback);
break;
case ZXADConfig.PLANTFORM_AD_YLB:
//优良宝激励视频广告加载
YLBRewardAdUtil.Instance.LoadCacheRewardAd(entity, callback);
break;
}
}
......@@ -1028,8 +1042,8 @@ public class AdManager
if (entityA != null && entityB != null)
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频 A组 B组 都有缓存数据");
if (entityA.codePrice > entityB.codePrice)
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频 A组" + entityA.codePrice + " B组" + entityB.codePrice + " 都有缓存数据");
if (entityA.codePrice >= entityB.codePrice)
{
entity = entityA;
ZXADConfig.Instance.RemoveAdCache(slotName, "A");
......@@ -1082,12 +1096,26 @@ public class AdManager
//listener.onError(entity.codeGroup + "播放激励视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
}
}));
//mPlayCacheRewardVodeoAdPlatform(entityB, listener, new Action<bool>((bl) =>
//{
// if (bl)
// {
// Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entityB.codeGroup + "播放激励视频成功 " + entityB.adPlatform + " CodeId" + entityB.codeId);
// }
// else
// {
// Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entityB.codeGroup + "播放激励视频失败 " + entityB.adPlatform + " CodeId" + entityB.codeId);
// //listener.onError(entity.codeGroup + "播放激励视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
// }
//}));
}
else
{
LoadCacheRewardVideoAd(slotName);
listener.onError("播放激励视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放激励视频失败 缓存的信息为null");
//LoadCacheRewardVideoAd(slotName);
}
}
......@@ -1103,7 +1131,10 @@ public class AdManager
//广点通激励视频广告播放
GDTRewardAdUtil.Instance.playCacheRewardAd(entity, listener, callback);
break;
case ZXADConfig.PLANTFORM_AD_YLB:
//优良宝激励视频广告播放
YLBRewardAdUtil.Instance.playCacheRewardAd(entity, listener, callback);
break;
}
}
......
......@@ -22,7 +22,7 @@ public class ZXADConfig
public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲
public const string PLANTFORM_AD_GDT = "guangdiantong"; //广点通
public const string PLANTFORM_AD_KUS = "kuaishou"; //快手
public const string PLANTFORM_SH_YLB = "youliangbao";//优量宝
public const string PLANTFORM_AD_YLB = "youliangbao";//优量宝
public const string PLANTFORM_AD_SIGNMOB = "sigmob"; //sign Mob
public const string PLANTFORM_AD_HL = "huiliang"; //汇量
public const string PLANTFORM_AD_BD = "baidu"; //百度
......
......@@ -4,7 +4,8 @@ import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.unity.adcommon.unity.AppliContext;
import com.wannuosili.sdk.WNAdConfig;
import com.wannuosili.sdk.WNAdSdk;
/**
* Created by erwin on 2021/3/4
*/
......@@ -30,4 +31,13 @@ public class TTADManager {
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.build());
}
public static void initYLB(String appId){
WNAdSdk.initialize(new WNAdConfig.Builder()
.setAppId(appId) // 平台申请的appId
.setDebug(false) // 是否是debug模式, 默认为false
.setContext(AppliContext.get())
.build());
}
}
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;
......@@ -17,6 +18,7 @@ public class AdDemo : MonoBehaviour
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
//loadThread.Start();
}
......@@ -26,7 +28,12 @@ public class AdDemo : MonoBehaviour
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
//private Thread loadThread = new Thread(new LoadNextVideo());
private void LoadNextVideo()
{
Debug.unityLogger.Log("开启子线程");
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
......@@ -45,6 +52,8 @@ public class AdDemo : MonoBehaviour
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
//loadThread.Start();
}
public void onAdVideoBarClick()
......
......@@ -2725,6 +2725,75 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1827600641}
m_CullTransparentMesh: 0
--- !u!1001 &2009802841
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_Name
value: HTTP
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1053be02c113a7a45adf322c929b0cb6, type: 3}
--- !u!1 &2016039772
GameObject:
m_ObjectHideFlags: 0
......
fileFormatVersion: 2
guid: cc252d57e0ba1ea4aa2b06748d9723c4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ae58d8c284a209045abaa81fcced6dc3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using UnityEngine;
public class YLBRewardAdUtil
{
private YLBRewardAdUtil() { }
private static readonly YLBRewardAdUtil singleInstance = new YLBRewardAdUtil();
public static YLBRewardAdUtil Instance
{
get
{
return singleInstance;
}
}
private YLBRewardAD rewardVideoAd = new YLBRewardAD();
/// <summary>
/// 加载缓存激励视频
/// </summary>
/// <param name="entity"></param>
/// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback)
{
rewardVideoAd.SetLoadListener(new RewardVideoAdLoadListener(this,entity,rewardVideoAd,callback));
rewardVideoAd.LoadAd(entity.codeId, entity.codeGroup);
}
/// <summary>
/// 播放缓存的激励视频
/// </summary>
/// <param name="entity"></param>
/// <param name="listener"></param>
/// <param name="callback"></param>
public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback)
{
//rewardVideoAd = GetRewardVideoAd(entity.codeGroup + entity.codeId);
if (rewardVideoAd != null)
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "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, "YLB NUll");
callback(false);
}
}
private sealed class RewardVideoAdLoadListener : IYLBRewardVideoAdLoadListener
{
private YLBRewardAdUtil adUtil;
private AdEntity entity;
private YLBRewardAD rewardVideo;
private Action<bool> callback;
public RewardVideoAdLoadListener(YLBRewardAdUtil adUtil,AdEntity entity, YLBRewardAD rewardVideo, Action<bool> callback)
{
this.adUtil = adUtil;
this.entity = entity;
this.rewardVideo = rewardVideo;
this.callback = callback;
}
public void onError(int code, string message)
{
Debug.unityLogger.Log(entity.codeId+" codeID " +entity.codeId+"YLB Error code" +code+"message"+message);
EventUtils.onEventPullFail(entity, code.ToString(),message);
callback(false);
}
public void onLoad()
{
EventUtils.onEventPullSuccess(entity);
//adUtil.SetRewardVideoAd(entity.codeGroup + entity.codeId, this.rewardVideo);
callback(true);
}
}
private sealed class RewardVideoAdListener : IYLBRewardVideoAdListener
{
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 onAdClick()
{
EventUtils.onEventAdClick(entity);
listener.onAdVideoBarClick();
}
public void onAdClose()
{
listener.onAdClose();
}
public void onAdShow()
{
callback(true);
EventUtils.onEventShowSuccess(entity);
listener.onAdShow();
}
public void onError(string message)
{
callback(false);
EventUtils.onEventShowFail(entity);
listener.onError(message);
}
public void onRewardVerify(bool rewardVerify, int rewardAmount, string rewardName)
{
}
public void onVideoComplete()
{
EventUtils.onEventAdComplete(entity);
listener.onSuccess();
}
}
/// <summary>
/// 激励视频缓存队列
/// </summary>
private Dictionary<string, Queue<YLBRewardAD>> mRewardCacheMap = new Dictionary<string, Queue<YLBRewardAD>>();
/// <summary>
/// 保存缓存的激励视频
/// </summary>
/// <param name="codeId"></param>
/// <param name="reward"></param>
private void SetRewardVideoAd(string codeId, YLBRewardAD reward)
{
if (codeId == null || codeId == "")
{
return;
}
Queue<YLBRewardAD> mRewardQueue;
if (mRewardCacheMap.ContainsKey(codeId))
{
mRewardQueue = mRewardCacheMap[codeId];
}
else
{
mRewardQueue = new Queue<YLBRewardAD>();
}
mRewardQueue.Enqueue(reward);
mRewardCacheMap[codeId] = mRewardQueue;
}
/// <summary>
/// 取出缓存的激励视频
/// </summary>
/// <param name="codeId"></param>
/// <returns></returns>
private YLBRewardAD GetRewardVideoAd(string codeId)
{
if (mRewardCacheMap.ContainsKey(codeId))
{
Queue<YLBRewardAD> mRewardQueue = mRewardCacheMap[codeId];
if (mRewardQueue != null && mRewardQueue.Count > 0)
{
return mRewardQueue.Dequeue();
}
}
return null;
}
}
fileFormatVersion: 2
guid: dd79deddeb67dd744969200b97192550
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2a74dfbfd6ab1104b96a7c8bddfd8060
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IYLBRewardVideoAdListener
{
void onAdShow();
void onAdClick();
void onAdClose();
void onVideoComplete();
void onRewardVerify(bool rewardVerify, int rewardAmount, string rewardName);
void onError(string message);
}
fileFormatVersion: 2
guid: a0aea5458fa272143baad6e6630ccfd5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IYLBRewardVideoAdLoadListener
{
void onLoad();
void onError(int code, string message);
}
fileFormatVersion: 2
guid: a9c30b28caaa94d479f060bffc1eb53c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1af305d9b2f863343a1a770cdbe6726e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: eb26d577169b4d04ba1971e414dbab86
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b5288514edf3efe4897ee5d665f4a65e
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.ylb;
import android.app.Activity;
import android.util.Log;
import com.wannuosili.sdk.WNAdConstant;
import com.wannuosili.sdk.WNAdSdk;
import com.wannuosili.sdk.WNAdSlot;
import com.wannuosili.sdk.WNRewardVideoAd;
import java.util.HashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
public class YLBManager {
public void loadRewardAd(String codeId,String codeGroup, YLBRewardVideoAdLoadListener listener){
WNAdSlot slot = new WNAdSlot.Builder()
.setSlotId(codeId)
.setOrientation(WNAdConstant.REWARD_VIDEO_AD_PORTRAIT)
.build();
WNAdSdk.getAdManager().loadRewardVideoAd(slot, new WNRewardVideoAd.RewardVideoAdListener() {
@Override
public void onError(int code, String message) {
listener.onError(code,message);
}
@Override
public void onLoad(WNRewardVideoAd ad) {
setRewardVideo(codeGroup+codeId,ad);
listener.onLoad();
}
});
}
public void playRewardAd(Activity activity,String codeId,String codeGroup,YLBRewardVideoAdListener listener){
WNRewardVideoAd rewardVideoAd = getRewardVideo(codeGroup+codeId);
if (rewardVideoAd!=null){
Log.d("wxw","获取的成功"+codeId+"rewardVideoAd"+rewardVideoAd.getId());
rewardVideoAd.setInteractionListener(new WNRewardVideoAd.InteractionListener() {
@Override
public void onAdShow() {
listener.onAdShow();
}
@Override
public void onAdClick() {
listener.onAdClick();
}
@Override
public void onAdClose() {
listener.onAdClose();
}
@Override
public void onVideoComplete() {
listener.onVideoComplete();
}
/**
* 此方法在激励视频广告完播后触发,rewardVerify默认为true,如果接入方使用了
* 服务端奖励验证回调功能,rewardVerify由接入方控制,为接入方在优量宝控制台
* 配置的回调链接返回的判定结果
*
* @param rewardVerify 是否发放奖励,默认为true
* @param rewardAmount 优量宝控制台配置的奖励数量,比如100,默认为0
* @param rewardName 优量宝控制台配置的奖励名称,比如游戏币, 默认为空字符串
*/
@Override
public void onRewardVerify(boolean rewardVerify, int rewardAmount, String rewardName) {
listener.onRewardVerify(rewardVerify,rewardAmount,rewardName);
}
});
rewardVideoAd.showRewardVideoAd(activity);
}else {
Log.d("wxw","获取的失败"+codeId);
listener.onError("广告对象为NULL");
}
}
private HashMap<String, WNRewardVideoAd> mRewardCacheMap = new HashMap<>();
private void setRewardVideo(String codeId, WNRewardVideoAd rewardAD) {
Log.d("wxw","存的"+codeId);
mRewardCacheMap.put(codeId,rewardAD);
}
private WNRewardVideoAd getRewardVideo(String codeId){
Log.d("wxw","获取的"+codeId);
return mRewardCacheMap.get(codeId);
}
}
fileFormatVersion: 2
guid: 70c23a5941494824e8fd32e2475ad469
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 Tencent.GDT;
using UnityEngine;
public class YLBRewardAD
{
/**激励视频**/
private AndroidJavaObject rewardVideoAd = new AndroidJavaObject("com.ym.admodule.ylb.YLBManager");
private YLBRewardVideoAdListenerProxy listenerProxy = new YLBRewardVideoAdListenerProxy();
private YLBRewardVideoAdLoadListenerProxy listenerLoadProxy = new YLBRewardVideoAdLoadListenerProxy();
public void SetLoadListener(IYLBRewardVideoAdLoadListener listener)
{
listenerLoadProxy.listener = listener;
}
public void SetPlayListener(IYLBRewardVideoAdListener 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);
//}
this.rewardVideoAd.Call("loadRewardAd", codeId, codeGroup, 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);
//}
this.rewardVideoAd.Call("playRewardAd", Utils.GetActivity(), codeId, codeGroup, listenerProxy);
}
}
fileFormatVersion: 2
guid: e04b04cee957cb54d9c6535d1c2a22fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.ylb;
public interface YLBRewardVideoAdListener {
void onAdShow();
void onAdClick();
void onAdClose();
void onVideoComplete();
void onRewardVerify(Boolean rewardVerify, int rewardAmount, String rewardName);
void onError(String message);
}
fileFormatVersion: 2
guid: 75414fbd30d19fa49a592bc18521d981
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 YLBRewardVideoAdListenerProxy : AndroidJavaProxy
{
internal IYLBRewardVideoAdListener listener = null;
public YLBRewardVideoAdListenerProxy() : base("com.ym.admodule.ylb.YLBRewardVideoAdListener") { }
public void onAdShow()
{
if (listener == null)
{
return;
}
listener.onAdShow();
}
public void onAdClick()
{
if (listener == null)
{
return;
}
listener.onAdClick();
}
public void onAdClose()
{
if (listener == null)
{
return;
}
listener.onAdClose();
}
public void onVideoComplete()
{
if (listener == null)
{
return;
}
listener.onVideoComplete();
}
public void onRewardVerify(bool rewardVerify, int rewardAmount, string rewardName)
{
if (listener == null)
{
return;
}
listener.onRewardVerify(rewardVerify, rewardAmount, rewardName);
}
public void onError(string message)
{
if (listener == null)
{
return;
}
listener.onError(message);
}
}
#endif
\ No newline at end of file
fileFormatVersion: 2
guid: 26aeed38acee27546aed26df4ead131b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
package com.ym.admodule.ylb;
public interface YLBRewardVideoAdLoadListener {
void onError(int code, String message);
void onLoad();
}
fileFormatVersion: 2
guid: e3294c8301100d649b95c68178104544
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 YLBRewardVideoAdLoadListenerProxy : AndroidJavaProxy
{
internal IYLBRewardVideoAdLoadListener listener = null;
public YLBRewardVideoAdLoadListenerProxy() : base("com.ym.admodule.ylb.YLBRewardVideoAdLoadListener") { }
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: 25064f55534f5f145bed9fdf22541e25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -19,6 +19,10 @@ public class HttpTool : MonoBehaviour
public bool IsShowLog = false;
private static string HttpLogTag = "UnityHttp";
private string appLs = "1d8a0d53c33a9b95";
public string appkey = "faba1d018f76086";
private static HttpTool _instacne = null;
private string TEST_BASE_GAEM_URL = "http://feedapitest.zhangxinhulian.com/";//测试游戏域名
......@@ -318,9 +322,6 @@ public class HttpTool : MonoBehaviour
}
public string appLs = "1d8a0d53c33a9b95";
public string appkey = "faba1d018f76086";
private string addParams(Dictionary<string, object> request)
{
if (request == null)
......
......@@ -50,3 +50,5 @@
-keep class com.bytedance.android.IntersititialView {*;}
-keep class com.bytedance.android.BannerView {*;}
-keep class com.wannuosili.sdk.** {*;}
-dontwarn com.wannuosili.sdk.**
\ No newline at end of file
......@@ -14,10 +14,10 @@ EditorBuildSettings:
- enabled: 0
path: Assets/Game/Splash/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 0
- enabled: 1
path: Assets/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 1
- enabled: 0
path: Assets/NetWork/Demo/HttpDemo.unity
guid: 1d254830c8b62484bb74d303cbb2cc3d
m_configObjects: {}
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