From f89cffb684cd3956c5cba4f7ff8de91802507605 Mon Sep 17 00:00:00 2001 From: yangjing Date: Tue, 13 Sep 2022 11:26:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7TKGSDK2.2.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/GameInterface/TKGSDKManager.cs | 21 +++- Assets/TKGSDK/Common/internal/ITKGSDK.cs | 30 ++++++ Assets/TKGSDK/Common/internal/TKGSDKNative.cs | 25 ++++- .../Common/internal/iOS/TGiOSAdmanager.cs | 59 ++++++++++ .../Editor/ToukaAdsBuildPostProcessor.cs | 102 ++++++++++++------ .../ToukaAnalyticsBuildPostProcessor.cs | 6 +- .../Scripts/SDK/TKGNativeInterface.cs | 9 +- .../Scripts/SDK/TKGNativeInterfaceAndroid.cs | 36 ++++++- .../Scripts/SDK/TKGNativeInterfaceDefault.cs | 10 ++ .../Scripts/SDK/TKGNativeInterfaceIOS.cs | 32 +++++- .../NativeSDK/Scripts/SDK/TKGSDKCallback.cs | 14 +++ .../Scripts/SDK/TKGSDKCallbackAndroid.cs | 22 +++- 12 files changed, 318 insertions(+), 48 deletions(-) diff --git a/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs index e662ddff..d3417cd4 100644 --- a/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs +++ b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs @@ -182,6 +182,7 @@ public class TKGSDKManager : TKGSingleton } else { + m_sdkInterface.SetShowSDKToast(showSDKToast); m_sdkInterface.ShowRewardAd(_adPos, _rewardCallback, _showFailedCallback); } } @@ -202,7 +203,7 @@ public class TKGSDKManager : TKGSingleton /// public bool IsReadyInterstitialAd() { - + return m_sdkInterface.IsReadyInterstitialAd(); } @@ -573,6 +574,11 @@ public class TKGSDKManager : TKGSingleton #region others + public void Toast(string text) + { + m_sdkInterface.Toast(text); + } + /// /// Set user source listener /// only call first can back source @@ -603,5 +609,16 @@ public class TKGSDKManager : TKGSingleton m_sdkInterface.SetTKGCommonCallback(_commonCallbackAction); } -#endregion + /// + /// 注册功能开关回调 + /// + /// 各功能名称 + /// 回调事件,回来每个功能名称及对应开关 + public void SetFunctionSwitchListener(List _functionKeys, Action _functionSwitchCallback) + { + m_sdkInterface.SetFunctionSwitchListener(_functionKeys, _functionSwitchCallback); + } + + + #endregion } \ No newline at end of file diff --git a/Assets/TKGSDK/Common/internal/ITKGSDK.cs b/Assets/TKGSDK/Common/internal/ITKGSDK.cs index 19306564..f0f078b5 100644 --- a/Assets/TKGSDK/Common/internal/ITKGSDK.cs +++ b/Assets/TKGSDK/Common/internal/ITKGSDK.cs @@ -76,6 +76,12 @@ namespace Touka /// Callback of reward ad show fail void ShowRewardAd(TKGRVPositionName _adPos, Action _rewardCallback = null, Action _showFailedCallback = null); + /// + /// SetShowSDKToast + /// if use sdk toast set true else set false + + void SetShowSDKToast(bool _useSDKToast); + /// /// Is Ready Reward /// @@ -234,6 +240,8 @@ namespace Touka void OpenPolicyPop(); + void Toast(string _text); + /// /// shake /// @@ -257,6 +265,13 @@ namespace Touka /// void SetUserSourceListener(Action _userSourceActionWithCampaignName); + /// + /// 注册功能开关回调 + /// + /// 各功能名称 + /// 回调事件,回来每个功能名称及对应开关 + void SetFunctionSwitchListener(List _functionKeys, Action _functionSwitchCallback); + /// /// common callback /// @@ -307,6 +322,21 @@ namespace Touka #endregion } + /// + /// 功能名称枚举 + /// + public enum FunctionType + { + Function_wangz, + Function_bing, + Function_IA, + Function_IP, + Function_name, + Function_other1, + Function_other2, + Function_other3 + } + /// /// IV Ad Type /// Control different frequency interstitial Ads diff --git a/Assets/TKGSDK/Common/internal/TKGSDKNative.cs b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs index 1f0cdb69..1bdbe374 100644 --- a/Assets/TKGSDK/Common/internal/TKGSDKNative.cs +++ b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs @@ -13,8 +13,8 @@ namespace Touka /// public void InitSDK(Action _initCallback = null) { - TKGNativeInterface.Instance.Init(_initCallback); SetOnlineConfigInit(); + TKGNativeInterface.Instance.Init(_initCallback); } private void SetOnlineConfigInit() @@ -147,6 +147,17 @@ namespace Touka TKGNativeInterface.Instance.showRewardAd(_adPos.ToString(), -1); } + public void Toast(string text) { + + TKGNativeInterface.Instance.toast(text); + + } + + public void SetShowSDKToast(bool _useSDKToast) + { + TKGNativeInterface.Instance.SetShowSDKToast(_useSDKToast); + } + /// /// Is Ready Interstitial /// @@ -577,6 +588,15 @@ namespace Touka TKGNativeInterface.Instance.SetUserSourceCallback(new AndroidTKGUserSourceCalllbackWithCampaignName()); } + public void SetFunctionSwitchListener(List _functionKeys, Action _functionSwitchCallback) + { +#if UNITY_EDITOR + return; +#endif + TKGSDKCallback.mFunctionSwitchCalllback = _functionSwitchCallback; + TKGNativeInterface.Instance.SetFunctionSwitchCalllback(_functionKeys,new AndroidFunctionSwitchCalllback()); + + } /// /// Set TKG Common callback /// @@ -669,6 +689,7 @@ namespace Touka TKGNativeInterface.Instance.RemoveNotification(notiId); #endif } -#endregion + + #endregion } } diff --git a/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs index 51f8acca..cf57c703 100644 --- a/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs +++ b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs @@ -50,6 +50,11 @@ public class TGiOSAdManager : MonoBehaviour IntPtr us = Marshal.GetFunctionPointerForDelegate(usHandler); userSourceCallback(us); + // function Switch + TKG_FunctionSwitchDelegate funcHandler = new TKG_FunctionSwitchDelegate(functionSwitchHandle); + IntPtr func = Marshal.GetFunctionPointerForDelegate(funcHandler); + funcSwitchCallback(func); + // rv close rewardCloseDelegate rvCloseHandler = new rewardCloseDelegate(rewardAdCloseHandle); IntPtr rewardClose = Marshal.GetFunctionPointerForDelegate(rvCloseHandler); @@ -70,10 +75,18 @@ public class TGiOSAdManager : MonoBehaviour IntPtr rvClick = Marshal.GetFunctionPointerForDelegate(rvClickHandler); rewardAdClickCallback(rvClick); + + TKG_InitSDK(); } + // 注册事件 + public void setFunctions(string funcs) + { + TKG_SetFuncs(funcs); + } + // 通知 public void registAPNS() { @@ -166,6 +179,11 @@ public class TGiOSAdManager : MonoBehaviour TKG_ShowRewardVideo(adPos); } + public void ShowSDKToast(bool _show) + { + TKG_ShowSDKToast(_show); + } + // native public void LoadNative(float width, float height) { @@ -212,6 +230,10 @@ public class TGiOSAdManager : MonoBehaviour TKG_OpenMoreGame(); } + public void Toast(string content) + { + TKG_Toast(content); + } // 在线参数 public int GetConfigInt(string key, int defaultValue) @@ -399,7 +421,31 @@ public class TGiOSAdManager : MonoBehaviour } } + // set func + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void TKG_FunctionSwitchDelegate(string funcT, string funcS); + [AOT.MonoPInvokeCallback(typeof(TKG_FunctionSwitchDelegate))] + static void functionSwitchHandle(string funcType, string funcSwitch) + { + + Debug.Log("yangwu unity log 回调到unity里:"+funcType+"sw:"+funcSwitch); + if (TKGSDKCallback.mFunctionSwitchCalllback != null) + { + FunctionType enumType = (FunctionType)Enum.Parse(typeof(FunctionType), funcType); + + if (TKGSDKCallback.mFunctionSwitchCalllback != null) + { + bool res = funcSwitch == "1" ? true : false; + TKGSDKCallback.mFunctionSwitchCalllback.Invoke(enumType, res); + } + } + } + + // dll + [DllImport("__Internal")] + private static extern void TKG_SetFuncs(string funcs); + [DllImport("__Internal")] private static extern void TKG_Shake(int mType, float mIntensity); @@ -448,6 +494,9 @@ public class TGiOSAdManager : MonoBehaviour [DllImport("__Internal")] private static extern void TKG_OpenMoreGame(); + [DllImport("__Internal")] + private static extern void TKG_Toast(string str); + // ads [DllImport("__Internal")] private static extern void TKG_LoadBanner(); @@ -479,6 +528,9 @@ public class TGiOSAdManager : MonoBehaviour [DllImport("__Internal")] private static extern void TKG_ShowRewardVideo(string adPos); + [DllImport("__Internal")] + private static extern void TKG_ShowSDKToast(bool _show); + [DllImport("__Internal")] private static extern void TKG_LoadNative(float width, float height); @@ -550,6 +602,13 @@ public class TGiOSAdManager : MonoBehaviour IntPtr userSource ); + // func callback + [DllImport("__Internal")] + public static extern void funcSwitchCallback( + IntPtr funcSwitch + ); + + // 设置unity版本 [DllImport("__Internal")] private static extern void TKG_SetUnityVersion(string version); diff --git a/Assets/TKGSDK/Editor/ToukaAdsBuildPostProcessor.cs b/Assets/TKGSDK/Editor/ToukaAdsBuildPostProcessor.cs index 1b931269..c8210aae 100644 --- a/Assets/TKGSDK/Editor/ToukaAdsBuildPostProcessor.cs +++ b/Assets/TKGSDK/Editor/ToukaAdsBuildPostProcessor.cs @@ -584,7 +584,60 @@ namespace Touka PlistElementDict dic126; dic126 = URLWhiteListArr2.AddDict(); dic126.SetString("SKAdNetworkIdentifier", "pwdxu55a5a.skadnetwork"); -#endregion + + PlistElementDict dic127; + dic127 = URLWhiteListArr2.AddDict(); + dic127.SetString("SKAdNetworkIdentifier", "b9bk5wbcq9.skadnetwork"); + + PlistElementDict dic128; + dic128 = URLWhiteListArr2.AddDict(); + dic128.SetString("SKAdNetworkIdentifier", "x5l83yy675.skadnetwork"); + + PlistElementDict dic129; + dic129 = URLWhiteListArr2.AddDict(); + dic129.SetString("SKAdNetworkIdentifier", "x2jnk7ly8j.skadnetwork"); + + PlistElementDict dic130; + dic130 = URLWhiteListArr2.AddDict(); + dic130.SetString("SKAdNetworkIdentifier", "4w7y6s5ca2.skadnetwork"); + + PlistElementDict dic131; + dic131 = URLWhiteListArr2.AddDict(); + dic131.SetString("SKAdNetworkIdentifier", "7fmhfwg9en.skadnetwork"); + + PlistElementDict dic132; + dic132 = URLWhiteListArr2.AddDict(); + dic132.SetString("SKAdNetworkIdentifier", "qu637u8glc.skadnetwork"); + + PlistElementDict dic133; + dic133 = URLWhiteListArr2.AddDict(); + dic133.SetString("SKAdNetworkIdentifier", "krvm3zuq6h.skadnetwork"); + + PlistElementDict dic134; + dic134 = URLWhiteListArr2.AddDict(); + dic134.SetString("SKAdNetworkIdentifier", "3l6bd9hu43.skadnetwork"); + + PlistElementDict dic135; + dic135 = URLWhiteListArr2.AddDict(); + dic135.SetString("SKAdNetworkIdentifier", "a8cz6cu7e5.skadnetwork"); + + PlistElementDict dic136; + dic136 = URLWhiteListArr2.AddDict(); + dic136.SetString("SKAdNetworkIdentifier", "dkc879ngq3.skadnetwork"); + + PlistElementDict dic137; + dic137 = URLWhiteListArr2.AddDict(); + dic137.SetString("SKAdNetworkIdentifier", "m5mvw97r93.skadnetwork"); + + PlistElementDict dic138; + dic138 = URLWhiteListArr2.AddDict(); + dic138.SetString("SKAdNetworkIdentifier", "vcra2ehyfk.skadnetwork"); + + PlistElementDict dic139; + dic139 = URLWhiteListArr2.AddDict(); + dic139.SetString("SKAdNetworkIdentifier", "x5l83yy675.skadnetwork"); + + #endregion PlistElementArray urlTypes = plist.root.CreateArray("CFBundleURLTypes"); @@ -611,47 +664,28 @@ namespace Touka string mainTarget = pbxProject.TargetGuidByName(targetName); #endif pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/Core/AnyThinkSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/Core/AnyThinkSDK.bundle", PBXSourceTree.Sdk)); - pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", PBXSourceTree.Sdk)); pbxProject.WriteToFile(projectPath); + //pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", PBXSourceTree.Sdk)); + pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", PBXSourceTree.Sdk)); + + pbxProject.WriteToFile(projectPath); #endif } private static void ModifyCode(string _path) { -#if !AppStore_GB - ToukaClassHelper SplashScreenController = new ToukaClassHelper(_path + "/Classes/UI/SplashScreen.mm"); - - if (!SplashScreenController.HasBolow("#import ")) - { - - SplashScreenController.WriteBelow("#include \"SplashScreen.h\"", "#import "); - SplashScreenController.WriteBelow("void HideSplashScreen()\n{", "[[TONativeSplashHelper helper]showSplashInLaunch];"); - - } -#endif - -#if USE_SPLASH - - ToukaClassHelper SplashScreenControllers = new ToukaClassHelper(_path + "/Classes/UI/SplashScreen.mm"); - - if (!SplashScreenControllers.HasBolow("#import ")) - { - - SplashScreenControllers.WriteBelow("#include \"SplashScreen.h\"", "#import "); - SplashScreenControllers.WriteBelow("void HideSplashScreen()\n{", "[[TKGSplashManager manager]showSplashInLaunch];"); - - } - - ToukaClassHelper UnityAppController = new ToukaClassHelper(_path + "/Classes/UnityAppController.mm"); - if (!UnityAppController.HasBolow("[[TKGSplashManager manager] showSplashInEnterForground];")) + ToukaClassHelper SplashScreenControllers = new ToukaClassHelper(_path + "/Classes/UI/SplashScreen.mm"); + if (!SplashScreenControllers.HasBolow("#import ")) { - UnityAppController.WriteBelow("#import \"UnityAppController.h\"", "\n#import "); - UnityAppController.WriteBelow("UnityPause(0);", "\n[[TKGSplashManager manager] showSplashInEnterForground];"); + SplashScreenControllers.WriteBelow("#include \"SplashScreen.h\"", "#import "); + SplashScreenControllers.WriteBelow("void HideSplashScreen()\n{", "[TKGSplashAd showSplashAdInLaunch];"); } - -#endif - - + ToukaClassHelper UnityAppController = new ToukaClassHelper(_path + "/Classes/UnityAppController.mm"); + if (!UnityAppController.HasBolow("[TKGSplashAd showsplashAdInEnterForground];")) + { + UnityAppController.WriteBelow("#import \"UnityAppController.h\"", "\n#import "); + UnityAppController.WriteBelow("UnityPause(0);", "\n[TKGSplashAd showsplashAdInEnterForground];"); + } } #endif } diff --git a/Assets/TKGSDK/Editor/ToukaAnalyticsBuildPostProcessor.cs b/Assets/TKGSDK/Editor/ToukaAnalyticsBuildPostProcessor.cs index f77afa00..91bcf5ea 100644 --- a/Assets/TKGSDK/Editor/ToukaAnalyticsBuildPostProcessor.cs +++ b/Assets/TKGSDK/Editor/ToukaAnalyticsBuildPostProcessor.cs @@ -151,8 +151,7 @@ public class ToukaAnalyticsBuildPostProcessor proj.SetBuildProperty(target, "GCC_C_LANGUAGE_STANDARD", "gnu99"); proj.SetBuildProperty(target, "GCC_ENABLE_OBJC_EXCEPTIONS","YES"); proj.SetBuildProperty(target, "EXCLUDED_ARCHS", "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))"); - - + proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "NO"); File.WriteAllText(projPath, proj.WriteToString()); #endif } @@ -176,11 +175,14 @@ public class ToukaAnalyticsBuildPostProcessor plist.ReadFromFile(plistPath); #if !AppStore_GB plist.root.SetString("NSLocationAlwaysUsageDescription", "为了更好的体验游戏"); + plist.root.SetString("NSCameraUsageDescription", "为了更好的体验游戏"); plist.root.SetString("NSLocationWhenInUseUsageDescription", "为了更好的体验游戏"); plist.root.SetString("NSUserTrackingUsageDescription", "该标识符将用于向您投放个性化广告"); plist.root.SetString("NSPhotoLibraryUsageDescription", "为了更好的体验游戏,请允许APP保存图片到您的相册"); + #else plist.root.SetString ("NSLocationAlwaysUsageDescription", "for better experience the game"); + plist.root.SetString("NSCameraUsageDescription", "for better experience the game"); plist.root.SetString ("NSLocationWhenInUseUsageDescription", "for better experience the game"); plist.root.SetString("NSUserTrackingUsageDescription", "This identifier will be used to deliver personalized ads to you."); plist.root.SetString("NSPhotoLibraryUsageDescription", "In order to experience the game better, please allow the APP to save pictures to your album."); diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterface.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterface.cs index 32d3b065..4038dde4 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterface.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterface.cs @@ -11,7 +11,7 @@ namespace Touka { private static TKGNativeInterface _instance; - private string UnitySDKVersion = "2.2.5"; + private string UnitySDKVersion = "2.2.6"; public static TKGNativeInterface Instance { @@ -109,6 +109,8 @@ namespace Touka /// public abstract void showRewardAd(string _adPos, int _itemCount = -1); + + public abstract void SetShowSDKToast(bool _useSDKToast); /// /// Show Reward Ad /// @@ -445,6 +447,11 @@ namespace Touka /// public abstract void SetUserSourceCallback(AndroidTKGUserSourceCalllbackWithCampaignName _userSourceCallback); + /// + /// Set Function Switch Calllback + /// + public abstract void SetFunctionSwitchCalllback(List _functionKeys ,AndroidFunctionSwitchCalllback _functionSwitchCalllback); + #endregion } } \ No newline at end of file diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceAndroid.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceAndroid.cs index df03a0d7..8d3debd7 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceAndroid.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceAndroid.cs @@ -205,6 +205,14 @@ namespace Touka #endif } + public override void SetShowSDKToast(bool _useSDKToast) + { +#if UNITY_ANDROID + SDKCall("setShowSDKRewardTips", _useSDKToast); +#endif + + } + public override void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "") { #if UNITY_ANDROID @@ -650,7 +658,7 @@ namespace Touka /// public override void toast(string _content) { - SDKCall("toast"); + SDKCall("dialogTips",_content); } /// @@ -677,17 +685,17 @@ namespace Touka public override void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle) { - + SDKCall("registNotification",notiId,body,fireDate,badge,title,subTitle); } public override void RemoveNotification(string notiId) { - + SDKCall("removeNotification", notiId); } public override void RemoveAllNotifications() { - + SDKCall("removeAllNotifications"); } #endregion @@ -710,7 +718,25 @@ namespace Touka SDKCall("getUserSource", _userSourceCallback); } - #endregion + public override void SetFunctionSwitchCalllback(List _functionKeys, AndroidFunctionSwitchCalllback _functionSwitchCalllback) + { + + string keys=""; + + for (int i = 0; i < _functionKeys.Count; i++) + { + FunctionType enumType = _functionKeys[i]; + string enumTypeString = enumType.ToString(); + if(keys!=""){ + keys=keys+"@"; + } + keys=keys+enumTypeString; + } + + SDKCall("setGameSwitchListener", keys,_functionSwitchCalllback); + } + +#endregion } } diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceDefault.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceDefault.cs index 1f3135c8..8033edd0 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceDefault.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceDefault.cs @@ -544,6 +544,16 @@ namespace Touka } + public override void SetShowSDKToast(bool _useSDKToast) + { + + } + + public override void SetFunctionSwitchCalllback(List _functionKeys, AndroidFunctionSwitchCalllback _functionSwitchCalllback) + { + + } + #endregion } diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceIOS.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceIOS.cs index 1d87c35e..86a8767d 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceIOS.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGNativeInterfaceIOS.cs @@ -159,6 +159,13 @@ namespace Touka #endif } + public override void SetShowSDKToast(bool _useSDKToast) + { +#if !UNITY_EDITOR + TGiOSAdManager.Instance.ShowSDKToast(_useSDKToast); +#endif + } + /// /// Show FullScreen Ad(is RV without reward callback) /// @@ -599,7 +606,9 @@ namespace Touka /// public override void toast(string _content) { - +#if !UNITY_EDITOR + TGiOSAdManager.Instance.Toast(_content); +#endif } /// @@ -629,7 +638,28 @@ namespace Touka } + public override void SetFunctionSwitchCalllback(List _functionKeys, AndroidFunctionSwitchCalllback _functionSwitchCalllback) + { + string temp = ""; + if (_functionKeys.Count != 0) + { + for (int index = 0; index < _functionKeys.Count; index++) + { + + if (index == _functionKeys.Count - 1) + { + temp += _functionKeys[index]; + } + else + { + temp = temp + _functionKeys[index] + ","; + } + } + } + + TGiOSAdManager.Instance.setFunctions(temp); + } #endregion diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallback.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallback.cs index 084d9d7b..5bb3ea6f 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallback.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallback.cs @@ -21,6 +21,9 @@ namespace Touka // tkg user source public static Action mTKGUserSourceCallbackWithCampaignName = null; + //FunctionSwitchCalllback + public static Action mFunctionSwitchCalllback = null; + // tkg common callback public static Action mTKGCommonCallback = null; @@ -99,6 +102,17 @@ namespace Touka mTKGUserSourceCallbackWithCampaignName = _userSourceCallbackWithCampaignNameAction; } + + /// + /// Set Function Switch Calllback + /// + /// + public static void SetFunctionSwitchCalllback(Action _functionSwitchCalllback) + { + mFunctionSwitchCalllback = _functionSwitchCalllback; + } + + public static void SetRewardClickCallback(Action _rewardClickAction) { mRewardClickCallback = _rewardClickAction; diff --git a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallbackAndroid.cs b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallbackAndroid.cs index e927178f..315c0c3f 100644 --- a/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallbackAndroid.cs +++ b/Assets/TKGSDK/NativeSDK/Scripts/SDK/TKGSDKCallbackAndroid.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -355,6 +356,25 @@ namespace Touka } } + /// + /// FunctionSwitchCalllback + /// + public class AndroidFunctionSwitchCalllback : AndroidJavaProxy + { + public AndroidFunctionSwitchCalllback() : base("com.touka.tkg.idal.GameFunctionSwitchCallback") { } + + public void onFunctionSwitchResult(string _functionKey, bool _functionSwitch) + { + + FunctionType enumType = (FunctionType)Enum.Parse(typeof(FunctionType), _functionKey); + + if (TKGSDKCallback.mFunctionSwitchCalllback != null) + { + TKGSDKCallback.mFunctionSwitchCalllback.Invoke(enumType, _functionSwitch); + } + } + } + /* Loom.QueueOnMainThread((pObj) => {