添加包名获取,添加账号创建打点。
parent
f761bd5b9c
commit
95cbec95e0
|
@ -171,7 +171,8 @@ namespace GameLogic
|
|||
public static string SdkId; //SDK UId
|
||||
public static string OpenId; //开天SDK UId
|
||||
public static string TokenStr; //开天SDK Token
|
||||
public static string SdkChannel; //SDK UId
|
||||
public static string SdkChannel; //SDK 渠道
|
||||
public static string SdkPackageName; //SDK包名
|
||||
|
||||
|
||||
public static int Url_JoinRoomID = 0;
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace SDK{
|
|||
public const int MSG_PayCallback = 3;
|
||||
public const int MSG_SwitchAccountCallback = 4;
|
||||
public const int MSG_LogoutCallback = 5;
|
||||
public const int MSG_RegisterCallback = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace SDK
|
|||
public delegate void InitLaunchAction(string data);
|
||||
public InitLaunchAction onInitLaunchCallback;
|
||||
|
||||
public delegate void RegisterAction(string data);
|
||||
public RegisterAction onRegisterCallback;
|
||||
|
||||
public delegate void LoginAction(string data);
|
||||
public LoginAction onLoginCallback;
|
||||
|
||||
|
@ -77,6 +80,12 @@ namespace SDK
|
|||
onInitLaunchCallback(msg.data);
|
||||
}
|
||||
break;
|
||||
case MessageDef.MSG_RegisterCallback:
|
||||
if (null != onLoginCallback)
|
||||
{
|
||||
onRegisterCallback(msg.data);
|
||||
}
|
||||
break;
|
||||
case MessageDef.MSG_LoginCallback:
|
||||
if (null != onLoginCallback)
|
||||
{
|
||||
|
@ -165,6 +174,16 @@ namespace SDK
|
|||
data = data
|
||||
});
|
||||
}
|
||||
//sdk 注册 回调
|
||||
public void RegisterCallback(string data)
|
||||
{
|
||||
Debug.Log("Helper : RegisterCallback - data: " + data);
|
||||
proxy.PushMessage(new Message
|
||||
{
|
||||
msgId = MessageDef.MSG_RegisterCallback,
|
||||
data = data
|
||||
});
|
||||
}
|
||||
//sdk login 回调
|
||||
public void LoginCallback(string data)
|
||||
{
|
||||
|
|
|
@ -64,10 +64,12 @@ function this.UpdateBagData(_itemData, isNoSendNewItemEvent)
|
|||
end
|
||||
|
||||
-- 货币数据
|
||||
ThinkingAnalyticsManager.SetSuperProperties({
|
||||
coins_amount = BagManager.GetItemCountById(14),
|
||||
diamond_amount = BagManager.GetItemCountById(16),
|
||||
})
|
||||
if itemdata.itemId == 14 or itemdata.itemId == 16 then
|
||||
ThinkingAnalyticsManager.SetSuperProperties({
|
||||
coins_amount = BagManager.GetItemCountById(14),
|
||||
diamond_amount = BagManager.GetItemCountById(16),
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ function this.Initialize()
|
|||
this.CurAccount=PlayerPrefs.GetString(this.GameName.."Account",'')
|
||||
this.CurSession=PlayerPrefs.GetString(this.GameName.."Session",'')
|
||||
|
||||
SDKMgr.onRegisterCallback = function(loginResp)
|
||||
-- Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,loginResp)
|
||||
ThinkingAnalyticsManager.Track("create_account")
|
||||
end
|
||||
|
||||
SDKMgr.onLoginCallback = function(loginResp)
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,loginResp)
|
||||
-- ThinkingAnalyticsManager.Track("app_login")
|
||||
|
|
|
@ -237,6 +237,7 @@ function this.RefreshLoginStatus(loginResp)
|
|||
AppConst.OpenId = result[2]
|
||||
AppConst.TokenStr = result[4]
|
||||
AppConst.SdkChannel = result[5]
|
||||
AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
||||
-- this.SetSDKExtensionParams(result[4])
|
||||
Log(string.format("%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s", LoginRoot_Url, AppConst.OpenId, LoginRoot_Channel, LoginRoot_SubChannel))
|
||||
networkMgr:SendGetHttp(string.format("%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s", LoginRoot_Url, AppConst.OpenId, LoginRoot_Channel, LoginRoot_SubChannel),
|
||||
|
@ -388,7 +389,7 @@ function this.OnReceiveLogin(str)
|
|||
AppConst.UserId = data.uid
|
||||
AppConst.Token = data.token
|
||||
local openId = AppConst.isSDKLogin and AppConst.OpenId or PlayerPrefs.GetString(openIdkey)
|
||||
NetManager.LoginRequest(openId, LoginManager.pt_pId, LoginManager.pt_gId, function()
|
||||
NetManager.LoginRequest(openId, function()
|
||||
if not LoginManager.IsLogin then
|
||||
LoginManager.IsLogin = true
|
||||
this.ExecuteLoading()
|
||||
|
@ -516,7 +517,7 @@ function this.OnConnect(network)
|
|||
.. "&platform=" .. 1
|
||||
.. "&sub_channel=" .. LoginRoot_SubChannel
|
||||
.. "&pid=" .. AppConst.SdkChannel --LoginManager.pt_pId
|
||||
.. "&gid=" .. "" --LoginManager.pt_gId
|
||||
.. "&gid=" .. AppConst.SdkPayChannel --LoginManager.pt_gId
|
||||
.. "&version=" .. LoginRoot_PackageVersion)
|
||||
networkMgr:SendGetHttp(LoginRoot_Url
|
||||
.. "jl_loginserver/getUserInfo?openId=" .. AppConst.OpenId
|
||||
|
@ -525,7 +526,7 @@ function this.OnConnect(network)
|
|||
.. "&platform=" .. 1
|
||||
.. "&sub_channel=" .. LoginRoot_SubChannel
|
||||
.. "&pid=" .. AppConst.SdkChannel --LoginManager.pt_pId
|
||||
.. "&gid=" .. "" --LoginManager.pt_gId
|
||||
.. "&gid=" .. AppConst.SdkPayChannel --LoginManager.pt_gId
|
||||
.. "&version=" .. LoginRoot_PackageVersion,
|
||||
this.OnReceiveLogin, nil, nil, nil)
|
||||
else
|
||||
|
|
|
@ -30,7 +30,7 @@ function this.IsConnect()
|
|||
end
|
||||
|
||||
--请求登录
|
||||
function this.LoginRequest(openId, pt_pid, pt_gid, func)
|
||||
function this.LoginRequest(openId, func)
|
||||
local data = PlayerInfoProto_pb.LoginRequest()
|
||||
data.device_id_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetDeviceID() or ""
|
||||
data.idfa_sOr_imei_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetIMEICode() or ""
|
||||
|
@ -43,7 +43,7 @@ function this.LoginRequest(openId, pt_pid, pt_gid, func)
|
|||
data.ip_s = AppConst.isSDK and AndroidDeviceInfo.Instance:GetLocalIpAddress() or ""
|
||||
data.distinct_id = AppConst.isSDK and openId or ""
|
||||
data.openId = openId
|
||||
data.channel_s = pt_pid.."#"..pt_gid
|
||||
data.channel_s = AppConst.isSDK and AppConst.SdkChannel .. "#" .. AppConst.SdkPackageName or "" --pt_pid.."#"..pt_gid
|
||||
data.platform_s = AppConst.isSDK and "ADR" or "PC"
|
||||
|
||||
local msg = data:SerializeToString()
|
||||
|
@ -63,15 +63,12 @@ function this.LoginRequest(openId, pt_pid, pt_gid, func)
|
|||
end
|
||||
end
|
||||
AppConst.Token = msg.newToken
|
||||
|
||||
Log("get package name : "..AndroidDeviceInfo.Instance:GetPackageName())
|
||||
|
||||
-- 打点
|
||||
ThinkingAnalyticsManager.SetDistinctId(AppConst.OpenId)
|
||||
ThinkingAnalyticsManager.SetSuperProperties({
|
||||
server_id = LoginManager.ServerId,
|
||||
account = AppConst.OpenId,
|
||||
["Bundle-id"] = AndroidDeviceInfo.Instance:GetPackageName(),
|
||||
["Bundle-id"] = AppConst.SdkPackageName,
|
||||
xx_id = AppConst.SdkChannel
|
||||
})
|
||||
TapDBManager.SetUser(openId)
|
||||
|
|
|
@ -87,7 +87,9 @@ function this.RequestPay(context)
|
|||
--
|
||||
ThinkingAnalyticsManager.Track("create_order", {
|
||||
goods_id = context.Id,
|
||||
goods_name = context.Name,
|
||||
order_money_amount = context.Price,
|
||||
["Bundle-id"] = AppConst.SdkPackageName,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public class GameLogic_AppConstWrap
|
|||
L.RegVar("OpenId", get_OpenId, set_OpenId);
|
||||
L.RegVar("TokenStr", get_TokenStr, set_TokenStr);
|
||||
L.RegVar("SdkChannel", get_SdkChannel, set_SdkChannel);
|
||||
L.RegVar("SdkPackageName", get_SdkPackageName, set_SdkPackageName);
|
||||
L.RegVar("Url_JoinRoomID", get_Url_JoinRoomID, set_Url_JoinRoomID);
|
||||
L.RegConstant("AppID", 129213);
|
||||
L.RegVar("AppKey", get_AppKey, null);
|
||||
|
@ -798,6 +799,20 @@ public class GameLogic_AppConstWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int get_SdkPackageName(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
LuaDLL.lua_pushstring(L, GameLogic.AppConst.SdkPackageName);
|
||||
return 1;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int get_Url_JoinRoomID(IntPtr L)
|
||||
{
|
||||
|
@ -1837,6 +1852,21 @@ public class GameLogic_AppConstWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int set_SdkPackageName(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
string arg0 = ToLua.CheckString(L, 2);
|
||||
GameLogic.AppConst.SdkPackageName = arg0;
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int set_Url_JoinRoomID(IntPtr L)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ public class SDK_SDKManagerWrap
|
|||
L.RegFunction("GetPayOrderID", GetPayOrderID);
|
||||
L.RegFunction("CaptureShot", CaptureShot);
|
||||
L.RegFunction("InitCallback", InitCallback);
|
||||
L.RegFunction("RegisterCallback", RegisterCallback);
|
||||
L.RegFunction("LoginCallback", LoginCallback);
|
||||
L.RegFunction("PayCallback", PayCallback);
|
||||
L.RegFunction("SwitchAccountCallback", SwitchAccountCallback);
|
||||
|
@ -24,6 +25,7 @@ public class SDK_SDKManagerWrap
|
|||
L.RegFunction("__eq", op_Equality);
|
||||
L.RegFunction("__tostring", ToLua.op_ToString);
|
||||
L.RegVar("onInitLaunchCallback", get_onInitLaunchCallback, set_onInitLaunchCallback);
|
||||
L.RegVar("onRegisterCallback", get_onRegisterCallback, set_onRegisterCallback);
|
||||
L.RegVar("onLoginCallback", get_onLoginCallback, set_onLoginCallback);
|
||||
L.RegVar("onPayCallback", get_onPayCallback, set_onPayCallback);
|
||||
L.RegVar("onSwitchAccountCallback", get_onSwitchAccountCallback, set_onSwitchAccountCallback);
|
||||
|
@ -33,6 +35,7 @@ public class SDK_SDKManagerWrap
|
|||
L.RegFunction("SwitchAccountAction", SDK_SDKManager_SwitchAccountAction);
|
||||
L.RegFunction("PayAction", SDK_SDKManager_PayAction);
|
||||
L.RegFunction("LoginAction", SDK_SDKManager_LoginAction);
|
||||
L.RegFunction("RegisterAction", SDK_SDKManager_RegisterAction);
|
||||
L.RegFunction("InitLaunchAction", SDK_SDKManager_InitLaunchAction);
|
||||
L.EndClass();
|
||||
}
|
||||
|
@ -202,6 +205,23 @@ public class SDK_SDKManagerWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int RegisterCallback(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
ToLua.CheckArgsCount(L, 2);
|
||||
SDK.SDKManager obj = (SDK.SDKManager)ToLua.CheckObject<SDK.SDKManager>(L, 1);
|
||||
string arg0 = ToLua.CheckString(L, 2);
|
||||
obj.RegisterCallback(arg0);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int LoginCallback(IntPtr L)
|
||||
{
|
||||
|
@ -307,6 +327,25 @@ public class SDK_SDKManagerWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int get_onRegisterCallback(IntPtr L)
|
||||
{
|
||||
object o = null;
|
||||
|
||||
try
|
||||
{
|
||||
o = ToLua.ToObject(L, 1);
|
||||
SDK.SDKManager obj = (SDK.SDKManager)o;
|
||||
SDK.SDKManager.RegisterAction ret = obj.onRegisterCallback;
|
||||
ToLua.Push(L, ret);
|
||||
return 1;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e, o, "attempt to index onRegisterCallback on a nil value");
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int get_onLoginCallback(IntPtr L)
|
||||
{
|
||||
|
@ -421,6 +460,25 @@ public class SDK_SDKManagerWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int set_onRegisterCallback(IntPtr L)
|
||||
{
|
||||
object o = null;
|
||||
|
||||
try
|
||||
{
|
||||
o = ToLua.ToObject(L, 1);
|
||||
SDK.SDKManager obj = (SDK.SDKManager)o;
|
||||
SDK.SDKManager.RegisterAction arg0 = (SDK.SDKManager.RegisterAction)ToLua.CheckDelegate<SDK.SDKManager.RegisterAction>(L, 2);
|
||||
obj.onRegisterCallback = arg0;
|
||||
return 0;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e, o, "attempt to index onRegisterCallback on a nil value");
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int set_onLoginCallback(IntPtr L)
|
||||
{
|
||||
|
@ -605,6 +663,33 @@ public class SDK_SDKManagerWrap
|
|||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int SDK_SDKManager_RegisterAction(IntPtr L)
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = LuaDLL.lua_gettop(L);
|
||||
LuaFunction func = ToLua.CheckLuaFunction(L, 1);
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
Delegate arg1 = DelegateTraits<SDK.SDKManager.RegisterAction>.Create(func);
|
||||
ToLua.Push(L, arg1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaTable self = ToLua.CheckLuaTable(L, 2);
|
||||
Delegate arg1 = DelegateTraits<SDK.SDKManager.RegisterAction>.Create(func, self);
|
||||
ToLua.Push(L, arg1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return LuaDLL.toluaL_exception(L, e);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||
static int SDK_SDKManager_InitLaunchAction(IntPtr L)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue