Commit 05dc1a60 authored by zxhljwl's avatar zxhljwl

更新广告sdk

parent 168676ea
fileFormatVersion: 2
guid: c7895a97019184bc5ae692e9fcb88337
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class ADLoading : MonoBehaviour
{
/// <summary>
/// 是否正在显示中
/// </summary>
public static bool isShowing;
// 播放要记录的参数
public static string adSlotName;
public static string adActionName;
public static ZXADRewardVideoListener adListener;
/// <summary>
/// 加载失败的次数
/// A组或B组视频加载失败, 都加载失败时要隐藏加载框
/// 每次隐藏加载框时都重置此变量
/// </summary>
public int loadFailCount;
/// <summary>
/// 加载动画GameObject
/// </summary>
private static GameObject ADLoadingGameObject;
/// <summary>
/// 加载图片
/// </summary>
private Transform LoadingImage;
private static ADLoading instance;
public static ADLoading Instance()
{
if (instance == null)
{
GameObject obj = new GameObject();
// 设置对象名字为脚本名
obj.name = typeof(ADLoading).ToString();
// 让这个单例模式对象 切换场景不移除
DontDestroyOnLoad(obj);
instance = obj.AddComponent<ADLoading>();
}
return instance;
}
private void Start()
{
InitSubviews();
}
private void Update()
{
if (LoadingImage != null)
{
LoadingImage.Rotate(-Vector3.forward * Time.deltaTime * 250);
}
}
/// <summary>
/// 初始化控件
/// </summary>
private void InitSubviews()
{
}
/// <summary>
/// 显示广告加载图
/// </summary>
public void ShowADLoading(string slotName, string actionName, ZXADRewardVideoListener listener)
{
if (!isShowing)
{
GameObject prefab = Resources.Load<GameObject>("ADLoading/ADLoading");
GameObject ADLoading = Instantiate(prefab, Camera.main.transform.parent);
ADLoading.name = "ADLoading";
isShowing = true;
adSlotName = slotName;
adActionName = actionName;
adListener = listener;
ADLoadingGameObject = ADLoading;
LoadingImage = ADLoading.transform.Find("BgImage/LoadingImage");
Text loadText = ADLoading.transform.Find("BgImage/Text").GetComponent<Text>();
StartCoroutine(PlayAnimator(loadText));
}
}
IEnumerator PlayAnimator(Text loadText)
{
int num = 1;
while (loadText != null)
{
loadText.text = "正在加载视频\n请稍后";
for (int i = 0; i < num; i++)
{
loadText.text = loadText.text + ".";
}
num++;
if (num == 4)
{
num = 1;
}
yield return new WaitForSeconds(0.8f);
}
}
public void HideADLoading()
{
isShowing = false;
adSlotName = null;
adActionName = null;
adListener = null;
loadFailCount = 0;
Destroy(ADLoadingGameObject);
}
}
fileFormatVersion: 2
guid: b8e186fde1a424d898d035bae5a45073
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6720d104380e0437080431c470e702ef
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:
fileFormatVersion: 2
guid: f1ac1b402258d4239b87a3e36be36bac
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:
...@@ -1075,6 +1075,11 @@ public class AdManager ...@@ -1075,6 +1075,11 @@ public class AdManager
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频请求失败" + errMsg); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频请求失败" + errMsg);
if (ADLoading.isShowing)
{
ADLoading.Instance().HideADLoading();
}
})); }));
} }
...@@ -1106,6 +1111,14 @@ public class AdManager ...@@ -1106,6 +1111,14 @@ public class AdManager
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组缓存成功 " + entity.adPlatform + " CodeID " + entity.codeId); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组缓存成功 " + entity.adPlatform + " CodeID " + entity.codeId);
ZXADConfig.Instance.SetAdCache(sloatName, bl, "A"); ZXADConfig.Instance.SetAdCache(sloatName, bl, "A");
if (ADLoading.isShowing)
{
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading();
}
} }
else else
{ {
...@@ -1116,6 +1129,17 @@ public class AdManager ...@@ -1116,6 +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();
}
}
} }
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频");
...@@ -1145,6 +1169,13 @@ public class AdManager ...@@ -1145,6 +1169,13 @@ public class AdManager
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频B组缓存成功 " + bl.adPlatform + " CodeID " + bl.codeId); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频B组缓存成功 " + bl.adPlatform + " CodeID " + bl.codeId);
ZXADConfig.Instance.SetAdCache(sloatName, bl, "B"); ZXADConfig.Instance.SetAdCache(sloatName, bl, "B");
if (ADLoading.isShowing)
{
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading();
}
} }
else else
{ {
...@@ -1155,6 +1186,17 @@ public class AdManager ...@@ -1155,6 +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();
}
}
} }
}); });
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频");
...@@ -1209,6 +1251,9 @@ public class AdManager ...@@ -1209,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");
...@@ -1279,6 +1324,8 @@ public class AdManager ...@@ -1279,6 +1324,8 @@ public class AdManager
{ {
listener.onError("播放激励视频失败 缓存的信息为null"); listener.onError("播放激励视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放激励视频失败 缓存的信息为null"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放激励视频失败 缓存的信息为null");
ADLoading.Instance().ShowADLoading(slotName, actionName, listener);
LoadCacheRewardVideoAd(slotName); LoadCacheRewardVideoAd(slotName);
} }
} }
......
...@@ -14,8 +14,8 @@ public class ZXADConfig ...@@ -14,8 +14,8 @@ public class ZXADConfig
} }
} }
public const int ZXAD_VC = 134; public const int ZXAD_VC = 135;
public const string ZXAD_VN = "1.3.4"; public const string ZXAD_VN = "1.3.5";
public const string ADManagerTAG = "AdManager"; public const string ADManagerTAG = "AdManager";
public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲 public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲
......
...@@ -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()
......
...@@ -5,11 +5,8 @@ PluginImporter: ...@@ -5,11 +5,8 @@ PluginImporter:
serializedVersion: 2 serializedVersion: 2
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData: platformData:
- first: - first:
Any: Any:
......
...@@ -7,7 +7,6 @@ public class KsAdSDK ...@@ -7,7 +7,6 @@ public class KsAdSDK
{ {
public static void InitKsAdSDK(string AppId, string AppName) public static void InitKsAdSDK(string AppId, string AppName)
{ {
Debug.unityLogger.Log("快手Appid"+AppId+ "AppName"+ AppName);
#if UNITY_ANDROID&&!UNITY_EDITOR #if UNITY_ANDROID&&!UNITY_EDITOR
AndroidJavaClass splashAd = new AndroidJavaClass("com.ym.unitykssdk.KsAdSDKInitUtil"); AndroidJavaClass splashAd = new AndroidJavaClass("com.ym.unitykssdk.KsAdSDKInitUtil");
splashAd.CallStatic("initSDK", Utils.GetActivity(), AppId, AppName); splashAd.CallStatic("initSDK", Utils.GetActivity(), AppId, AppName);
......
...@@ -15,40 +15,40 @@ using System.IO; ...@@ -15,40 +15,40 @@ using System.IO;
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using UnityEditor.Callbacks; using UnityEditor.Callbacks;
//using UnityEditor.iOS.Xcode; using UnityEditor.iOS.Xcode;
public class BuildPostProcessor public class BuildPostProcessor
{ {
//[PostProcessBuildAttribute(1)] [PostProcessBuildAttribute(1)]
//public static void OnPostProcessBuild(BuildTarget target, string path) public static void OnPostProcessBuild(BuildTarget target, string path)
//{ {
// if (target == BuildTarget.iOS) if (target == BuildTarget.iOS)
// { {
// // Read. // Read.
// string projectPath = PBXProject.GetPBXProjectPath(path); string projectPath = PBXProject.GetPBXProjectPath(path);
// PBXProject project = new PBXProject(); PBXProject project = new PBXProject();
// project.ReadFromString(File.ReadAllText(projectPath)); project.ReadFromString(File.ReadAllText(projectPath));
// string targetName = project.GetUnityMainTargetGuid(); string targetName = project.GetUnityMainTargetGuid();
// string targetGUID = project.TargetGuidByName(targetName); string targetGUID = project.TargetGuidByName(targetName);
// AddFrameworks(project, targetGUID); AddFrameworks(project, targetGUID);
// // Write. // Write.
// File.WriteAllText(projectPath, project.WriteToString()); File.WriteAllText(projectPath, project.WriteToString());
// } }
//} }
//static void AddFrameworks(PBXProject project, string targetGUID) static void AddFrameworks(PBXProject project, string targetGUID)
//{ {
// // Frameworks // Frameworks
// project.AddFrameworkToProject(targetGUID, "libz.dylib", false); project.AddFrameworkToProject(targetGUID, "libz.dylib", false);
// project.AddFrameworkToProject(targetGUID, "libsqlite3.tbd", false); project.AddFrameworkToProject(targetGUID, "libsqlite3.tbd", false);
// project.AddFrameworkToProject(targetGUID, "CoreTelephony.framework", false); project.AddFrameworkToProject(targetGUID, "CoreTelephony.framework", false);
// } }
} }
\ No newline at end of file
fileFormatVersion: 2
guid: b4d9d86d996b243338be67e5b5ef90be
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a99917c380e234b12b80798e45c7a200
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: c4af3a9c54f1e4018b7e087fa4bff163
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -25992,7 +25992,7 @@ PrefabInstance: ...@@ -25992,7 +25992,7 @@ PrefabInstance:
- target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6, - target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6, - target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3} type: 3}
...@@ -131,7 +131,7 @@ PlayerSettings: ...@@ -131,7 +131,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.0.3 bundleVersion: 7.0.1
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
...@@ -177,7 +177,7 @@ PlayerSettings: ...@@ -177,7 +177,7 @@ PlayerSettings:
applicationIdentifier: applicationIdentifier:
Android: com.ym.fkqcw Android: com.ym.fkqcw
buildNumber: {} buildNumber: {}
AndroidBundleVersionCode: 4 AndroidBundleVersionCode: 701
AndroidMinSdkVersion: 21 AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
......
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