Commit 4f37171d authored by zhangzhe's avatar zhangzhe

处理冲突

parents fde19213 5f9c0410
This diff is collapsed.
fileFormatVersion: 2
guid: 19cb369d889b04755a0562447e6cdc2e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonoBaseMgr<T> : MonoBehaviour where T:MonoBehaviour
{
private static T instance;
public static T Getinstance()
{
if (instance==null)
{
GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
instance = obj.AddComponent<T>();
DontDestroyOnLoad(obj);
}
return instance;
}
public static T GetInstance()
{
if (instance == null)
{
GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
instance = obj.AddComponent<T>();
DontDestroyOnLoad(obj);
}
return instance;
}
public static T Instance()
{
if (instance == null)
{
GameObject obj = new GameObject(typeof(T).ToString() + "Scripts");
instance = obj.AddComponent<T>();
DontDestroyOnLoad(obj);
}
return instance;
}
}
fileFormatVersion: 2
guid: e8de3608ab9494f819f3c11756db1eff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class MonoMgr : MonoBaseMgr<MonoMgr>
{
public UnityAction func;
void Update()
{
func?.Invoke();
}
public void AddUpdateListener(UnityAction func)
{
this.func += func;
}
public void RemoveUpdateListener(UnityAction func)
{
this.func -= func;
}
}
fileFormatVersion: 2
guid: 96eabe63e0a424642a928c97daa31a5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -109,12 +109,10 @@ public class AdManager ...@@ -109,12 +109,10 @@ public class AdManager
#endif #endif
break; break;
case ZXADConfig.PLANTFORM_AD_KUS: 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); KsAdSDK.InitKsAdSDK(id.codeAppId,Application.identifier);
} }
#endif
break; break;
default: default:
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持初始化" + id.adPlatform + "的广告"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "不支持初始化" + id.adPlatform + "的广告");
...@@ -1116,9 +1114,10 @@ public class AdManager ...@@ -1116,9 +1114,10 @@ public class AdManager
if (ADLoading.isShowing) if (ADLoading.isShowing)
{ {
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading(); ADLoading.Instance().HideADLoading();
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
} }
} }
else else
...@@ -1130,13 +1129,17 @@ public class AdManager ...@@ -1130,13 +1129,17 @@ public class AdManager
totalEntityList.RemoveAt(0); totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA);
} }
else
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{ {
ADLoading.Instance().HideADLoading(); ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
}
} }
} }
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频");
...@@ -1169,9 +1172,9 @@ public class AdManager ...@@ -1169,9 +1172,9 @@ public class AdManager
if (ADLoading.isShowing) if (ADLoading.isShowing)
{ {
ADLoading.Instance().HideADLoading();
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener); PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading();
} }
} }
else else
...@@ -1183,13 +1186,17 @@ public class AdManager ...@@ -1183,13 +1186,17 @@ public class AdManager
totalEntityList.RemoveAt(0); totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB);
} }
else
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{ {
ADLoading.Instance().HideADLoading(); ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
}
} }
} }
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频");
...@@ -1244,6 +1251,9 @@ public class AdManager ...@@ -1244,6 +1251,9 @@ public class AdManager
/// <param name="listener">广告回调</param> /// <param name="listener">广告回调</param>
public void PlayCacheRewardVideoAd(string slotName, string actionName, ZXADRewardVideoListener listener) public void PlayCacheRewardVideoAd(string slotName, string actionName, ZXADRewardVideoListener listener)
{ {
Debug.unityLogger.Log("1PlayCacheRewardVideoAd");
Debug.unityLogger.Log("2PlayCacheRewardVideoAd"+ slotName);
AdEntity entity = null; AdEntity entity = null;
AdEntity entityA = ZXADConfig.Instance.GetAdCache(slotName, "A"); AdEntity entityA = ZXADConfig.Instance.GetAdCache(slotName, "A");
......
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()
{
}
}
}
fileFormatVersion: 2
guid: 7254c6703a47f6f438d80ec0dc944695
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -49,37 +49,42 @@ public class KsUnityFeedAd { ...@@ -49,37 +49,42 @@ public class KsUnityFeedAd {
public void ShowFeedAd(Activity activity, KsUnityFeedShowListener listener) { public void ShowFeedAd(Activity activity, KsUnityFeedShowListener listener) {
if (feedAd != null) { if (feedAd != null) {
feedAd.setAdInteractionListener(new KsFeedAd.AdInteractionListener() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void onAdClicked() { public void run() {
listener.onAdClicked(); feedAd.setAdInteractionListener(new KsFeedAd.AdInteractionListener() {
} @Override
public void onAdClicked() {
listener.onAdClicked();
}
@Override @Override
public void onAdShow() { public void onAdShow() {
listener.onAdShow(); listener.onAdShow();
} }
@Override @Override
public void onDislikeClicked() { public void onDislikeClicked() {
removeAdView(activity, feedlinearLayout); removeAdView(activity, feedlinearLayout);
listener.onDislikeClicked(); 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 { } else {
listener.onShowError(-1, "没有大图广告数据"); listener.onShowError(-1, "没有大图广告数据");
} }
......
...@@ -192,7 +192,7 @@ MonoBehaviour: ...@@ -192,7 +192,7 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 4283400949935885017} - m_Target: {fileID: 0}
m_MethodName: HideADLoading m_MethodName: HideADLoading
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
...@@ -215,7 +215,6 @@ GameObject: ...@@ -215,7 +215,6 @@ GameObject:
- component: {fileID: 7874596718903047866} - component: {fileID: 7874596718903047866}
- component: {fileID: 7874596718903047867} - component: {fileID: 7874596718903047867}
- component: {fileID: 7874596718903047812} - component: {fileID: 7874596718903047812}
- component: {fileID: 4283400949935885017}
m_Layer: 5 m_Layer: 5
m_Name: ADLoading m_Name: ADLoading
m_TagString: Untagged m_TagString: Untagged
...@@ -304,22 +303,6 @@ MonoBehaviour: ...@@ -304,22 +303,6 @@ MonoBehaviour:
m_BlockingMask: m_BlockingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
--- !u!114 &4283400949935885017
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7874596718903047813}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b8e186fde1a424d898d035bae5a45073, type: 3}
m_Name:
m_EditorClassIdentifier:
isShowing: 0
adSlotName:
adActionName:
loadFailCount: 0
--- !u!1 &7874596720360528070 --- !u!1 &7874596720360528070
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -39,6 +39,7 @@ GraphicsSettings: ...@@ -39,6 +39,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 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