升级SDK
This commit is contained in:
parent
8bc0e027ef
commit
be27e4c35a
|
@ -78,6 +78,58 @@ public class TKGSDKManager : TKGSingleton<TKGSDKManager>, ITKGSDK
|
|||
m_sdkInterface.HideBanner();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ShowNative
|
||||
/// </summary>
|
||||
/// <param name="pRect"></param>
|
||||
/// <param name="pAdPos"></param>
|
||||
/// <param name="pCam"></param>
|
||||
public void ShowNative(RectTransform pRect, string pAdPos, Camera pCam = null)
|
||||
{
|
||||
Vector3[] tWorldCorners = new Vector3[4];
|
||||
pRect.GetWorldCorners(tWorldCorners);
|
||||
|
||||
Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[1]);
|
||||
Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[3]);
|
||||
float tWidth = Mathf.Abs(tBottomRight.x - tTopLeft.x);
|
||||
float tHeight = Mathf.Abs(tBottomRight.y - tTopLeft.y);
|
||||
|
||||
if (IsNativeReady())
|
||||
{
|
||||
ShowNative(pAdPos, tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ShowNative
|
||||
/// </summary>
|
||||
/// <param name="nativePos"></param>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public void ShowNative(string nativePos, float x, float y, float width, float height)
|
||||
{
|
||||
m_sdkInterface.ShowNative(nativePos, x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HideNative
|
||||
/// </summary>
|
||||
public void HideNative()
|
||||
{
|
||||
m_sdkInterface.HideNative();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is Ready Native
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsNativeReady()
|
||||
{
|
||||
return m_sdkInterface.IsNativeReady();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play Interstitial Ad
|
||||
/// </summary>
|
||||
|
@ -145,7 +197,6 @@ public class TKGSDKManager : TKGSingleton<TKGSDKManager>, ITKGSDK
|
|||
{
|
||||
return m_sdkInterface.IsReadyRewardAd();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Log Event
|
||||
|
|
|
@ -194,9 +194,9 @@ public class TKGUtils
|
|||
AutoIntersititialManager.Instance.ActiveLogic(pActive);
|
||||
}
|
||||
|
||||
public static bool WillPlayInterstitial()
|
||||
public static bool WillPlayInterstitial(bool pNormalIV = true)
|
||||
{
|
||||
return ToukaInterstitialTimer.Instance.CanShow(ToukaSDKManager.IVType.IV1, true) && ToukaAdManager.Instance.IsReadyIntersitial();
|
||||
return ToukaInterstitialTimer.Instance.CanShow(pNormalIV ? ToukaSDKManager.IVType.IV1 : ToukaSDKManager.IVType.IV2, true) && ToukaAdManager.Instance.IsReadyIntersitial();
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -34,6 +34,28 @@ namespace Touka
|
|||
/// </summary>
|
||||
void HideBanner();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ShowNative
|
||||
/// </summary>
|
||||
/// <param name="nativePos"></param>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
void ShowNative(string nativePos, float x, float y, float width, float height);
|
||||
|
||||
/// <summary>
|
||||
/// HideNative
|
||||
/// </summary>
|
||||
void HideNative();
|
||||
|
||||
/// <summary>
|
||||
/// Is Ready Native
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsNativeReady();
|
||||
|
||||
/// <summary>
|
||||
/// Play Interstitial Ad
|
||||
/// </summary>
|
||||
|
|
|
@ -116,6 +116,44 @@ namespace Touka
|
|||
ToukaSDKManager.Instance.ShowOrHideBanner(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ShowNative
|
||||
/// </summary>
|
||||
/// <param name="nativePos"></param>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public void ShowNative(string nativePos, float x, float y, float width, float height)
|
||||
{
|
||||
#if UNITY_IOS
|
||||
ToukaAdManager.Instance.ShowNative(x, y, width, height, nativePos);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HideNative
|
||||
/// </summary>
|
||||
public void HideNative()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
ToukaAdManager.Instance.HideNative(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is Ready Native
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsNativeReady()
|
||||
{
|
||||
#if UNITY_IOS
|
||||
return ToukaAdManager.Instance.IsReadyNative;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play Interstitial Ad
|
||||
/// </summary>
|
||||
|
@ -156,11 +194,11 @@ namespace Touka
|
|||
return ToukaAdManager.Instance.IsReadyVideo;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Log Event
|
||||
#region Log Event
|
||||
|
||||
#region Normal
|
||||
#region Normal
|
||||
|
||||
/// <summary>
|
||||
/// Log Event
|
||||
|
@ -205,9 +243,9 @@ namespace Touka
|
|||
ToukaSDKManager.Instance.LogEventByUmeng(_eventSort, _eventDic);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Level Event
|
||||
#region Level Event
|
||||
|
||||
/// <summary>
|
||||
/// Notify game start
|
||||
|
@ -283,9 +321,9 @@ namespace Touka
|
|||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Reward Ad Button Show
|
||||
#region Reward Ad Button Show
|
||||
|
||||
/// <summary>
|
||||
/// Log Reward ad button show
|
||||
|
@ -296,9 +334,9 @@ namespace Touka
|
|||
ToukaSDKManager.Instance.LogEventByUmengAdShow(_pos);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Tracking Event
|
||||
#region Tracking Event
|
||||
|
||||
/// <summary>
|
||||
/// Log Tracking Event
|
||||
|
@ -309,11 +347,11 @@ namespace Touka
|
|||
ToukaAnalyticsManager.Instance.LogEvent(ToukaLogType.Tenjin, _eventType.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Online Config
|
||||
#region Online Config
|
||||
/// <summary>
|
||||
/// get config - string
|
||||
/// </summary>
|
||||
|
@ -361,9 +399,9 @@ namespace Touka
|
|||
return tIntValue != 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Others (common)
|
||||
#region Others (common)
|
||||
|
||||
/// <summary>
|
||||
/// review
|
||||
|
@ -412,6 +450,6 @@ namespace Touka
|
|||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
#if UNITY_IOS
|
||||
using UnityEditor.iOS.Xcode;
|
||||
#endif
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
|
@ -59,11 +59,13 @@ public partial class ToukaAdsBuildPostProcessor
|
|||
|
||||
plist.root.SetBoolean("ITSAppUsesNonExemptEncryption", false);
|
||||
|
||||
plist.root.SetString("kSDKShowAuthView", "1");
|
||||
|
||||
//NSAppTransportSecurity set yes
|
||||
PlistElementDict atf = plist.root["NSAppTransportSecurity"].AsDict();
|
||||
atf.SetBoolean("NSAllowsArbitraryLoads", true);
|
||||
|
||||
#region iOS 14
|
||||
#region iOS 14
|
||||
//SKAdnetwork追加
|
||||
PlistElementArray URLWhiteListArr2 = plist.root.CreateArray("SKAdNetworkItems");
|
||||
|
||||
|
@ -591,7 +593,7 @@ public partial class ToukaAdsBuildPostProcessor
|
|||
PlistElementDict dic126;
|
||||
dic126 = URLWhiteListArr2.AddDict();
|
||||
dic126.SetString("SKAdNetworkIdentifier", "pwdxu55a5a.skadnetwork");
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
PlistElementArray urlTypes = plist.root.CreateArray ("CFBundleURLTypes");
|
||||
|
||||
|
|
|
@ -31,19 +31,11 @@ namespace Touka
|
|||
s_instance = this;
|
||||
|
||||
}
|
||||
|
||||
public void RemoveNative()
|
||||
public void ShowNativeAd(string nativePos)
|
||||
{
|
||||
ToukaAdManager.Instance.HideNative(false);
|
||||
}
|
||||
|
||||
public void ShowNativeAd(string adpos)
|
||||
if (TKGSDKManager.Instance.IsNativeReady())
|
||||
{
|
||||
Debug.Log("yangwu " + GetX() + "y" + GetY() + "width" + GetWidth() + "hei" + GetWidth());
|
||||
if (ToukaAdManager.Instance.IsReadyNative)
|
||||
{
|
||||
|
||||
ToukaAdManager.Instance.ShowNative(GetX(), GetY(), GetWidth(), GetHeight(),adpos);
|
||||
TKGSDKManager.Instance.ShowNative(nativePos, GetX(), GetY(), GetWidth(), GetHeight());
|
||||
}
|
||||
}
|
||||
//由于loadnative 函数有个问题,比如多个位置多个不同尺寸的native。目前只能处理一个尺寸,所以设置了firstFlg,位置宽高得到一次即可。
|
||||
|
@ -78,14 +70,12 @@ namespace Touka
|
|||
{
|
||||
if (firstFlg)
|
||||
{
|
||||
if (uiCamera == null)
|
||||
{
|
||||
uiCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
|
||||
}
|
||||
Debug.Log("YANGWY " + uiCamera);
|
||||
Vector3 lefttop = uiCamera.WorldToScreenPoint(new Vector3(transform.position.x - GetComponent<RectTransform>().rect.size.x / 2 * transform.lossyScale.x, transform.position.y + GetComponent<RectTransform>().rect.size.y / 2 * transform.lossyScale.y, transform.position.z));
|
||||
Vector3 rightbottom = uiCamera.WorldToScreenPoint(new Vector3(transform.position.x + GetComponent<RectTransform>().rect.size.x / 2 * transform.lossyScale.x, transform.position.y - GetComponent<RectTransform>().rect.size.y / 2 * transform.lossyScale.y, transform.position.z));
|
||||
Vector3 picture_zero = uiCamera.WorldToScreenPoint(transform.position);
|
||||
|
||||
Vector3[] worldcorners = new Vector3[4];
|
||||
GetComponent<RectTransform>().GetWorldCorners(worldcorners);
|
||||
Vector3 lefttop = RectTransformUtility.WorldToScreenPoint(null, worldcorners[1]);
|
||||
Vector3 rightbottom = RectTransformUtility.WorldToScreenPoint(null, worldcorners[3]);
|
||||
Vector3 picture_zero = RectTransformUtility.WorldToScreenPoint(null, transform.position);
|
||||
float x = lefttop.x;
|
||||
float y = rightbottom.y;
|
||||
float width = rightbottom.x - lefttop.x;
|
||||
|
|
|
@ -11,10 +11,12 @@ namespace Touka
|
|||
|
||||
private TimerCounter t;
|
||||
private bool mIsActive = false;
|
||||
private int mRetryCount = 0;
|
||||
private const int MAX_RETRY = 10;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
mRetryCount = 0;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
|
@ -48,8 +50,13 @@ namespace Touka
|
|||
int autoShowIVSwitch = TKGSDKManager.Instance.GetConfigInt(ToukaInnerParamKey.Auto_Show_IVSwitch_OnlineParam.ToString(), 0);
|
||||
LogEvent();
|
||||
if (autoShowIVSwitch == 0)
|
||||
{
|
||||
Debug.Log("Check auto iv :" + autoShowIVSwitch);
|
||||
mRetryCount++;
|
||||
if (mRetryCount >= MAX_RETRY)
|
||||
{
|
||||
t.CancelTimer();
|
||||
}
|
||||
return;
|
||||
}
|
||||
//3.支持在线参数控制用户每次打开游戏,展示N次插屏后,才启用自动插屏逻辑,(若N = 0,则代表每次打开都直接启用该逻辑),本地默认N = 1;
|
||||
|
|
|
@ -388,6 +388,10 @@ namespace Touka
|
|||
{
|
||||
get
|
||||
{
|
||||
#if NO_AD
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
return false;
|
||||
#endif
|
||||
|
@ -406,6 +410,10 @@ namespace Touka
|
|||
public bool ShowNative(float x, float y, float width, float height,string adpos)
|
||||
{
|
||||
Debug.Log("ShowNative()");
|
||||
|
||||
#if NO_AD
|
||||
return false;
|
||||
#endif
|
||||
#if UNITY_EDITOR
|
||||
return false;
|
||||
#endif
|
||||
|
@ -457,6 +465,10 @@ namespace Touka
|
|||
/// <param name="_clean"></param>
|
||||
public void HideNative(bool _clean)
|
||||
{
|
||||
#if NO_AD
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#endif
|
||||
|
|
|
@ -131,6 +131,11 @@ namespace Touka
|
|||
/// <param name="_canShowBanner"></param>
|
||||
public void ShowOrHideBanner(bool _canShowBanner)
|
||||
{
|
||||
#if NO_AD
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (_canShowBanner)
|
||||
{
|
||||
Debug.Log("这个场景要显示banner");
|
||||
|
@ -143,16 +148,23 @@ namespace Touka
|
|||
ToukaAdManager.isCurrCanShowBanner = false;
|
||||
ToukaAdManager.Instance.HideBanner(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public void ShowNative(string adpos)
|
||||
{
|
||||
#if NO_AD
|
||||
return;
|
||||
#endif
|
||||
NativeAd.Instance.ShowNativeAd(adpos);
|
||||
}
|
||||
|
||||
public void RemoveNative()
|
||||
{
|
||||
#if NO_AD
|
||||
return;
|
||||
#endif
|
||||
ToukaAdManager.Instance.HideNative(false);
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -142,7 +142,7 @@ PlayerSettings:
|
|||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 1.2.4
|
||||
bundleVersion: 1.2.5
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
|
|
Loading…
Reference in New Issue