967 lines
27 KiB
C#
967 lines
27 KiB
C#
#if UNITY_IPHONE
|
||
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
namespace Touka
|
||
{
|
||
/// <summary>
|
||
/// TKG Native SDK iOS platform interface call
|
||
/// </summary>
|
||
public class TKGNativeInterfaceIOS : TKGNativeInterface
|
||
{
|
||
|
||
public override void Init(Action _initCallback = null)
|
||
{
|
||
base.Init(_initCallback);
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.InitSDK();
|
||
#endif
|
||
}
|
||
/// <summary>
|
||
/// Get Channel
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public override string GetChannel()
|
||
{
|
||
return TGiOSAdManager.Instance.getChannel().ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// Set Log Enable
|
||
/// </summary>
|
||
/// <param name="_enable"></param>
|
||
public override void SetLogEnable(bool _enable)
|
||
{
|
||
TGiOSAdManager.Instance.SetLogEnable(_enable);
|
||
}
|
||
|
||
#region Ads
|
||
public override void PurchasedRemoveAds()
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.RemoveAllAds();
|
||
#endif
|
||
|
||
}
|
||
|
||
public override void SetUnitySDKVersion(string sdkVersion)
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.SetUnitySDKVersion(sdkVersion);
|
||
#endif
|
||
}
|
||
|
||
|
||
|
||
public override void RemoveNativeAd()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.RemoveNative();
|
||
#endif
|
||
}
|
||
|
||
public override bool IsReadyNativeAd()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
|
||
return TGiOSAdManager.Instance.IsReadyNative();
|
||
#else
|
||
return false;
|
||
#endif
|
||
|
||
}
|
||
|
||
public override void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "")
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowNative(pRect, pCam, pAdPos);
|
||
#endif
|
||
}
|
||
|
||
#region Ads Show
|
||
|
||
/// <summary>
|
||
/// Show banner Ad
|
||
/// </summary>
|
||
/// <param name="_bannerAlign">bannerAlign</param>
|
||
public override void showBannerAd(TKGBannerAlign _pos)
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowBanner((int)_pos);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Hide Banner Ad
|
||
/// </summary>
|
||
public override void hideBannerAd()
|
||
{
|
||
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.HideBanner();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show Interstitial Ad
|
||
/// </summary>
|
||
public override void showInterstitialAd()
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowIntersititial("",0);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show Interstitial Ad
|
||
/// </summary>
|
||
/// <param name="_adPos"></param>
|
||
public override void showInterstitialAd(string _adPos, IVADType _IvType = IVADType.IV1)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
|
||
TGiOSAdManager.Instance.ShowIntersititial(_adPos, (int)_IvType);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show Reward Ad
|
||
/// </summary>
|
||
public override void showRewardAd(string _adPos, int _itemCount = -1)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowRewardVideo(_adPos);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show Reward Ad
|
||
/// </summary>
|
||
/// <param name="_adPos"></param>
|
||
/// <param name="_itemCount"></param>
|
||
/// <param name="_extraEvent"></param>
|
||
public override void showRewardAd(string _adPos, int _itemCount, Dictionary<string, string> _extraEvent)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowRewardVideo(_adPos);
|
||
#endif
|
||
}
|
||
|
||
public override void SetShowSDKToast(bool _useSDKToast)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowSDKToast(_useSDKToast);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show FullScreen Ad(is RV without reward callback)
|
||
/// </summary>
|
||
public override void showVideoAd(string _adPos, int _itemCount = -1)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.ShowRewardVideo(_adPos);
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
|
||
#region Ads isready
|
||
|
||
/// <summary>
|
||
/// banner isReady
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public override bool isBannerAdReady()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
return TGiOSAdManager.Instance.IsReadyBanner();
|
||
#else
|
||
return false;
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Interstitial isReady
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public override bool isInterstitialAdReady()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
return TGiOSAdManager.Instance.IsReadyIntersititial();
|
||
#else
|
||
return false;
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Reward isReady
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public override bool isRewardAdReady()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
return TGiOSAdManager.Instance.IsReadyRewardVideo();
|
||
#else
|
||
return false;
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// FullScreen isReady
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public override bool isVideoAdReady()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
return TGiOSAdManager.Instance.IsReadyRewardVideo();
|
||
#else
|
||
return false;
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Set ads callback
|
||
|
||
/// <summary>
|
||
/// Set Banner Ad Callback
|
||
/// </summary>
|
||
/// <param name="_bannerCallback"></param>
|
||
public override void SetBannerAdCallback(AndroidBannerADTKGAdCallback _bannerCallback)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Set Interstital Ad Callback
|
||
/// </summary>
|
||
/// <param name="_interCallback"></param>
|
||
public override void setInterstitalAdCallback(AndroidInterADTKGAdCallback _interCallback)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Set reward Ad Callback
|
||
/// </summary>
|
||
/// <param name="_rewardCallback"></param>
|
||
public override void SetRewardAdCallback(AndroidRewardADTKGAdCallback _rewardCallback)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Set video Ad Callback(full screen ad, reward ad with no reward callback)
|
||
/// </summary>
|
||
/// <param name="_videoCallback"></param>
|
||
public override void setVideoAdCallback(AndroidInterADTKGAdCallback _videoCallback)
|
||
{
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region load ads
|
||
|
||
/// <summary>
|
||
/// load interstitial ad
|
||
/// (retry 3 times, per time interval 10s)
|
||
/// </summary>
|
||
public override void loadInterstitialAD()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LoadIntersititial();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// load reward ad
|
||
/// (retry 3 times, per time interval 10s)
|
||
/// </summary>
|
||
public override void loadRewardAD()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LoadRewardVideo();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// load video ad
|
||
/// (retry 3 times, per time interval 10s)
|
||
/// </summary>
|
||
public override void loadVideoAD()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LoadRewardVideo();
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
|
||
#region Log Event
|
||
|
||
/// <summary>
|
||
/// onEvent
|
||
/// </summary>
|
||
/// <param name="_eventName"></param>
|
||
/// <returns></returns>
|
||
public override void onEvent(string _eventName)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_UMeng(_eventName);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// onEvent
|
||
/// </summary>
|
||
/// <param name="_eventName"></param>
|
||
/// <param name="_key01"></param>
|
||
/// <param name="_value01"></param>
|
||
/// <returns></returns>
|
||
public override void onEvent(string _eventName, string _key01, string _value01)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_UMeng(_eventName,_key01,_value01);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// onEvent
|
||
/// </summary>
|
||
/// <param name="_eventName"></param>
|
||
/// <param name="_key01"></param>
|
||
/// <param name="_value01"></param>
|
||
/// <param name="_key02"></param>
|
||
/// <param name="_value02"></param>
|
||
/// <returns></returns>
|
||
public override void onEvent(string _eventName, string _key01, string _value01, string _key02, string _value02)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_UMeng(_eventName,_key01,_value01,_key02,_value02);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// onEvent
|
||
/// </summary>
|
||
/// <param name="_eventName"></param>
|
||
/// <param name="_keyValues"></param>
|
||
public override void onEvent(string _eventName, Dictionary<string, string> _keyValues)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_UMeng(_eventName,_keyValues);
|
||
#endif
|
||
}
|
||
|
||
#region Level Event
|
||
|
||
/// <summary>
|
||
/// Level Start
|
||
/// </summary>
|
||
/// <param name="_levelId"></param>
|
||
public override void LevelStart(string _levelId)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_GameStart(_levelId);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Level end
|
||
/// </summary>
|
||
/// <param name="_stageResult"></param>
|
||
public override void LevelEnd(string _levelId, StageResult _stageResult)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.onEvent_GameEnd(_levelId,(int)_stageResult);
|
||
#endif
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Tracking Event
|
||
|
||
/// <summary>
|
||
/// Log Tracking Event
|
||
/// </summary>
|
||
/// <param name="_eventType"></param>
|
||
public override void LogTrackingEvent(TrackingEventType _eventType)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
|
||
TGiOSAdManager.Instance.onEvent_Tenjin((int)_eventType);
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region Online Config
|
||
|
||
/// <summary>
|
||
/// get config - int
|
||
/// </summary>
|
||
/// <param name="_key"></param>
|
||
/// <returns></returns>
|
||
public override int GetConfigInt(string _key, int _default)
|
||
{
|
||
return TGiOSAdManager.Instance.GetConfigInt(_key, _default);
|
||
}
|
||
|
||
/// <summary>
|
||
/// get config - string
|
||
/// </summary>
|
||
/// <param name="_key"></param>
|
||
/// <returns></returns>
|
||
public override string GetConfigString(string _key, string _default)
|
||
{
|
||
return TGiOSAdManager.Instance.GetConfigString(_key, _default);
|
||
}
|
||
|
||
/// <summary>
|
||
/// get config - bool
|
||
/// </summary>
|
||
/// <param name="_key"></param>
|
||
/// <returns></returns>
|
||
public override bool GetConfigBool(string _key, bool _default)
|
||
{
|
||
return TGiOSAdManager.Instance.GetConfigBool(_key, _default);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Others (Common)
|
||
|
||
/// <summary>
|
||
/// review
|
||
/// </summary>
|
||
public override void Review()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.Review();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// open Privacy
|
||
/// </summary>
|
||
public override void OpenPrivacyURL()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
|
||
TGiOSAdManager.Instance.OpenPrivacyURL();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// open agreement
|
||
/// </summary>
|
||
public override void OpenUserTermURL()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.OpenUserTermURL();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// open policy pop
|
||
/// </summary>
|
||
public override void OpenPolicyPop()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.OpenPolicyPop();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// More Games
|
||
/// </summary>
|
||
public override void OpenMoreGame()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.OpenMoreGame();
|
||
#endif
|
||
}
|
||
// <summary>
|
||
/// share txt
|
||
/// </summary>
|
||
/// <param name="_shareTxt"></param>
|
||
public override void ShareTxt(string _shareTxt)
|
||
{
|
||
TGiOSAdManager.Instance.share(_shareTxt);
|
||
}
|
||
|
||
/// <summary>
|
||
/// show picture cross
|
||
/// </summary>
|
||
public override bool showPictureCross()
|
||
{
|
||
|
||
#if UNITY_EDITOR
|
||
return false;
|
||
#else
|
||
return TGiOSAdManager.Instance.showPictureCross();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// remove picture cross
|
||
/// </summary>
|
||
public override void removePictureCross()
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.removePictureCross();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// show more game icon
|
||
/// </summary>
|
||
public override bool showMoreGameIcon()
|
||
{
|
||
|
||
#if UNITY_EDITOR
|
||
return false;
|
||
#else
|
||
return TGiOSAdManager.Instance.showMoreGameIcon();
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// remove more game icon
|
||
/// </summary>
|
||
public override void removeMoreGameIcon()
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.removeMoreGameIcon();
|
||
#endif
|
||
}
|
||
|
||
|
||
public override void RegistAPNS()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.registAPNS();
|
||
#endif
|
||
}
|
||
|
||
public override void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.registNotification(notiId,body,fireDate,badge,title,subTitle);
|
||
#endif
|
||
}
|
||
|
||
public override void RemoveNotification(string notiId)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.removeNotification(notiId);
|
||
#endif
|
||
}
|
||
|
||
public override void RemoveAllNotifications()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.removeAllNotifications();
|
||
#endif
|
||
}
|
||
#endregion
|
||
|
||
#region Others (Uncommon)
|
||
|
||
/// <summary>
|
||
/// shake(no repeat)
|
||
/// </summary>
|
||
/// <param name="_shakeTime"> shake time </param>
|
||
public override void shake(int _shakeType, float _intensity = 1)
|
||
{
|
||
TGiOSAdManager.Instance.shake(_shakeType,_intensity);
|
||
}
|
||
|
||
/// <summary>
|
||
/// get a iap product list for sdk config file
|
||
/// </summary>
|
||
public override Dictionary<string, string> GetIAPProductList()
|
||
{
|
||
return TGiOSAdManager.Instance.getIAPProductList() ;
|
||
}
|
||
|
||
/// <summary>
|
||
/// set segment type to sdk
|
||
/// </summary>
|
||
/// <param name="type">segment type</param>
|
||
public override void SetSegment(SegmentType type)
|
||
{
|
||
TGiOSAdManager.Instance.SetSegment(type.ToString());
|
||
}
|
||
|
||
public override bool IsDebugMode()
|
||
{
|
||
return TGiOSAdManager.Instance.isDebugMode();
|
||
}
|
||
|
||
/// <summary>
|
||
/// get user name and user id card
|
||
/// </summary>
|
||
public override string GetUserNameAndUserIDCard()
|
||
{
|
||
return TGiOSAdManager.Instance.getUserNameAndUserIDCard();
|
||
}
|
||
/// <summary>
|
||
/// shake(can repeat)
|
||
/// </summary>
|
||
/// <param name="_repeatTimes"> repeat times : -1 </param>
|
||
/// <param name="_shakeTime"> wait time,shake time(100,1000,100,111)</param>
|
||
//public override void shake(int _repeatTimes, params int[] _shakeTime)
|
||
//{
|
||
|
||
//}
|
||
|
||
/// <summary>
|
||
/// cancel shake
|
||
/// </summary>
|
||
public override void cancelShake()
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Show Tips
|
||
/// Pop-up prompt (the one with black transparent background) unified style, Chinese, Japanese, Korean and English, support multi-language, multi-language text
|
||
///
|
||
/// game judges different languages by itself and passes different strings
|
||
/// </summary>
|
||
/// <param name="_titleStr"> title </param>
|
||
/// <param name="_contentStr"> content </param>
|
||
public override void dialogTips(string _titleStr, string _contentStr)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Open ULR by Browser
|
||
/// </summary>
|
||
/// <param name="_url"></param>
|
||
public override void openUrlBrowser(string _url)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Open ULR By WEB POP
|
||
/// </summary>
|
||
/// <param name="_url"></param>
|
||
public override void openWebUrl(string _url)
|
||
{
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// show Toast
|
||
/// </summary>
|
||
/// <param name="_content"></param>
|
||
public override void toast(string _content)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.Toast(_content);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// push message
|
||
/// </summary>
|
||
public override void pushMsg()
|
||
{
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 数据中台
|
||
|
||
public override void LogPurchasePrice(string price,string currency)
|
||
{
|
||
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LogPurchasePrice(price,currency);
|
||
#endif
|
||
}
|
||
|
||
public override void LogRobuxCashOut()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LogRobuxCashOut();
|
||
#endif
|
||
}
|
||
|
||
public override void LogNoviceGuideFinish()
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.LogNoviceGuideFinish();
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region common callback
|
||
|
||
public override void SetSDKCommonCallback(AndroidTKGCommonCalllback _commonCallback)
|
||
{
|
||
|
||
}
|
||
|
||
public override void SetUserSourceCallback(AndroidTKGUserSourceCalllback _userSourceCallback)
|
||
{
|
||
|
||
}
|
||
|
||
public override void SetUserSourceCallback(AndroidTKGUserSourceCalllbackWithCampaignName _userSourceCallback)
|
||
{
|
||
|
||
}
|
||
|
||
public override void SetFunctionSwitchCalllback(List<FunctionType> _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);
|
||
}
|
||
|
||
public override bool GuidGpComment()
|
||
{
|
||
return false;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 用户登录
|
||
public override void Login(LoginType loginType, Action<LoginStatus, LoginType, string, string, string, string,string,string> _loginResultCallback = null)
|
||
{
|
||
TKGSDKCallback.mLoginCallback = _loginResultCallback;
|
||
TKGiOSLoginManager.Instance.Login(loginType);
|
||
}
|
||
|
||
public override void Logout(Action _logoutCallback = null)
|
||
{
|
||
TKGSDKCallback.mLogoutCallback = _logoutCallback;
|
||
TKGiOSLoginManager.Instance.Logout();
|
||
}
|
||
|
||
public override List<LoginType> AvailableLoginChannelList()
|
||
{
|
||
return TKGiOSLoginManager.Instance.AvailableLoginChannelList();
|
||
}
|
||
|
||
public override void DeleteAccount(Action<DeleteStatus,string> _deleteAccountCallback = null)
|
||
{
|
||
TKGSDKCallback.mDeleteAccountCallback = _deleteAccountCallback;
|
||
TKGiOSLoginManager.Instance.DeleteAccount();
|
||
}
|
||
|
||
public override void BindAccount(LoginType type, BindType isForce, string userId, Action<BindAccountStatus, LoginType, string, string, string, string, string, string, string[]> bindAccountCallback)
|
||
{
|
||
TKGSDKCallback.mBindAccountCallback = bindAccountCallback;
|
||
TKGiOSLoginManager.Instance.BindAccount(type,isForce,userId);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region IAP Event
|
||
|
||
/// <summary>
|
||
/// Log IAP button show
|
||
/// </summary>
|
||
/// <param name="_productName">Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100</param>
|
||
/// <param name="_productID">Product ID: The ID of a specific product type</param>
|
||
/// <param name="_currency">Currency ex:USD</param>
|
||
/// <param name="_price">Price</param>
|
||
public override void LogIAPBtnShow(string _productName, string _productID)
|
||
{
|
||
Dictionary<string, string> _keyValues = new Dictionary<string, string>();
|
||
_keyValues.Add("IAP", _productName);
|
||
_keyValues.Add("ID", _productID);
|
||
//_keyValues.Add("Currency", _currency);
|
||
//_keyValues.Add("Price", _price);
|
||
onEvent("IAP_Button_Show", _keyValues);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Log IAP button Click
|
||
/// </summary>
|
||
/// <param name="_productName">Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100</param>
|
||
/// <param name="_productID">Product ID: The ID of a specific product type</param>
|
||
/// <param name="_currency">Currency ex:USD</param>
|
||
/// <param name="_price">Price</param>
|
||
public override void LogIAPBtnClick(string _productName, string _productID)
|
||
{
|
||
Dictionary<string, string> _keyValues = new Dictionary<string, string>();
|
||
_keyValues.Add("IAP", _productName);
|
||
_keyValues.Add("ID", _productID);
|
||
//_keyValues.Add("Currency", _currency);
|
||
//_keyValues.Add("Price", _price);
|
||
onEvent("IAP_Button_Click", _keyValues);
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Log IAP First payment successful
|
||
/// </summary>
|
||
/// <param name="_iap">Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100</param>
|
||
/// <param name="_id">Product ID: The ID of a specific product type</param>
|
||
/// <param name="_currency">Currency ex:USD</param>
|
||
/// <param name="_price">Price</param>
|
||
public override void LogIAPFirstPurchase(string _iap, string _id, string _paymentChannelOrderid, string _currency, string _price)
|
||
{
|
||
// native 层实现
|
||
//Dictionary<string, string> _keyValues = new Dictionary<string, string>();
|
||
//_keyValues.Add("IAP", _iap);
|
||
//_keyValues.Add("ID", _id);
|
||
//_keyValues.Add("Currency", _currency);
|
||
//_keyValues.Add("Price", _price);
|
||
//_keyValues.Add("order_id", _paymentChannelOrderid);
|
||
//onEvent("First_purchase", _keyValues);
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Log IAP payment successful
|
||
/// </summary>
|
||
/// <param name="_iap">Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100</param>
|
||
/// <param name="_id">Product ID: The ID of a specific product type</param>
|
||
/// <param name="_gameOrderid">The order id on the game side</param>
|
||
/// <param name="_paymentChannelOrderid">The order id returned by the payment channel</param>
|
||
/// <param name="_productToken">Purchase token: When the purchase is successful on GP, a purchase token will be generated as a unique identifier</param>
|
||
/// <param name="_paymentMethod">Official payment channels: appstore, googleplay, other payment channels corresponding channel name</param>
|
||
/// <param name="_currency">Currency ex:USD</param>
|
||
/// <param name="_price">Price</param>
|
||
public override void LogIAPSuccess(string _iap, string _id, string _gameOrderid, string _paymentChannelOrderid, string _productToken, string _paymentMethod, string _currency, string _price)
|
||
{
|
||
//Dictionary<string, string> _keyValues = new Dictionary<string, string>();
|
||
//_keyValues.Add("IAP", _iap);
|
||
//_keyValues.Add("ID", _id);
|
||
//_keyValues.Add("Currency", _currency);
|
||
//_keyValues.Add("Price", _price);
|
||
//_keyValues.Add("order_id", _paymentChannelOrderid);
|
||
//onEvent("IAP_Success", _keyValues);
|
||
|
||
//Dictionary<string, string> _dataCenterDict = new Dictionary<string, string>();
|
||
//_dataCenterDict.Add("iap_name", _iap);
|
||
//_dataCenterDict.Add("product_id",_id);
|
||
//_dataCenterDict.Add("game_order_id",_gameOrderid);
|
||
//_dataCenterDict.Add("order_id",_paymentChannelOrderid);
|
||
//_dataCenterDict.Add("purchase_token", _productToken);
|
||
//_dataCenterDict.Add("payment_method", _paymentMethod);
|
||
//_dataCenterDict.Add("currency", _currency);
|
||
//_dataCenterDict.Add("price", _price);
|
||
//onEvent("IAP_DataCenter",_dataCenterDict);
|
||
|
||
}
|
||
|
||
public override void AutoLogin(Action<LoginStatus, LoginType, string, string, string, string, string, string> loginResultCallback)
|
||
{
|
||
TKGSDKCallback.mLoginCallback = loginResultCallback;
|
||
TKGiOSLoginManager.Instance.AutoLogin();
|
||
}
|
||
|
||
public override LoginType GetAccountType()
|
||
{
|
||
var userType = PlayerPrefs.GetInt("user_type");
|
||
return (LoginType)Enum.ToObject(typeof(LoginType), userType);
|
||
}
|
||
|
||
public override void SaveCloudArchiving(string content, Action<int, string> callback)
|
||
{
|
||
|
||
}
|
||
|
||
public override void DetailCloudArchiving(Action<int, string> callback)
|
||
{
|
||
|
||
}
|
||
|
||
public override bool IsCanAutoLogin()
|
||
{
|
||
|
||
return TKGiOSLoginManager.Instance.IsCanAutoLogin();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region serve for wz
|
||
|
||
/// <summary>
|
||
/// Set userid and third account
|
||
/// </summary>
|
||
/// <param name="_userID"> userID (Unique user id)</param>
|
||
/// <param name="_thirdAccount">third account </param>
|
||
/// <param name="_thirdAccountType"> third account type </param>
|
||
public override void SetUserIDAndThirdAccount(string _userID, string _thirdAccount, ThirdAccountType _thirdAccountType)
|
||
{
|
||
Debug.Log("【TKGNativeInterfaceiOS】 SetUserIDAndThirdAccount _userID : " + _userID + " , _thirdAccount : " + _thirdAccount + " , _thirdAccountType : " + _thirdAccountType);
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.setUserIDAndThirdAccount(_userID, _thirdAccount, _thirdAccountType);
|
||
#endif
|
||
}
|
||
#endregion
|
||
#region client iap pay result
|
||
/// <summary>
|
||
/// Client IAP Success
|
||
/// </summary>
|
||
public override void ClientIAPSuccess(string _productName, string _productID, string _purchaseOrderID, string _purchaseToken, string _currency, string _price, string _gameExtra)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.IAP_ClientIAPSuccess(_productName, _productID, _purchaseOrderID, _purchaseToken, _currency, _price, _gameExtra);
|
||
#endif
|
||
}
|
||
|
||
/// <summary>
|
||
/// Client IAP Failed
|
||
/// </summary>
|
||
public override void ClientIAPFailed(string _productName, string _productID, string _purchaseOrderID, string _purchaseToken, string _currency, string _price, string _gameExtra, IAPClientFailReasonType _failType)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
TGiOSAdManager.Instance.IAP_ClientIAPFailed(_productName, _productID, _purchaseOrderID, _purchaseToken, _currency, _price, _gameExtra, _failType);
|
||
#endif
|
||
}
|
||
|
||
#endregion
|
||
|
||
}
|
||
}
|
||
|
||
#endif |