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