696 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			696 lines
		
	
	
		
			21 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using UnityEngine;
 | ||
| 
 | ||
| namespace Touka
 | ||
| {
 | ||
|     public class TKGSDKNative : ITKGSDK
 | ||
|     {
 | ||
|         private Dictionary<string, object> mDefaultDic = new Dictionary<string, object>();
 | ||
|         /// <summary>
 | ||
|         /// init sdk
 | ||
|         /// </summary>
 | ||
|         /// <param name="_initCallback"></param>
 | ||
|         public void InitSDK(Action _initCallback = null)
 | ||
|         {
 | ||
|             SetOnlineConfigInit();
 | ||
|             TKGNativeInterface.Instance.Init(_initCallback);
 | ||
|         }
 | ||
| 
 | ||
|         private void SetOnlineConfigInit()
 | ||
|         {
 | ||
|             //加入自定义参数列表
 | ||
|             foreach (string tKey in TKGParams.OnlineParamDic.Keys)
 | ||
|             {
 | ||
|                 mDefaultDic.Add(tKey, TKGParams.OnlineParamDic[tKey]);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Set game focus
 | ||
|         /// </summary>
 | ||
|         /// <param name="_gameFocusAction"></param>
 | ||
|         public void SetGameFocusListener(Action<bool> _gameFocusAction)
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.SetGameFocusListener(_gameFocusAction);
 | ||
|         }
 | ||
| 
 | ||
|         public void SetRewardClickListener(Action _rewardClickAction)
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.SetRewardClickListener(_rewardClickAction);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Get channel
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public AppChannel GetChannel()
 | ||
|         {
 | ||
|             Debug.Log("android back getchannel : " + TKGNativeInterface.Instance.GetChannel());
 | ||
|             string channelStr = TKGNativeInterface.Instance.GetChannel();
 | ||
| 
 | ||
|             channelStr = channelStr.Equals("default") ? AppChannel.AndroidRoot.ToString() : channelStr;
 | ||
|             AppChannel tChannel = AppChannel.None;
 | ||
|             if (Enum.TryParse(channelStr, out tChannel))
 | ||
|             {
 | ||
|                 return tChannel;
 | ||
|             }
 | ||
| 
 | ||
|             return AppChannel.None;
 | ||
|         }
 | ||
| 
 | ||
|         #region Ads
 | ||
| 
 | ||
|         public void SetUnitySDKVersion(string sdkVersion)
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.SetUnitySDKVersion(sdkVersion);
 | ||
|         }
 | ||
| 
 | ||
|         public void PurchasedRemoveAds()
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.PurchasedRemoveAds();
 | ||
|         }
 | ||
| 
 | ||
|         public void RemoveNativeAd()
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.RemoveNativeAd();
 | ||
|         }
 | ||
| 
 | ||
|         public bool IsReadyNativeAd()
 | ||
|         {
 | ||
|             return TKGNativeInterface.Instance.IsReadyNativeAd();
 | ||
|         }
 | ||
| 
 | ||
|         public void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "")
 | ||
|         {
 | ||
| 
 | ||
|             TKGNativeInterface.Instance.ShowNativeAd(pRect,pCam,pAdPos);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Show banner
 | ||
|         /// </summary>
 | ||
|         /// <param name="_bannerAlign">bannerAlign</param>
 | ||
|         public void ShowBanner(TKGBannerAlign _pos)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.showBannerAd(_pos);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Hide banner
 | ||
|         /// </summary>
 | ||
|         public void HideBanner()
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.hideBannerAd();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Show Interstitial Ad
 | ||
|         /// </summary>
 | ||
|         /// <param name="_adPos"> Name of interstitial ad placement. </param>
 | ||
|         /// <param name="_callback"> Callback of interstitial ad close and show interstitial failed</param>
 | ||
|         /// <param name="_IvType"> IVADType for distinguish interstitial ads frequency, default use iv1</param>
 | ||
|         public void ShowInterstitialAd(TKGIVAdPositionName _adPos, Action _callback = null, IVADType _IvType = IVADType.IV1)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Show Interstitial call, _adPos : " + _adPos);
 | ||
|             if (_callback != null) _callback();
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGSDKCallback.mInterAdCallback = _callback;
 | ||
|             TKGNativeInterface.Instance.showInterstitialAd(_adPos.ToString(), _IvType);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Show Reward Ad
 | ||
|         /// </summary>
 | ||
|         /// <param name="_adPos"> Name of reward ad placement</param>
 | ||
|         /// <param name="_rewardCallback"> true:reward succ, false: reward failed</param>
 | ||
|         /// <param name="_showFailedCallback">Callback of reward ad show fail</param>
 | ||
|         public void ShowRewardAd(TKGRVPositionName _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Show reward call, _adPos : " + _adPos);
 | ||
|             if (_rewardCallback != null) _rewardCallback(true);
 | ||
|             return;
 | ||
| #endif
 | ||
| 
 | ||
|             TKGSDKCallback.mRewardCallback = _rewardCallback;
 | ||
|             TKGSDKCallback.mRewardShowFailedCallback = _showFailedCallback;
 | ||
| 
 | ||
|             TKGNativeInterface.Instance.showRewardAd(_adPos.ToString(), -1);
 | ||
|         }
 | ||
| 
 | ||
|         public void Toast(string text) {
 | ||
| 
 | ||
|             TKGNativeInterface.Instance.toast(text);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         public void SetShowSDKToast(bool _useSDKToast)
 | ||
|         {
 | ||
|             TKGNativeInterface.Instance.SetShowSDKToast(_useSDKToast);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Is Ready Interstitial
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public bool IsReadyInterstitialAd()
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return true;
 | ||
| #endif
 | ||
|             return TKGNativeInterface.Instance.isInterstitialAdReady();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Is Ready Reward
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         public bool IsReadyRewardAd()
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return true;
 | ||
| #endif
 | ||
|             return TKGNativeInterface.Instance.isRewardAdReady();
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Log Event
 | ||
| 
 | ||
|         #region Normal
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// log event
 | ||
|         /// </summary>
 | ||
|         /// <param name="_eventSort"></param>
 | ||
|         public void LogEvent(string _eventSort)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.onEvent(_eventSort);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// log event
 | ||
|         /// </summary>
 | ||
|         /// <param name="_eventSort"></param>
 | ||
|         /// <param name="_key"></param>
 | ||
|         /// <param name="_value"></param>
 | ||
|         public void LogEvent(string _eventSort, string _key, string _value)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _key : " + _key + " , _value : " + _value);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.onEvent(_eventSort, _key, _value);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// log event
 | ||
|         /// </summary>
 | ||
|         /// <param name="_eventSort"></param>
 | ||
|         /// <param name="_key01"></param>
 | ||
|         /// <param name="_value01"></param>
 | ||
|         /// <param name="_key02"></param>
 | ||
|         /// <param name="_value02"></param>
 | ||
|         public void LogEvent(string _eventSort, string _key01, string _value01, string _key02, string _value02)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _key01 : " + _key01 + " , _value01 : " + _value01 + " , _key2 : " + _key02 + " , _value02 : " + _value02);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.onEvent(_eventSort, _key01, _value01, _key02, _value02);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// log event
 | ||
|         /// </summary>
 | ||
|         /// <param name="_eventSort"></param>
 | ||
|         /// <param name="_eventDic"></param>
 | ||
|         public void LogEvent(string _eventSort, Dictionary<string, string> _eventDic = null)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _eventDic.count : " + _eventDic.Count);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.onEvent(_eventSort, _eventDic);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Level Event
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Notify game start
 | ||
|         /// </summary>
 | ||
|         /// <param name="_level"></param>
 | ||
|         public void LevelStart(int _level)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LevelStart _level : " + _level);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.LevelStart(_level.ToString());
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Notify game start
 | ||
|         /// </summary>
 | ||
|         /// <param name="_level"></param>
 | ||
|         public void LevelStart(string _level)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LevelStart _level : " + _level);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.LevelStart(_level);
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Notify game end
 | ||
|         /// </summary>
 | ||
|         /// <param name="_level"></param>
 | ||
|         /// <param name="_stageResult"></param>
 | ||
|         public bool LevelEnd(int _level, StageResult _stageResult)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LevelEnd _level : " + _level + " , _stageResult : " + _stageResult);
 | ||
| #if UNITY_EDITOR
 | ||
|             return true;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.LevelEnd(_level.ToString(), _stageResult);
 | ||
|             return true;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Notify game end
 | ||
|         /// </summary>
 | ||
|         /// <param name="_level"></param>
 | ||
|         /// <param name="_stageResult"></param>
 | ||
|         public bool LevelEnd(string _level, StageResult _stageResult)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LevelEnd _level : " + _level + " , _win : " + _stageResult);
 | ||
| #if UNITY_EDITOR
 | ||
|             return true;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.LevelEnd(_level, _stageResult);
 | ||
|             return true;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Reward Ad Button Show
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Log Reward ad button show
 | ||
|         /// </summary>
 | ||
|         /// <param name="_pos"></param>
 | ||
|         public void LogRewardAdBtnShow(string _pos)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LogRewardAdBtnShow _pos : " + _pos);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.onEvent(TKGStringEvent.Event_Sort_TKGInner_ad_button_show, TKGStringEvent.Event_Type_TKGInner_ad_position, _pos);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Tracking Event
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Log Tracking Event
 | ||
|         /// </summary>
 | ||
|         /// <param name="_eventType"></param>
 | ||
|         public void LogTrackingEvent(TrackingEventType _eventType)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] LogTrackingEvent _eventType : " + _eventType);
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.LogTrackingEvent(_eventType);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Online Config
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// get config - string
 | ||
|         /// </summary>
 | ||
|         /// <param name="_key"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public string GetConfigStr(string _key)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return GetConfigDefaultValue(_key);
 | ||
| #endif
 | ||
|             string tempOnline = TKGNativeInterface.Instance.GetConfigString(_key, GetConfigDefaultValue(_key));
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] tempOnline , _key : " + _key + " , tempOnline : " + tempOnline);
 | ||
|             return tempOnline;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// get config - int
 | ||
|         /// </summary>
 | ||
|         /// <param name="_key"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public int GetConfigInt(string _key)
 | ||
|         {
 | ||
|             string tDefaultValue = GetConfigDefaultValue(_key);
 | ||
| 
 | ||
| #if UNITY_EDITOR
 | ||
| 
 | ||
|             if (int.TryParse(tDefaultValue, out int tIntVal))
 | ||
|             {
 | ||
|                 return tIntVal;
 | ||
|             }
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative]");
 | ||
|             return 0;
 | ||
| #endif
 | ||
| 
 | ||
|             int defaultInt = 0;
 | ||
|             int.TryParse(tDefaultValue, out defaultInt);
 | ||
| 
 | ||
|             int tempInt = TKGNativeInterface.Instance.GetConfigInt(_key, defaultInt);
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] GetConfigInt , _key : " + _key + " , tempInt : " + tempInt);
 | ||
|             return tempInt;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// get config - bool
 | ||
|         /// </summary>
 | ||
|         /// <param name="_key"></param>
 | ||
|         /// <returns></returns>
 | ||
|         public bool GetConfigBool(string _key)
 | ||
|         {
 | ||
|             string tDefaultValue = GetConfigDefaultValue(_key);
 | ||
| #if UNITY_EDITOR
 | ||
|             if (int.TryParse(tDefaultValue, out int tIntVal))
 | ||
|             {
 | ||
|                 return tIntVal != 0;
 | ||
|             }
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative]");
 | ||
| 
 | ||
|             return false;
 | ||
| #endif
 | ||
| 
 | ||
|             int defaultInt = 0;
 | ||
|             int.TryParse(tDefaultValue, out defaultInt);
 | ||
| 
 | ||
|             bool tBoolValue = TKGNativeInterface.Instance.GetConfigBool(_key, defaultInt != 0);
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] GetConfigBool , _key : " + _key + " , tBoolValue : " + tBoolValue);
 | ||
|             return tBoolValue;
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// get default config value
 | ||
|         /// </summary>
 | ||
|         /// <param name="_key"></param>
 | ||
|         /// <returns></returns>
 | ||
|         private string GetConfigDefaultValue(string _key)
 | ||
|         {
 | ||
|             string tDefault = "";
 | ||
|             if (mDefaultDic.ContainsKey(_key))
 | ||
|             {
 | ||
|                 tDefault = mDefaultDic[_key].ToString();
 | ||
|             }
 | ||
|             Debug.Log("getConfigDefaultValue, _key : " + _key + " , tDefault : " + tDefault);
 | ||
|             return tDefault;
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region Others (common)
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// review
 | ||
|         /// </summary>
 | ||
|         public void Review()
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Review");
 | ||
| #if UNITY_EDITOR
 | ||
| #if AppStore_GB
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Review cannot be opened in editor, please open it in real machine");
 | ||
| #else
 | ||
| 
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开评价页面,请在真机中打开");
 | ||
|     
 | ||
| #endif
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.Review();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// open privacy url
 | ||
|         /// </summary>
 | ||
|         public void OpenPrivacyURL()
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] OpenPrivacyURL");
 | ||
| #if UNITY_EDITOR
 | ||
| #if AppStore_GB
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
 | ||
| #else
 | ||
| 
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
 | ||
|     
 | ||
| #endif
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.OpenPrivacyURL();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// open user term url
 | ||
|         /// </summary>
 | ||
|         public void OpenUserTermURL()
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] OpenUserTermURL");
 | ||
| #if UNITY_EDITOR
 | ||
| #if AppStore_GB
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
 | ||
| #else
 | ||
| 
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
 | ||
|     
 | ||
| #endif
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.OpenUserTermURL();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// open policy pop
 | ||
|         /// </summary>
 | ||
|         public void OpenPolicyPop()
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] OpenPolicyPop");
 | ||
| #if UNITY_EDITOR
 | ||
| #if AppStore_GB
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
 | ||
| #else
 | ||
| 
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
 | ||
|     
 | ||
| #endif
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.OpenPolicyPop();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// open more game
 | ||
|         /// </summary>
 | ||
|         public void OpenMoreGame()
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] OpenMoreGame");
 | ||
| #if UNITY_EDITOR
 | ||
| #if AppStore_GB
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] App Store cannot be opened in editor, please open it in real machine");
 | ||
| #else
 | ||
| 
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开App Store,请在真机中打开");
 | ||
|     
 | ||
| #endif
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.OpenMoreGame();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// open url browser
 | ||
|         /// </summary>
 | ||
|         /// <param name="_url"></param>
 | ||
|         public void OpenUrlByBrowser(string _url)
 | ||
|         {
 | ||
|             TKGDebugger.LogDebug("[TKGSDKNative] OpenUrlByBrowser");
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGUtils.OpenBrowserUrl(_url);
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// shake
 | ||
|         /// </summary>
 | ||
|         /// <param name="_shakeType">0 light,1 medium,2 heavy</param>
 | ||
|         /// <param name="_intensity">ios 0~1, android any num</param>
 | ||
|         public void Shake(int _shakeType, float _intensity = 1)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.shake(_shakeType, _intensity);
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region others(uncommon)
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// SetUserSourceListener
 | ||
|         /// </summary>
 | ||
|         /// <param name="_userSourceAction"></param>
 | ||
|         public void SetUserSourceListener(Action<bool, string> _userSourceAction)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGSDKCallback.mTKGUserSourceCallback = _userSourceAction;
 | ||
|             TKGNativeInterface.Instance.SetUserSourceCallback(new AndroidTKGUserSourceCalllback());
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// SetUserSourceListenerWithCampaignName
 | ||
|         /// </summary>
 | ||
|         /// <param name="_userSourceAction"></param>
 | ||
|         public void SetUserSourceListener(Action<bool, string, string> _userSourceAction)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGSDKCallback.mTKGUserSourceCallbackWithCampaignName = _userSourceAction;
 | ||
|             TKGNativeInterface.Instance.SetUserSourceCallback(new AndroidTKGUserSourceCalllbackWithCampaignName());
 | ||
|         }
 | ||
| 
 | ||
|         public void SetFunctionSwitchListener(List<FunctionType> _functionKeys, Action<FunctionType, bool> _functionSwitchCallback)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGSDKCallback.mFunctionSwitchCalllback = _functionSwitchCallback;
 | ||
|             TKGNativeInterface.Instance.SetFunctionSwitchCalllback(_functionKeys,new AndroidFunctionSwitchCalllback());
 | ||
| 
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// Set TKG Common callback
 | ||
|         /// </summary>
 | ||
|         /// <param name="_commonCallback"></param>
 | ||
|         public void SetTKGCommonCallback(Action<CommonCallbackCode, string> _commonCallback)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGSDKCallback.mTKGCommonCallback = _commonCallback;
 | ||
|             TKGNativeInterface.Instance.SetSDKCommonCallback(new AndroidTKGCommonCalllback());
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Set log enable
 | ||
|         /// </summary>
 | ||
|         public void SetLogEnable(bool _enable)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.SetLogEnable(_enable);
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// share txt
 | ||
|         /// </summary>
 | ||
|         public void ShareTxt(string _shareTxt)
 | ||
|         {
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #endif
 | ||
|             TKGNativeInterface.Instance.ShareTxt(_shareTxt);
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// regist APNS
 | ||
|         /// </summary>
 | ||
|         public void RegistAPNS()
 | ||
|         {
 | ||
|             
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #else
 | ||
|             TKGNativeInterface.Instance.RegistAPNS();
 | ||
| #endif
 | ||
| 
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// shake
 | ||
|         /// </summary>
 | ||
|         /// <param name="notiId">notification identifier</param>
 | ||
|         /// <param name="body">The body of the notification.</param>
 | ||
|         /// <param name="fireDate">notify after the time interval. format: yyyy-MM-dd HH:mm:ss </param>
 | ||
|         /// <param name="badge">The application badge number.</param>
 | ||
|         /// <param name="title">The title of the notification.</param>
 | ||
|         /// <param name="subTitle">The subtitle of the notification.</param>
 | ||
|         public void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle) {
 | ||
|             
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #else
 | ||
|             TKGNativeInterface.Instance.RegistNotification(notiId,body,fireDate,badge,title,subTitle);
 | ||
| #endif
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// remove all notification
 | ||
|         /// </summary>
 | ||
|         public void RemoveAllNotifications() {
 | ||
|             
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #else
 | ||
|             TKGNativeInterface.Instance.RemoveAllNotifications();
 | ||
| #endif
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// remove notification by notification identifier
 | ||
|         /// </summary>
 | ||
|         /// <param name="notiId">notification identifier</param>
 | ||
|         public void RemoveNotification(string notiId) {
 | ||
| 
 | ||
|             
 | ||
| #if UNITY_EDITOR
 | ||
|             return;
 | ||
| #else
 | ||
|             TKGNativeInterface.Instance.RemoveNotification(notiId);
 | ||
| #endif
 | ||
|         }
 | ||
| 
 | ||
|         #endregion
 | ||
|     }
 | ||
| }
 |