using System;
using System.Collections.Generic;
using UnityEngine;
namespace Touka
{
///
/// TKG Native SDK interface call
///
public abstract class TKGNativeInterface
{
private static TKGNativeInterface _instance;
private string UnitySDKVersion = "3.1.3";
public static TKGNativeInterface Instance
{
get
{
if (_instance == null)
{
#if UNITY_EDITOR || UNITY_STANDLONE
_instance = new TKGNativeInterfaceDefault();
#elif UNITY_ANDROID
_instance = new TKGNativeInterfaceAndroid();
#elif UNITY_IOS
_instance = new TKGNativeInterfaceIOS();
#endif
}
return _instance;
}
}
///
/// init
///
public virtual void Init(Action _initCallback = null)
{
TKGSDKCallback.SetInitCallback(_initCallback);
SetUnitySDKVersion(UnitySDKVersion);
}
///
/// Set game focus
///
///
public virtual void SetGameFocusListener(Action _gameFocusAction)
{
TKGSDKCallback.SetGameFocusCallback(_gameFocusAction);
}
public virtual void SetRewardClickListener(Action _rewardClickAction)
{
TKGSDKCallback.SetRewardClickCallback(_rewardClickAction);
}
///
/// Get Channel
///
///
public abstract string GetChannel();
#region Ads
public abstract void PurchasedRemoveAds();
public abstract void SetUnitySDKVersion(string sdkVersion);
#region Ads Show
public abstract void RemoveNativeAd();
public abstract bool IsReadyNativeAd();
public abstract void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "");
///
/// Show banner Ad
///
/// bannerAlign
public abstract void showBannerAd(TKGBannerAlign _pos);
///
/// Hide Banner Ad
///
public abstract void hideBannerAd();
///
/// Show Interstitial Ad
///
/// auto log event : iv_ad_show
///
public abstract void showInterstitialAd();
///
/// Show Interstitial Ad
///
/// auto log event : iv_ad_show & _adPos(eg.stage_end)
///
///
public abstract void showInterstitialAd(string _adPos, IVADType _IvType = IVADType.IV1);
///
/// Show Reward Ad
///
///
///
public abstract void showRewardAd(string _adPos, int _itemCount = -1);
public abstract void SetShowSDKToast(bool _useSDKToast);
///
/// Show Reward Ad
///
///
///
///
public abstract void showRewardAd(string _adPos, int _itemCount, Dictionary _extraEvent);
///
/// Show Video Ad
///
///
///
public abstract void showVideoAd(string _adPos, int _itemCount = -1);
#endregion
#region Ads isready
///
/// banner isReady
///
///
public abstract bool isBannerAdReady();
///
/// Interstitial isReady
///
///
public abstract bool isInterstitialAdReady();
///
/// Reward isReady
///
///
public abstract bool isRewardAdReady();
///
/// FullScreen isReady
///
///
public abstract bool isVideoAdReady();
#endregion
#region Set Ads callback
///
/// Set Banner Ad Callback
///
///
public abstract void SetBannerAdCallback(AndroidBannerADTKGAdCallback _bannerCallback);
///
/// Set Interstital Ad Callback
///
///
public abstract void setInterstitalAdCallback(AndroidInterADTKGAdCallback _interCallback);
///
/// Set reward Ad Callback
///
///
public abstract void SetRewardAdCallback(AndroidRewardADTKGAdCallback _rewardCallback);
///
/// Set video Ad Callback(full screen ad, reward ad with no reward callback)
///
///
public abstract void setVideoAdCallback(AndroidInterADTKGAdCallback _videoCallback);
#endregion
#region load ads
///
/// load interstitial ad
/// (retry 3 times, per time interval 10s)
///
public abstract void loadInterstitialAD();
///
/// load reward ad
/// (retry 3 times, per time interval 10s)
///
public abstract void loadRewardAD();
///
/// load video ad
/// (retry 3 times, per time interval 10s)
///
public abstract void loadVideoAD();
#endregion
#endregion
#region Log Event
#region Normal
///
/// onEvent
///
///
///
public abstract void onEvent(string _eventName);
///
/// onEvent
///
///
///
///
///
public abstract void onEvent(string _eventName, string _key01, string _value01);
///
/// onEvent
///
///
///
///
///
///
///
public abstract void onEvent(string _eventName, string _key01, string _value01, string _key02, string _value02);
///
/// onEvent
///
///
///
public abstract void onEvent(string _eventName, Dictionary _keyValues);
#endregion
#region Level Event
///
/// Level Start
///
///
public abstract void LevelStart(string _levelId);
///
/// Level end
///
///
///
public abstract void LevelEnd(string _levelId, StageResult _stageResult);
#endregion
#region Tracking Event
///
/// Log Tracking Event
///
///
public abstract void LogTrackingEvent(TrackingEventType _eventType);
#endregion
#endregion
#region Online Config
///
/// get config - int
///
///
///
public abstract int GetConfigInt(string _key, int _default);
///
/// get config - string
///
///
///
///
public abstract string GetConfigString(string _key, string _default);
///
/// get config - bool
///
///
///
///
public abstract bool GetConfigBool(string _key, bool _default);
#endregion
#region Others (Common)
///
/// review
///
public abstract void Review();
///
/// open Privacy url
///
public abstract void OpenPrivacyURL();
///
/// open user term url
///
public abstract void OpenUserTermURL();
///
/// open policy pop
///
public abstract void OpenPolicyPop();
///
/// More Games
///
public abstract void OpenMoreGame();
///
/// if is debug mode
///
public abstract bool IsDebugMode();
///
/// get user name and user id card
///
public abstract string GetUserNameAndUserIDCard();
///
/// set segment type to sdk
///
/// segment type
public abstract void SetSegment(SegmentType type);
///
/// get a iap product list for sdk config file
///
public abstract Dictionary GetIAPProductList();
#endregion
#region Others (Uncommon)
///
/// shake(no repeat)
///
/// shake time
public abstract void shake(int _shakeType, float _intensity = 1);
///
/// shake(can repeat)
///
/// repeat times : -1
/// wait time,shake time(100,1000,100,111)
//public abstract void shake(int _repeatTimes, params int[] _shakeTime);
///
/// cancel shake
///
public abstract void cancelShake();
///
/// 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
///
/// title
/// content
public abstract void dialogTips(string _titleStr, string _contentStr);
///
/// Open ULR by Browser
///
///
public abstract void openUrlBrowser(string _url);
///
/// Open ULR By WEB POP
///
///
public abstract void openWebUrl(string _url);
///
/// show Toast
///
///
public abstract void toast(string _content);
///
/// push message
///
public abstract void pushMsg();
///
/// set log enable
///
///
public abstract void SetLogEnable(bool _enable);
///
/// share txt
///
///
public abstract void ShareTxt(string _shareTxt);
///
/// regist APNS
///
public abstract void RegistAPNS();
///
/// show picture cross
///
public abstract bool showPictureCross();
///
/// remove picture cross
///
public abstract void removePictureCross();
///
/// show more game icon
///
public abstract bool showMoreGameIcon();
///
/// remove more game icon
///
public abstract void removeMoreGameIcon();
///
/// shake
///
/// notification identifier
/// The body of the notification.
/// notify after the time interval. format: yyyy-MM-dd HH:mm:ss
/// The application badge number.
/// The title of the notification.
/// The subtitle of the notification.
public abstract void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle);
///
/// remove all notification
///
public abstract void RemoveAllNotifications();
///
/// remove notification by notification identifier
///
/// notification identifier
public abstract void RemoveNotification(string notiId);
#endregion
#region other callback
///
/// set tkg common callback
///
public abstract void SetSDKCommonCallback(AndroidTKGCommonCalllback _commonCallback);
///
/// set user source callback
///
public abstract void SetUserSourceCallback(AndroidTKGUserSourceCalllback _userSourceCallback);
///
/// set user source callback with CampaignName
///
public abstract void SetUserSourceCallback(AndroidTKGUserSourceCalllbackWithCampaignName _userSourceCallback);
///
/// Set Function Switch Calllback
///
public abstract void SetFunctionSwitchCalllback(List _functionKeys ,AndroidFunctionSwitchCalllback _functionSwitchCalllback);
#endregion
#region 数据中台
public abstract void LogPurchasePrice(string price,string currency);
public abstract void LogRobuxCashOut();
public abstract void LogNoviceGuideFinish();
#endregion
#region GooglePlay评论引导
///
/// Pop up GooglePlay Rate guid
///
public abstract bool GuidGpComment();
#endregion
#region 用户登录
///
/// User Login
///
public abstract void Login(LoginType loginType, Action _loginResultCallback = null);
///
/// Logout
///
public abstract void Logout(Action _logoutCallback = null);
public abstract List AvailableLoginChannelList();
public abstract void DeleteAccount(Action _deleteAccountCallback = null);
public abstract void BindAccount(LoginType type,BindType isForce, string userId,
Action
bindAccountCallback);
public abstract void AutoLogin(
Action loginResultCallback);
public abstract LoginType GetAccountType();
public abstract bool IsCanAutoLogin();
#endregion
#region IAP Event
///
/// Log IAP button show
///
/// Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100
/// Product ID: The ID of a specific product type
public abstract void LogIAPBtnShow(string _productName, string _productID);
///
/// Log IAP button Click
///
/// Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100
/// Product ID: The ID of a specific product type
public abstract void LogIAPBtnClick(string _productName, string _productID);
///
/// Log IAP First payment successful
///
/// Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100
/// Product ID: The ID of a specific product type
/// The order id returned by the payment channel
/// Currency ex:USD
/// Price
public abstract void LogIAPFirstPurchase(string _iap, string _id, string _paymentChannelOrderid, string _currency, string _price);
///
/// Log IAP payment successful
///
/// Product name (customized on the game side) English name of the product cannot contain special characters ex: Gem100
/// Product ID: The ID of a specific product type
/// The order id on the game side
/// The order id returned by the payment channel
/// Purchase token: When the purchase is successful on GP, a purchase token will be generated as a unique identifier
/// Official payment channels: appstore, googleplay, other payment channels corresponding channel name
/// Currency ex:USD
/// Price
public abstract void LogIAPSuccess(string _iap, string _id, string _gameOrderid, string _paymentChannelOrderid, string _productToken, string _paymentMethod, string _currency, string _price);
#endregion
#region MyRegion
public abstract void SaveCloudArchiving(string content, Action callback);
public abstract void DetailCloudArchiving(Action callback);
#endregion
#region serve for wz
///
/// Set userid and third account
///
/// userID (Unique user id)
/// third account
/// third account type
public abstract void SetUserIDAndThirdAccount(string _userID, string _thirdAccount, ThirdAccountType _thirdAccountType);
#endregion
#region client iap pay result
///
/// Client IAP Success
///
public abstract void ClientIAPSuccess(string _productName, string _productID, string _purchaseOrderID, string _purchaseToken, string _currency, string _price, string _gameExtra);
///
/// Client IAP Failed
///
public abstract void ClientIAPFailed(string _productName, string _productID, string _purchaseOrderID, string _purchaseToken, string _currency, string _price, string _gameExtra, IAPClientFailReasonType _failType);
#endregion
}
}