Commit 0677490a authored by 王雪伟's avatar 王雪伟

提交全屏视频缓存

parents 0138655d c9dc7224
......@@ -60,8 +60,8 @@ public class AdManager
switch (id.adPlatform)
{
case ZXADConfig.PLANTFORM_AD_TT:
//穿山甲 初始化
AndroidJavaClass jc = new AndroidJavaClass("com.unity.adcommon.unity.TTADManager");
jc.CallStatic("init", id.codeAppId);
break;
case ZXADConfig.PLANTFORM_AD_GDT:
if (id.codeAppId != null && id.codeAppId != "")
......
......@@ -21,7 +21,7 @@ public final class UnionApplication extends Application {
public void onCreate() {
super.onCreate();
AppliContext.init(this);
AndroidConfig.init(this);
TTAdConfig config = new TTAdConfig.Builder()
//.appId("5001121")
......
......@@ -131,12 +131,12 @@ public class AdDemo : MonoBehaviour
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
//AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
=======
//AdManager.Instance.LoadCacheFSVideoAd();
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
public void OnClickPlayFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
=======
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
=======
//AdManager.Instance.LoadCacheFSVideoAd();
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
public void OnClickPlayFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
=======
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
//AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
//AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
package com.unity.adcommon.unity;
import android.content.Context;
import android.text.TextUtils;
......@@ -9,7 +8,7 @@ import android.text.TextUtils;
*/
public class AndroidConfig {
public static void init(Context context){
public static void init(){
new Thread(new Runnable() {
@Override
......
package com.unity.adcommon.unity;
import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.unity.adcommon.unity.AppliContext;
/**
* Created by erwin on 2021/3/4
*/
public class TTADManager {
public static void init(String codeId){
TTAdSdk.init(
AppliContext.get(),
new TTAdConfig.Builder()
.appId(codeId)
.useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.appName("test")
.titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowShowNotify(true) //是否允许sdk展示通知栏提示
.allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.debug(false) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.directDownloadNetworkType(
TTAdConstant.NETWORK_STATE_WIFI,
TTAdConstant.NETWORK_STATE_4G
) //允许直接下载的网络状态集合
.supportMultiProcess(false) //是否支持多进程,true支持
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
.build());
}
}
fileFormatVersion: 2
guid: 4798c949afa274f0a9db699552e85c6c
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: cbfc243b533794f4a9a553e3e085f2be
guid: 6059a3afdf4524361b404b10b417b6fd
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
using System.Collections;
using System.Linq;
using UnityEngine;
using UnityEngine.Android;
using UnityEngine.SceneManagement;
public class Splash : MonoBehaviour
{
private string[] strs = new string[] { "android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.READ_PHONE_STATE"};
/// <summary>
/// 请求权限
/// </summary>
private void Awake()
{
}
/// <summary>
/// 初始化
/// </summary>
void Start()
{
Debug.Log("初始化权限");
getPermission();
////初始化参数
var jc = new AndroidJavaClass("com.unity.adcommon.unity.AndroidConfig");
jc.CallStatic("init");
//Debug.Log("初始化广告");
AdManager.Instance.InitAd();
////加载开屏
//Debug.Log("加载开屏");
StartCoroutine(loadSplash());
}
private IEnumerator loadSplash()
{
yield return new WaitForSeconds(3f);
AdManager.Instance.LoadSplashAd(new SplshAdListener());
}
private sealed class SplshAdListener : ZXADSplashListener
{
public void onAdShow()
{
}
public void onAdSkip()
{
SceneManager.LoadScene("AdDemo");
}
public void onError(string errorMsg)
{
}
}
/// <summary>
/// 请求权限
/// </summary>
public void getPermission()
{
#if UNITY_ANDROID
strs.ToList().ForEach(s =>
{
if (!Permission.HasUserAuthorizedPermission(s))
{
Debug.Log(" 没有权限");
Permission.RequestUserPermission(s);
}
else
{
Debug.Log("有权限");
}
});
#elif UNITY_IOS
#endif
}
void Update()
{
}
}
fileFormatVersion: 2
guid: a0216ac2dce3146b9b699ced8c6e6f9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 37af8cf3fb373478ab04e3ee2f3b700a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9b0a6280e1ceb4d078d58336765bd98c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0c11df924e3c945ed929031cfa3296c6
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,16 +5,19 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 0
path: Assets/NetWork/Demo/HttpDemo.unity
guid: 1d254830c8b62484bb74d303cbb2cc3d
- enabled: 0
path: Assets/AD/CSJ/Example/Example.unity
guid: 1e4f8457b1266154e80399e42b932ceb
- enabled: 0
path: Assets/AD/GDT/UnionDemo/UnionExample.unity
guid: 6c963ae210fa3c3438c2f6770ee81fc9
- enabled: 1
path: Assets/Splash/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 1
path: Assets/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 1
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