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:
......@@ -109,7 +109,7 @@ public class AdManager
#endif
break;
case ZXADConfig.PLANTFORM_AD_KUS:
if (id.codeAppId != null && id.codeAppId != "")
if (id.codeAppId != null && id.codeAppId != "")
{
KsAdSDK.InitKsAdSDK(id.codeAppId,Application.identifier);
}
......@@ -1075,6 +1075,11 @@ public class AdManager
}), new Action<string, string>((code, errMsg) =>
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频请求失败" + errMsg);
if (ADLoading.isShowing)
{
ADLoading.Instance().HideADLoading();
}
}));
}
......@@ -1106,6 +1111,14 @@ public class AdManager
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组缓存成功 " + entity.adPlatform + " CodeID " + entity.codeId);
ZXADConfig.Instance.SetAdCache(sloatName, bl, "A");
if (ADLoading.isShowing)
{
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading();
}
}
else
{
......@@ -1116,6 +1129,17 @@ public class AdManager
totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackA);
}
else
{
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
}
}
}
});
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "A开始缓存激励视频");
......@@ -1145,6 +1169,13 @@ public class AdManager
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频B组缓存成功 " + bl.adPlatform + " CodeID " + bl.codeId);
ZXADConfig.Instance.SetAdCache(sloatName, bl, "B");
if (ADLoading.isShowing)
{
PlayCacheRewardVideoAd(ADLoading.adSlotName, ADLoading.adActionName, ADLoading.adListener);
ADLoading.Instance().HideADLoading();
}
}
else
{
......@@ -1155,6 +1186,17 @@ public class AdManager
totalEntityList.RemoveAt(0);
mLoadRewardVideoAdPlatform(entity, rewardVideoAdCallBackB);
}
else
{
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
}
}
}
});
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "B开始缓存激励视频");
......@@ -1209,6 +1251,9 @@ public class AdManager
/// <param name="listener">广告回调</param>
public void PlayCacheRewardVideoAd(string slotName, string actionName, ZXADRewardVideoListener listener)
{
Debug.unityLogger.Log("1PlayCacheRewardVideoAd");
Debug.unityLogger.Log("2PlayCacheRewardVideoAd"+ slotName);
AdEntity entity = null;
AdEntity entityA = ZXADConfig.Instance.GetAdCache(slotName, "A");
......@@ -1279,6 +1324,8 @@ public class AdManager
{
listener.onError("播放激励视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放激励视频失败 缓存的信息为null");
ADLoading.Instance().ShowADLoading(slotName, actionName, listener);
LoadCacheRewardVideoAd(slotName);
}
}
......
......@@ -14,8 +14,8 @@ public class ZXADConfig
}
}
public const int ZXAD_VC = 134;
public const string ZXAD_VN = "1.3.4";
public const int ZXAD_VC = 135;
public const string ZXAD_VN = "1.3.5";
public const string ADManagerTAG = "AdManager";
public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲
......
......@@ -222,7 +222,10 @@ public class CSJSplshADUtils
EventUtils.onEventAdComplete(entity);
//listener.onAdSkip();
Debug.Log("splash Ad OnAdSkip");
#if UNITY_ANDROID
DestorySplash();
#endif
}
/// <summary>
......@@ -231,7 +234,9 @@ public class CSJSplshADUtils
public void OnAdTimeOver()
{
Debug.Log("splash Ad OnAdTimeOver");
#if UNITY_ANDROID
DestorySplash();
#endif
}
public void OnAdClose()
......
......@@ -18,7 +18,7 @@ public class AdDemo : MonoBehaviour
private void Awake()
{ //AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
}
private void Start()
{
......
......@@ -5,11 +5,8 @@ PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
......
......@@ -7,7 +7,6 @@ public class KsAdSDK
{
public static void InitKsAdSDK(string AppId, string AppName)
{
Debug.unityLogger.Log("快手Appid"+AppId+ "AppName"+ AppName);
#if UNITY_ANDROID&&!UNITY_EDITOR
AndroidJavaClass splashAd = new AndroidJavaClass("com.ym.unitykssdk.KsAdSDKInitUtil");
splashAd.CallStatic("initSDK", Utils.GetActivity(), AppId, AppName);
......
......@@ -15,40 +15,40 @@ using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
//using UnityEditor.iOS.Xcode;
using UnityEditor.iOS.Xcode;
public class BuildPostProcessor
{
//[PostProcessBuildAttribute(1)]
//public static void OnPostProcessBuild(BuildTarget target, string path)
//{
// if (target == BuildTarget.iOS)
// {
// // Read.
// string projectPath = PBXProject.GetPBXProjectPath(path);
// PBXProject project = new PBXProject();
// project.ReadFromString(File.ReadAllText(projectPath));
// string targetName = project.GetUnityMainTargetGuid();
// string targetGUID = project.TargetGuidByName(targetName);
[PostProcessBuildAttribute(1)]
public static void OnPostProcessBuild(BuildTarget target, string path)
{
if (target == BuildTarget.iOS)
{
// Read.
string projectPath = PBXProject.GetPBXProjectPath(path);
PBXProject project = new PBXProject();
project.ReadFromString(File.ReadAllText(projectPath));
string targetName = project.GetUnityMainTargetGuid();
string targetGUID = project.TargetGuidByName(targetName);
// AddFrameworks(project, targetGUID);
AddFrameworks(project, targetGUID);
// // Write.
// File.WriteAllText(projectPath, project.WriteToString());
// }
//}
// Write.
File.WriteAllText(projectPath, project.WriteToString());
}
}
//static void AddFrameworks(PBXProject project, string targetGUID)
//{
// // Frameworks
static void AddFrameworks(PBXProject project, string targetGUID)
{
// Frameworks
// project.AddFrameworkToProject(targetGUID, "libz.dylib", false);
// project.AddFrameworkToProject(targetGUID, "libsqlite3.tbd", false);
// project.AddFrameworkToProject(targetGUID, "CoreTelephony.framework", false);
project.AddFrameworkToProject(targetGUID, "libz.dylib", false);
project.AddFrameworkToProject(targetGUID, "libsqlite3.tbd", 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:
- target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_IsActive
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
......@@ -131,7 +131,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0.3
bundleVersion: 7.0.1
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
......@@ -177,7 +177,7 @@ PlayerSettings:
applicationIdentifier:
Android: com.ym.fkqcw
buildNumber: {}
AndroidBundleVersionCode: 4
AndroidBundleVersionCode: 701
AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 0
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