Commit 5f9c0410 authored by 王雪伟's avatar 王雪伟

加入Loading

parent e9460770
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;
}
}
...@@ -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,7 +1129,8 @@ public class AdManager ...@@ -1130,7 +1129,8 @@ public class AdManager
totalEntityList.RemoveAt(0); totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA);
} }
else
{
ADLoading.Instance().loadFailCount++; ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2) if (ADLoading.Instance().loadFailCount == 2)
...@@ -1138,6 +1138,9 @@ public class AdManager ...@@ -1138,6 +1138,9 @@ public class AdManager
ADLoading.Instance().HideADLoading(); ADLoading.Instance().HideADLoading();
} }
} }
}
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频");
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA);
...@@ -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,7 +1186,8 @@ public class AdManager ...@@ -1183,7 +1186,8 @@ public class AdManager
totalEntityList.RemoveAt(0); totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB);
} }
else
{
ADLoading.Instance().loadFailCount++; ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2) if (ADLoading.Instance().loadFailCount == 2)
...@@ -1191,6 +1195,9 @@ public class AdManager ...@@ -1191,6 +1195,9 @@ public class AdManager
ADLoading.Instance().HideADLoading(); ADLoading.Instance().HideADLoading();
} }
} }
}
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频");
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB); mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB);
...@@ -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");
......
...@@ -222,7 +222,10 @@ public class CSJSplshADUtils ...@@ -222,7 +222,10 @@ public class CSJSplshADUtils
EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
//listener.onAdSkip(); //listener.onAdSkip();
Debug.Log("splash Ad OnAdSkip"); Debug.Log("splash Ad OnAdSkip");
#if UNITY_ANDROID
DestorySplash(); DestorySplash();
#endif
} }
/// <summary> /// <summary>
...@@ -231,7 +234,9 @@ public class CSJSplshADUtils ...@@ -231,7 +234,9 @@ public class CSJSplshADUtils
public void OnAdTimeOver() public void OnAdTimeOver()
{ {
Debug.Log("splash Ad OnAdTimeOver"); Debug.Log("splash Ad OnAdTimeOver");
#if UNITY_ANDROID
DestorySplash(); DestorySplash();
#endif
} }
public void OnAdClose() public void OnAdClose()
......
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,6 +49,9 @@ public class KsUnityFeedAd { ...@@ -49,6 +49,9 @@ public class KsUnityFeedAd {
public void ShowFeedAd(Activity activity, KsUnityFeedShowListener listener) { public void ShowFeedAd(Activity activity, KsUnityFeedShowListener listener) {
if (feedAd != null) { if (feedAd != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
feedAd.setAdInteractionListener(new KsFeedAd.AdInteractionListener() { feedAd.setAdInteractionListener(new KsFeedAd.AdInteractionListener() {
@Override @Override
public void onAdClicked() { public void onAdClicked() {
...@@ -80,6 +83,8 @@ public class KsUnityFeedAd { ...@@ -80,6 +83,8 @@ public class KsUnityFeedAd {
root.addView(feedlinearLayout); root.addView(feedlinearLayout);
} }
} }
}
});
} else { } else {
listener.onShowError(-1, "没有大图广告数据"); listener.onShowError(-1, "没有大图广告数据");
} }
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 96eabe63e0a424642a928c97daa31a5f guid: a7e20345cf807564fbfb4c3d2779e72f
MonoImporter: folderAsset: yes
DefaultImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
...@@ -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
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"com.unity.modules.animation": "1.0.0", "com.unity.modules.animation": "1.0.0",
"com.unity.modules.uielements": "1.0.0" "com.unity.modules.uielements": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.common": { "com.unity.2d.common": {
"version": "2.1.0", "version": "2.1.0",
...@@ -21,21 +21,21 @@ ...@@ -21,21 +21,21 @@
"com.unity.2d.sprite": "1.0.0", "com.unity.2d.sprite": "1.0.0",
"com.unity.modules.uielements": "1.0.0" "com.unity.modules.uielements": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.path": { "com.unity.2d.path": {
"version": "2.1.0", "version": "2.1.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.pixel-perfect": { "com.unity.2d.pixel-perfect": {
"version": "2.1.0", "version": "2.1.0",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.psdimporter": { "com.unity.2d.psdimporter": {
"version": "2.1.6", "version": "2.1.6",
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
"com.unity.2d.animation": "3.2.5", "com.unity.2d.animation": "3.2.5",
"com.unity.2d.sprite": "1.0.0" "com.unity.2d.sprite": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.sprite": { "com.unity.2d.sprite": {
"version": "1.0.0", "version": "1.0.0",
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
"com.unity.2d.common": "2.0.2", "com.unity.2d.common": "2.0.2",
"com.unity.2d.path": "2.0.6" "com.unity.2d.path": "2.0.6"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.2d.tilemap": { "com.unity.2d.tilemap": {
"version": "1.0.0", "version": "1.0.0",
...@@ -76,14 +76,14 @@ ...@@ -76,14 +76,14 @@
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.6", "version": "1.0.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ide.rider": { "com.unity.ide.rider": {
"version": "1.1.4", "version": "1.1.4",
...@@ -92,28 +92,28 @@ ...@@ -92,28 +92,28 @@
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.1" "com.unity.test-framework": "1.1.1"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ide.vscode": { "com.unity.ide.vscode": {
"version": "1.2.3", "version": "1.2.3",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.mathematics": { "com.unity.mathematics": {
"version": "1.1.0", "version": "1.1.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.mobile.android-logcat": { "com.unity.mobile.android-logcat": {
"version": "1.2.1", "version": "1.2.1",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.mobile.notifications": { "com.unity.mobile.notifications": {
"version": "1.3.2", "version": "1.3.2",
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
"dependencies": { "dependencies": {
"com.unity.modules.androidjni": "1.0.0" "com.unity.modules.androidjni": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.22", "version": "1.1.22",
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.textmeshpro": { "com.unity.textmeshpro": {
"version": "2.1.3", "version": "2.1.3",
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.2.18", "version": "1.2.18",
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
"com.unity.modules.audio": "1.0.0", "com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0" "com.unity.modules.particlesystem": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.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