sdk相关文档提交
parent
f158fa6536
commit
465ca19e84
|
@ -99,6 +99,13 @@ public class App : UnitySingleton<App>
|
|||
return ThinkingAnalyticsManager.Instance;
|
||||
}
|
||||
}
|
||||
public static TapDBManager TBDMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
return TapDBManager.Instance;
|
||||
}
|
||||
}
|
||||
|
||||
//public static SoundManager SoundMgr {
|
||||
// get {
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using GameCore;
|
||||
namespace GameLogic
|
||||
{
|
||||
// 数数 数据平台
|
||||
public class TapDBConfig : MonoBehaviour
|
||||
{
|
||||
|
||||
public string appid = "";
|
||||
void Start()
|
||||
{
|
||||
string v = VersionManager.Instance.GetVersionInfo("version");
|
||||
TapDBManager.Instance.Init(appid, "test", v);
|
||||
}
|
||||
|
||||
void OnApplicationPause(bool pauseStatus)
|
||||
{
|
||||
if (!pauseStatus)
|
||||
TapDB.onResume();
|
||||
else
|
||||
TapDB.onStop();
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
TapDB.onStop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class TapDBManager : UnitySingleton<TapDBManager>
|
||||
{
|
||||
|
||||
public void Init(string appId, string channel, string version)
|
||||
{
|
||||
Debug.LogWarning("TapDBManager:Init " + appId);
|
||||
TapDB.onStart(appId, channel, version);
|
||||
}
|
||||
|
||||
public void SetUser(string userId)
|
||||
{
|
||||
Debug.LogWarning("TapDBManager:SetUser " + userId);
|
||||
TapDB.setUser(userId);
|
||||
}
|
||||
|
||||
public void SetServer(string serverId)
|
||||
{
|
||||
Debug.LogWarning("TapDBManager:SetServer " + serverId);
|
||||
TapDB.setServer(serverId);
|
||||
}
|
||||
|
||||
public void SetLevel(int level)
|
||||
{
|
||||
Debug.LogWarning("TapDBManager:SetLevel " + level);
|
||||
TapDB.setLevel(level);
|
||||
}
|
||||
|
||||
public void onChargeSuccess(string orderId, string goodsId, Int32 amount, string currencyType, string payment)
|
||||
{
|
||||
Debug.LogWarning("TapDBManager:onChargeSuccess " + orderId);
|
||||
TapDB.onChargeSuccess(orderId, goodsId, amount, currencyType, payment);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 54b4453692b964811aa1c221fd236d88
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: efe6f661015f9184f96e9799e1c15828
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,27 @@
|
|||
TapDBManager = {}
|
||||
local this = TapDBManager
|
||||
function this.Initialize()
|
||||
end
|
||||
|
||||
function this.SetUser()
|
||||
App.TBDMgr:SetUser()
|
||||
end
|
||||
|
||||
|
||||
function this.SetUser(userId)
|
||||
App.TBDMgr:SetUser(userId)
|
||||
end
|
||||
|
||||
function this.SetServer(serverId)
|
||||
App.TBDMgr:SetUser(serverId)
|
||||
end
|
||||
function this.SetLevel(level)
|
||||
App.TBDMgr:SetUser(level)
|
||||
end
|
||||
function this.onChargeSuccess(orderId, goodsId, amount, currencyType, payment)
|
||||
App.TBDMgr:SetUser(orderId)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return TapDBManager
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b46d64565848c4e42a78897478ce6530
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,6 +1,5 @@
|
|||
ThinkingAnalyticsManager = {}
|
||||
local this = ThinkingAnalyticsManager
|
||||
Dictionary = System.Collections.Generic.Dictionary
|
||||
|
||||
function this.Initialize()
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f6e79bbb85e442f5bf4e21515682de3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"supplier":{
|
||||
"vivo":{
|
||||
"appid":"100215079"
|
||||
},
|
||||
"xiaomi":{
|
||||
|
||||
},
|
||||
"huawei":{
|
||||
|
||||
},
|
||||
"oppo":{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e72526eb684145e9aef51cbc637ccce
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,32 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8319bdb36195a4724ad26c4315e42198
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,32 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f0d37cbfa6c44666a584b9538d0d94c
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e50ec0e302db142609b03adb5a5eab6f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,399 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using TapDBMiniJSON;
|
||||
using System;
|
||||
|
||||
// version 2.1.4
|
||||
|
||||
// 帐户类型
|
||||
public enum TGTUserType{
|
||||
TGTTypeAnonymous = 0, // 匿名用户
|
||||
TGTTypeRegistered = 1,// 注册用户
|
||||
}
|
||||
|
||||
// 用户性别
|
||||
public enum TGTUserSex{
|
||||
TGTSexMale = 0, // 男性
|
||||
TGTSexFemale = 1, // 女性
|
||||
TGTSexUnknown = 2, // 性别未知
|
||||
}
|
||||
|
||||
public class TapDB
|
||||
{
|
||||
#if UNITY_IOS
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetHost(string host);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetCustomEventHost(string host);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnStart(string appId, string channel, string gameVersion);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetUser(string userId);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetLevel(int level);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetName(string name);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeSetServer(string server);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnChargeRequest(string orderId, string product, Int32 amount, string currencyType, string payment);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnChargeSuccess(string orderId, string product, Int32 amount, string currencyType, string payment);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeDeprecatedOnChargeSuccess(string orderId);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnChargeFail(string orderId, string reason);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnChargeOnlySuccess(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment);
|
||||
|
||||
[DllImport ("__Internal")]
|
||||
public static extern void TapDB_nativeOnEvent(string eventCode, string properties);
|
||||
|
||||
#elif UNITY_ANDROID
|
||||
public static string JAVA_CLASS = "com.tapdb.sdk.TapDB";
|
||||
private static string UNTIFY_CLASS = "com.unity3d.player.UnityPlayer";
|
||||
private static AndroidJavaClass agent = null;
|
||||
private static AndroidJavaClass unityClass = null;
|
||||
|
||||
private static AndroidJavaClass getAgent() {
|
||||
if (agent == null) {
|
||||
agent = new AndroidJavaClass(JAVA_CLASS);
|
||||
}
|
||||
return agent;
|
||||
}
|
||||
|
||||
private static AndroidJavaClass getUnityClass(){
|
||||
if (unityClass == null) {
|
||||
unityClass = new AndroidJavaClass(UNTIFY_CLASS);
|
||||
}
|
||||
return unityClass;
|
||||
}
|
||||
|
||||
private static void TapDB_nativeInit(string appId, string channel, string gameVersion){
|
||||
|
||||
AndroidJavaObject activity = getUnityClass().GetStatic<AndroidJavaObject>("currentActivity");
|
||||
getAgent().CallStatic("init", activity, appId, channel, gameVersion);
|
||||
}
|
||||
|
||||
private static void TapDB_nativeOnResume(){
|
||||
Debug.Log ("TapDB_nativeOnResume");
|
||||
AndroidJavaObject activity = getUnityClass().GetStatic<AndroidJavaObject>("currentActivity");
|
||||
getAgent().CallStatic("onResume", activity);
|
||||
}
|
||||
|
||||
private static void TapDB_nativeOnStop(){
|
||||
AndroidJavaObject activity = getUnityClass().GetStatic<AndroidJavaObject>("currentActivity");
|
||||
getAgent().CallStatic("onStop", activity);
|
||||
}
|
||||
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnitySetHost(string host);
|
||||
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnityOnStart(string appId, string channel, string version);
|
||||
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnitySetUser(string userId, string userName);
|
||||
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnitySetLevel(int level);
|
||||
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnitySetServer(string server);
|
||||
|
||||
[DllImport ("TapDB")]
|
||||
public static extern void UnityOnCharge(string orderId, string product, int amount, string currencyType, int virtualCurrencyAmount, string payment);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* 调用该接口修改数据发送的域名,有特殊需要时调用,调用必须位于初始化之前
|
||||
* 域名必须是https://abc.example.com/的格式,不能为空
|
||||
*/
|
||||
public static void setHost(string host){
|
||||
if (host == null) {
|
||||
host = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetHost(host);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setHost", host);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnitySetHost(host);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用该接口修改数据发送的域名,有特殊需要时调用,调用必须位于初始化之前
|
||||
* 域名必须是https://abc.example.com/的格式,不能为空
|
||||
*/
|
||||
public static void setCustomEventHost(string host){
|
||||
if (host == null) {
|
||||
host = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetCustomEventHost(host);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setCustomEventHost", host);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化,尽早调用
|
||||
* appId: TapDB注册得到的appId
|
||||
* channel: 分包渠道名称,可为空
|
||||
* gameVersion: 游戏版本,可为空,为空时,自动获取游戏安装包的版本
|
||||
*/
|
||||
public static void onStart(string appId, string channel, string gameVersion){
|
||||
if (appId == null) {
|
||||
appId = "";
|
||||
}
|
||||
if (channel == null) {
|
||||
channel = "";
|
||||
}
|
||||
if (gameVersion == null) {
|
||||
gameVersion = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnStart(appId, channel, gameVersion);
|
||||
#elif UNITY_ANDROID
|
||||
TapDB_nativeInit(appId, channel, gameVersion);
|
||||
// TapDB_nativeOnResume();
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnityOnStart(appId, channel, gameVersion);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void onResume(){
|
||||
#if UNITY_ANDROID
|
||||
TapDB_nativeOnResume();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void onStop(){
|
||||
#if UNITY_ANDROID
|
||||
TapDB_nativeOnStop();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录一个用户(注意是平台用户,不是游戏角色!!!!),需要保证唯一性
|
||||
* userId: 用户的ID(注意是平台用户ID,不是游戏角色ID!!!!),如果是匿名用户,由游戏生成,需要保证不同平台用户的唯一性
|
||||
* userType: 用户类型
|
||||
* userSex: 用户性别
|
||||
* userAge: 用户年龄,年龄未知传递0
|
||||
*/
|
||||
[Obsolete("接口已弃用,调用setUser(string userId)")]
|
||||
public static void setUser(string userId, TGTUserType userType, TGTUserSex userSex, int userAge, string userName){
|
||||
if (userId == null) {
|
||||
userId = "";
|
||||
}
|
||||
if (userName == null) {
|
||||
userName = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetUser(userId);
|
||||
TapDB_nativeSetName(userName);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setUser", userId);
|
||||
getAgent().CallStatic("setName", userName);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnitySetUser(userId, userName);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录一个用户(注意是平台用户,不是游戏角色!!!!),需要保证唯一性
|
||||
* userId: 用户的ID(注意是平台用户ID,不是游戏角色ID!!!!),如果是匿名用户,由游戏生成,需要保证不同平台用户的唯一性
|
||||
*/
|
||||
public static void setUser(string userId){
|
||||
if (userId == null) {
|
||||
userId = "";
|
||||
}
|
||||
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetUser(userId);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setUser", userId);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnitySetUser(userId, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户等级,初次设置时或升级时调用
|
||||
* level: 等级
|
||||
*/
|
||||
public static void setLevel(int level){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetLevel(level);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setLevel", level);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnitySetLevel(level);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户名
|
||||
* name: 用户名
|
||||
*/
|
||||
public static void setName(string name){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetName(name);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setName", name);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户服务器,初次设置或更改服务器的时候调用
|
||||
* server: 服务器
|
||||
*/
|
||||
public static void setServer(string server){
|
||||
if (server == null) {
|
||||
server = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeSetServer(server);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("setServer", server);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnitySetServer(server);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起充值请求时调用
|
||||
* orderId: 订单ID,不能为空
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(分)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* virtualCurrencyAmount: 充值获得的虚拟币
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
[Obsolete("接口已弃用")]
|
||||
public static void onChargeRequest(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnChargeRequest(orderId, product, amount, currencyType, payment);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onChargeRequest", orderId, product, (long)amount, currencyType, (long)virtualCurrencyAmount, payment);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值成功时调用
|
||||
* orderId: 订单ID,不能为空,与上一个接口的orderId对应
|
||||
*/
|
||||
[Obsolete("已弃用,请调用onChargeSuccess(string orderId, string product, Int32 amount, string currencyType, string payment)")]
|
||||
public static void onChargeSuccess(string orderId){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeDeprecatedOnChargeSuccess(orderId);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onChargeSuccess", orderId);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值成功时调用
|
||||
* orderId: 订单ID,不能为空,与上一个接口的orderId对应
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(单位分,即无论什么币种,都需要乘以100)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
public static void onChargeSuccess(string orderId, string product, Int32 amount, string currencyType, string payment){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnChargeSuccess(orderId,product,amount,currencyType,payment);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onCharge", orderId,product,(long)amount,currencyType,payment);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值失败时调用
|
||||
* orderId: 订单ID,不能为空,与上一个接口的orderId对应
|
||||
* reason: 失败原因,可为空
|
||||
*/
|
||||
[Obsolete("接口已弃用")]
|
||||
public static void onChargeFail(string orderId, string reason){
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnChargeFail(orderId, reason);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onChargeFail", orderId, reason);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息
|
||||
* orderId: 订单ID,可为空
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(单位分,即无论什么币种,都需要乘以100)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* virtualCurrencyAmount: 充值获得的虚拟币
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
[Obsolete("已弃用,请调用onChargeSuccess:product:amount:currencyType:payment")]
|
||||
public static void onChargeOnlySuccess(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment){
|
||||
if (orderId == null) {
|
||||
orderId = "";
|
||||
}
|
||||
if (product == null) {
|
||||
product = "";
|
||||
}
|
||||
if (currencyType == null) {
|
||||
currencyType = "";
|
||||
}
|
||||
if (payment == null) {
|
||||
payment = "";
|
||||
}
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnChargeOnlySuccess(orderId, product, amount, currencyType, virtualCurrencyAmount, payment);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onChargeOnlySuccess", orderId, product, (long)amount, currencyType, (long)virtualCurrencyAmount, payment);
|
||||
#elif UNITY_STANDALONE_WIN
|
||||
UnityOnCharge(orderId, product, amount, currencyType, virtualCurrencyAmount, payment);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义事件
|
||||
* eventCode: 事件代码,需要在控制后台预先进行配置
|
||||
* properties: 事件属性,需要在控制后台预先进行配置
|
||||
*/
|
||||
public static void onEvent(string eventCode, Dictionary<string, object> properties) {
|
||||
if (eventCode == null) {
|
||||
eventCode = "";
|
||||
}
|
||||
if (properties == null) {
|
||||
properties = new Dictionary<string, object>();
|
||||
}
|
||||
string stringProperties = Json.Serialize(properties);
|
||||
|
||||
#if UNITY_IOS
|
||||
TapDB_nativeOnEvent(eventCode, stringProperties);
|
||||
#elif UNITY_ANDROID
|
||||
getAgent().CallStatic("onEventDeprecated", eventCode, stringProperties);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6d7ee9e23c2e945849e4659f78834790
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,547 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Calvin Rien
|
||||
*
|
||||
* Based on the JSON parser by Patrick van Bergen
|
||||
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
|
||||
*
|
||||
* Simplified it so that it doesn't throw exceptions
|
||||
* and can be used in Unity iPhone with maximum code stripping.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace TapDBMiniJSON {
|
||||
// Example usage:
|
||||
//
|
||||
// using UnityEngine;
|
||||
// using System.Collections;
|
||||
// using System.Collections.Generic;
|
||||
// using MiniJSON;
|
||||
//
|
||||
// public class MiniJSONTest : MonoBehaviour {
|
||||
// void Start () {
|
||||
// var jsonString = "{ \"array\": [1.44,2,3], " +
|
||||
// "\"object\": {\"key1\":\"value1\", \"key2\":256}, " +
|
||||
// "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " +
|
||||
// "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " +
|
||||
// "\"int\": 65536, " +
|
||||
// "\"float\": 3.1415926, " +
|
||||
// "\"bool\": true, " +
|
||||
// "\"null\": null }";
|
||||
//
|
||||
// var dict = Json.Deserialize(jsonString) as Dictionary<string,object>;
|
||||
//
|
||||
// Debug.Log("deserialized: " + dict.GetType());
|
||||
// Debug.Log("dict['array'][0]: " + ((List<object>) dict["array"])[0]);
|
||||
// Debug.Log("dict['string']: " + (string) dict["string"]);
|
||||
// Debug.Log("dict['float']: " + (double) dict["float"]); // floats come out as doubles
|
||||
// Debug.Log("dict['int']: " + (long) dict["int"]); // ints come out as longs
|
||||
// Debug.Log("dict['unicode']: " + (string) dict["unicode"]);
|
||||
//
|
||||
// var str = Json.Serialize(dict);
|
||||
//
|
||||
// Debug.Log("serialized: " + str);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// This class encodes and decodes JSON strings.
|
||||
/// Spec. details, see http://www.json.org/
|
||||
///
|
||||
/// JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary.
|
||||
/// All numbers are parsed to doubles.
|
||||
/// </summary>
|
||||
public static class Json {
|
||||
/// <summary>
|
||||
/// Parses the string json into a value
|
||||
/// </summary>
|
||||
/// <param name="json">A JSON string.</param>
|
||||
/// <returns>An List<object>, a Dictionary<string, object>, a double, an integer,a string, null, true, or false</returns>
|
||||
public static object Deserialize(string json) {
|
||||
// save the string for debug information
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Parser.Parse(json);
|
||||
}
|
||||
|
||||
sealed class Parser : IDisposable {
|
||||
const string WORD_BREAK = "{}[],:\"";
|
||||
|
||||
public static bool IsWordBreak(char c) {
|
||||
return Char.IsWhiteSpace(c) || WORD_BREAK.IndexOf(c) != -1;
|
||||
}
|
||||
|
||||
enum TOKEN {
|
||||
NONE,
|
||||
CURLY_OPEN,
|
||||
CURLY_CLOSE,
|
||||
SQUARED_OPEN,
|
||||
SQUARED_CLOSE,
|
||||
COLON,
|
||||
COMMA,
|
||||
STRING,
|
||||
NUMBER,
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL
|
||||
};
|
||||
|
||||
StringReader json;
|
||||
|
||||
Parser(string jsonString) {
|
||||
json = new StringReader(jsonString);
|
||||
}
|
||||
|
||||
public static object Parse(string jsonString) {
|
||||
using (var instance = new Parser(jsonString)) {
|
||||
return instance.ParseValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
json.Dispose();
|
||||
json = null;
|
||||
}
|
||||
|
||||
Dictionary<string, object> ParseObject() {
|
||||
Dictionary<string, object> table = new Dictionary<string, object>();
|
||||
|
||||
// ditch opening brace
|
||||
json.Read();
|
||||
|
||||
// {
|
||||
while (true) {
|
||||
switch (NextToken) {
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.CURLY_CLOSE:
|
||||
return table;
|
||||
default:
|
||||
// name
|
||||
string name = ParseString();
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// :
|
||||
if (NextToken != TOKEN.COLON) {
|
||||
return null;
|
||||
}
|
||||
// ditch the colon
|
||||
json.Read();
|
||||
|
||||
// value
|
||||
table[name] = ParseValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<object> ParseArray() {
|
||||
List<object> array = new List<object>();
|
||||
|
||||
// ditch opening bracket
|
||||
json.Read();
|
||||
|
||||
// [
|
||||
var parsing = true;
|
||||
while (parsing) {
|
||||
TOKEN nextToken = NextToken;
|
||||
|
||||
switch (nextToken) {
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.SQUARED_CLOSE:
|
||||
parsing = false;
|
||||
break;
|
||||
default:
|
||||
object value = ParseByToken(nextToken);
|
||||
|
||||
array.Add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
object ParseValue() {
|
||||
TOKEN nextToken = NextToken;
|
||||
return ParseByToken(nextToken);
|
||||
}
|
||||
|
||||
object ParseByToken(TOKEN token) {
|
||||
switch (token) {
|
||||
case TOKEN.STRING:
|
||||
return ParseString();
|
||||
case TOKEN.NUMBER:
|
||||
return ParseNumber();
|
||||
case TOKEN.CURLY_OPEN:
|
||||
return ParseObject();
|
||||
case TOKEN.SQUARED_OPEN:
|
||||
return ParseArray();
|
||||
case TOKEN.TRUE:
|
||||
return true;
|
||||
case TOKEN.FALSE:
|
||||
return false;
|
||||
case TOKEN.NULL:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
string ParseString() {
|
||||
StringBuilder s = new StringBuilder();
|
||||
char c;
|
||||
|
||||
// ditch opening quote
|
||||
json.Read();
|
||||
|
||||
bool parsing = true;
|
||||
while (parsing) {
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c) {
|
||||
case '"':
|
||||
parsing = false;
|
||||
break;
|
||||
case '\\':
|
||||
if (json.Peek() == -1) {
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c) {
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
s.Append(c);
|
||||
break;
|
||||
case 'b':
|
||||
s.Append('\b');
|
||||
break;
|
||||
case 'f':
|
||||
s.Append('\f');
|
||||
break;
|
||||
case 'n':
|
||||
s.Append('\n');
|
||||
break;
|
||||
case 'r':
|
||||
s.Append('\r');
|
||||
break;
|
||||
case 't':
|
||||
s.Append('\t');
|
||||
break;
|
||||
case 'u':
|
||||
var hex = new char[4];
|
||||
|
||||
for (int i=0; i< 4; i++) {
|
||||
hex[i] = NextChar;
|
||||
}
|
||||
|
||||
s.Append((char) Convert.ToInt32(new string(hex), 16));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s.Append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
object ParseNumber() {
|
||||
string number = NextWord;
|
||||
|
||||
if (number.IndexOf('.') == -1) {
|
||||
long parsedInt;
|
||||
Int64.TryParse(number, out parsedInt);
|
||||
return parsedInt;
|
||||
}
|
||||
|
||||
double parsedDouble;
|
||||
Double.TryParse(number, out parsedDouble);
|
||||
return parsedDouble;
|
||||
}
|
||||
|
||||
void EatWhitespace() {
|
||||
while (Char.IsWhiteSpace(PeekChar)) {
|
||||
json.Read();
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char PeekChar {
|
||||
get {
|
||||
return Convert.ToChar(json.Peek());
|
||||
}
|
||||
}
|
||||
|
||||
char NextChar {
|
||||
get {
|
||||
return Convert.ToChar(json.Read());
|
||||
}
|
||||
}
|
||||
|
||||
string NextWord {
|
||||
get {
|
||||
StringBuilder word = new StringBuilder();
|
||||
|
||||
while (!IsWordBreak(PeekChar)) {
|
||||
word.Append(NextChar);
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return word.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
TOKEN NextToken {
|
||||
get {
|
||||
EatWhitespace();
|
||||
|
||||
if (json.Peek() == -1) {
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
|
||||
switch (PeekChar) {
|
||||
case '{':
|
||||
return TOKEN.CURLY_OPEN;
|
||||
case '}':
|
||||
json.Read();
|
||||
return TOKEN.CURLY_CLOSE;
|
||||
case '[':
|
||||
return TOKEN.SQUARED_OPEN;
|
||||
case ']':
|
||||
json.Read();
|
||||
return TOKEN.SQUARED_CLOSE;
|
||||
case ',':
|
||||
json.Read();
|
||||
return TOKEN.COMMA;
|
||||
case '"':
|
||||
return TOKEN.STRING;
|
||||
case ':':
|
||||
return TOKEN.COLON;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
return TOKEN.NUMBER;
|
||||
}
|
||||
|
||||
switch (NextWord) {
|
||||
case "false":
|
||||
return TOKEN.FALSE;
|
||||
case "true":
|
||||
return TOKEN.TRUE;
|
||||
case "null":
|
||||
return TOKEN.NULL;
|
||||
}
|
||||
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
|
||||
/// </summary>
|
||||
/// <param name="json">A Dictionary<string, object> / List<object></param>
|
||||
/// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
|
||||
public static string Serialize(object obj) {
|
||||
return Serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
sealed class Serializer {
|
||||
StringBuilder builder;
|
||||
|
||||
Serializer() {
|
||||
builder = new StringBuilder();
|
||||
}
|
||||
|
||||
public static string Serialize(object obj) {
|
||||
var instance = new Serializer();
|
||||
|
||||
instance.SerializeValue(obj);
|
||||
|
||||
return instance.builder.ToString();
|
||||
}
|
||||
|
||||
void SerializeValue(object value) {
|
||||
IList asList;
|
||||
IDictionary asDict;
|
||||
string asStr;
|
||||
|
||||
if (value == null) {
|
||||
builder.Append("null");
|
||||
} else if ((asStr = value as string) != null) {
|
||||
SerializeString(asStr);
|
||||
} else if (value is bool) {
|
||||
builder.Append((bool) value ? "true" : "false");
|
||||
} else if ((asList = value as IList) != null) {
|
||||
SerializeArray(asList);
|
||||
} else if ((asDict = value as IDictionary) != null) {
|
||||
SerializeObject(asDict);
|
||||
} else if (value is char) {
|
||||
SerializeString(new string((char) value, 1));
|
||||
} else {
|
||||
SerializeOther(value);
|
||||
}
|
||||
}
|
||||
|
||||
void SerializeObject(IDictionary obj) {
|
||||
bool first = true;
|
||||
|
||||
builder.Append('{');
|
||||
|
||||
foreach (object e in obj.Keys) {
|
||||
if (!first) {
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeString(e.ToString());
|
||||
builder.Append(':');
|
||||
|
||||
SerializeValue(obj[e]);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append('}');
|
||||
}
|
||||
|
||||
void SerializeArray(IList anArray) {
|
||||
builder.Append('[');
|
||||
|
||||
bool first = true;
|
||||
|
||||
foreach (object obj in anArray) {
|
||||
if (!first) {
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeValue(obj);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append(']');
|
||||
}
|
||||
|
||||
void SerializeString(string str) {
|
||||
builder.Append('\"');
|
||||
|
||||
char[] charArray = str.ToCharArray();
|
||||
foreach (var c in charArray) {
|
||||
switch (c) {
|
||||
case '"':
|
||||
builder.Append("\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
builder.Append("\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
builder.Append("\\b");
|
||||
break;
|
||||
case '\f':
|
||||
builder.Append("\\f");
|
||||
break;
|
||||
case '\n':
|
||||
builder.Append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.Append("\\r");
|
||||
break;
|
||||
case '\t':
|
||||
builder.Append("\\t");
|
||||
break;
|
||||
default:
|
||||
int codepoint = Convert.ToInt32(c);
|
||||
if ((codepoint >= 32) && (codepoint <= 126)) {
|
||||
builder.Append(c);
|
||||
} else {
|
||||
builder.Append("\\u");
|
||||
builder.Append(codepoint.ToString("x4"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
builder.Append('\"');
|
||||
}
|
||||
|
||||
void SerializeOther(object value) {
|
||||
// NOTE: decimals lose precision during serialization.
|
||||
// They always have, I'm just letting you know.
|
||||
// Previously floats and doubles lost precision too.
|
||||
if (value is float) {
|
||||
builder.Append(((float) value).ToString("R"));
|
||||
} else if (value is int
|
||||
|| value is uint
|
||||
|| value is long
|
||||
|| value is sbyte
|
||||
|| value is byte
|
||||
|| value is short
|
||||
|| value is ushort
|
||||
|| value is ulong) {
|
||||
builder.Append(value);
|
||||
} else if (value is double
|
||||
|| value is decimal) {
|
||||
builder.Append(Convert.ToDouble(value).ToString("R"));
|
||||
} else {
|
||||
SerializeString(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6bdc8bf2d0f25482babb6a2717f0234f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,28 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 763e5d3603c9c41648ab42ca69641d17
|
||||
folderAsset: yes
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c5a00d4249234c0abba4bad93c44655
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,135 @@
|
|||
//
|
||||
// TyrantdbGameTracker.h
|
||||
// TapDB_iOS
|
||||
//
|
||||
// Created by JiangJiahao on 2019/7/23.
|
||||
// Copyright © 2019 JiangJiahao. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// 账户类型
|
||||
typedef NS_ENUM(NSInteger,TGTUserType) {
|
||||
TGTTypeAnonymous = 0, // 匿名用户
|
||||
TGTTypeRegistered // 注册用户
|
||||
};
|
||||
|
||||
// 性别
|
||||
typedef NS_ENUM(NSInteger,TGTUserSex) {
|
||||
TGTSexMale = 0, // 男性
|
||||
TGTSexFemale, // 女性
|
||||
TGTSexUnknown // 性别未知
|
||||
};
|
||||
|
||||
@interface TapDB : NSObject
|
||||
|
||||
/**
|
||||
* 调用该接口修改数据发送的域名,有特殊需要时调用,调用必须位于初始化之前
|
||||
* 域名必须是https://abc.example.com/的格式,不能为空
|
||||
*/
|
||||
+ (void)setHost:(NSString *)host;
|
||||
|
||||
/**
|
||||
* 调用该接口修改自定义事件数据发送的域名,有特殊需要时调用,调用必须位于初始化之前
|
||||
* 域名必须是https://abc.example.com/的格式,不能为空
|
||||
*/
|
||||
+ (void)setCustomEventHost:(NSString *)host;
|
||||
|
||||
/**
|
||||
* 初始化,尽早调用
|
||||
* appId: 注册游戏时获得的APP ID
|
||||
* channel: 分包渠道名称,可为空
|
||||
* gameVersion: 游戏版本,可为空,为空时,自动获取游戏安装包的版本(Xcode配置中的Version)
|
||||
*/
|
||||
+ (void)onStart:(NSString *)appId channel:(NSString *)channel version:(NSString *)gameVersion;
|
||||
|
||||
|
||||
/// 记录一个用户(注意是平台用户,不是游戏角色!!!!),需要保证唯一性
|
||||
/// @param userId 用户的ID (注意是平台用户ID,不是游戏角色ID!!!!),如果是匿名用户,由游戏生成,需要保证不同平台用户的唯一性
|
||||
+ (void)setUser:(NSString *)userId;
|
||||
/**
|
||||
* 记录一个用户(注意是平台用户,不是游戏角色!!!!),需要保证唯一性
|
||||
* userId: 用户的ID(注意是平台用户ID,不是游戏角色ID!!!!),如果是匿名用户,由游戏生成,需要保证不同平台用户的唯一性
|
||||
* userType: 用户类型
|
||||
* userSex: 用户性别
|
||||
* userAge: 用户年龄,年龄未知传递0
|
||||
*/
|
||||
+ (void)setUser:(NSString *)userId userType:(TGTUserType)userType userSex:(TGTUserSex)userSex userAge:(NSInteger)userAge userName:(NSString *)userName DEPRECATED_MSG_ATTRIBUTE("已弃用,直接调用 setUser:(NSString *)userId 即可");
|
||||
|
||||
/**
|
||||
* 目前TapDB SDK仅支持单实例模式,如果多次调用onStart方法,只有最初传入的appid生效。调用该函数可以获取生效的信息
|
||||
* 返回值:包含appId和channel的NSDictionary,对应的value均可能为nil
|
||||
*/
|
||||
+ (NSDictionary *)getStartInfo;
|
||||
|
||||
/**
|
||||
* 设置用户等级,初次设置时或升级时调用
|
||||
* level: 等级
|
||||
*/
|
||||
+ (void)setLevel:(NSInteger)level;
|
||||
|
||||
/**
|
||||
* 设置用户服务器,初次设置或更改服务器的时候调用
|
||||
* server: 服务器
|
||||
*/
|
||||
+ (void)setServer:(NSString *)server;
|
||||
|
||||
/// 设置用户名
|
||||
/// @param name 必传,长度大于0并小于等于256,用户名
|
||||
+ (void)setName:(NSString *)name;
|
||||
|
||||
/**
|
||||
* 发起充值请求时调用
|
||||
* orderId: 订单ID,不能为空
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(分)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
+ (void)onChargeRequest:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType payment:(NSString *)payment DEPRECATED_MSG_ATTRIBUTE("已弃用");
|
||||
|
||||
/**
|
||||
* 充值成功时调用
|
||||
* orderId: 订单ID,不能为空,与上一个接口的orderId对应
|
||||
*/
|
||||
+ (void)onChargeSuccess:(NSString *)orderId DEPRECATED_MSG_ATTRIBUTE("已弃用");
|
||||
|
||||
/**
|
||||
* 充值失败时调用
|
||||
* orderId: 订单ID,不能为空,与上一个接口的orderId对应
|
||||
* reason: 失败原因,可为空
|
||||
*/
|
||||
+ (void)onChargeFail:(NSString *)orderId reason:(NSString *)reason DEPRECATED_MSG_ATTRIBUTE("已弃用");
|
||||
|
||||
/**
|
||||
* 充值成功时调用
|
||||
* orderId: 订单ID,可为空
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(单位分,即无论什么币种,都需要乘以100)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
+ (void)onChargeSuccess:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType payment:(NSString *)payment;
|
||||
|
||||
/**
|
||||
* 当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息
|
||||
* orderId: 订单ID,可为空
|
||||
* product: 产品名称,可为空
|
||||
* amount: 充值金额(单位分,即无论什么币种,都需要乘以100)
|
||||
* currencyType: 货币类型,可为空,参考:人民币 CNY,美元 USD;欧元 EUR
|
||||
* virtualCurrencyAmount: 充值获得的虚拟币
|
||||
* payment: 支付方式,可为空,如:支付宝
|
||||
*/
|
||||
+ (void)onChargeOnlySuccess:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment DEPRECATED_MSG_ATTRIBUTE("已弃用,请调用onChargeSuccess:product:amount:currencyType:payment");
|
||||
|
||||
/**
|
||||
* 自定义事件
|
||||
* eventCode: 事件代码,需要在控制后台预先进行配置
|
||||
* properties: 事件属性,需要在控制后台预先进行配置,值为长度大于0并小于等于256的字符串或绝对值小于1E11的浮点数
|
||||
*/
|
||||
+ (void)onEvent:(NSString *)eventCode properties:(NSDictionary *)properties;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c1a184de3fba44ae78a224bae709040b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 26aee4ca97cee45eb8fea922048b12ef
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10859d6988f8b4c609bfc9a12cf39832
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 666321f4559894773809f2dc54797f40
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,114 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ff699d1ee75934ea69e4b3e57668e794
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
- first:
|
||||
'': Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude LinuxUniversal: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
'': OSXIntel
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
'': OSXIntel64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,114 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 392364a75ac664d83b6a5e77fc8d767f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
- first:
|
||||
'': Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude LinuxUniversal: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
'': OSXIntel
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
'': OSXIntel64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Facebook: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Facebook: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: LinuxUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -222,6 +222,7 @@ public static class CustomSettings
|
|||
_GT(typeof(LuaBehaviour)),
|
||||
_GT(typeof(GameManager)),
|
||||
_GT(typeof(ThinkingAnalyticsManager)),
|
||||
_GT(typeof(TapDBManager)),
|
||||
_GT(typeof(LuaManager)),
|
||||
//_GT(typeof(SoundManager)),
|
||||
_GT(typeof(NetworkManager)),
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
AppID:wjtsq7xrwb48t2uw
|
||||
|
||||
接入文档(文档内还有SDK下载地址);
|
||||
https://www.tapdb.com/docs/zh_CN/sdk/iOS.html
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
游戏名称: 太初行测试包
|
||||
appid:e4ecefecc8034cffaa69e81b2c044f2c
|
||||
rhappid:7bb5f604306ccd93fc19f05d3a374e84
|
||||
支付回调:http://kwsdk.17173g.cn/platformPay/MHT/callBack
|
||||
channelid:MHT
|
Binary file not shown.
Loading…
Reference in New Issue