【数数】修改部分数据到进入游戏时上报
parent
b44c1a3e8f
commit
a6e93212d0
|
@ -54,6 +54,18 @@ namespace GameLogic
|
|||
|
||||
public void Init()
|
||||
{
|
||||
if (AppConst.isSDK)
|
||||
{
|
||||
Dictionary<string, object> data = new Dictionary<string, object>();
|
||||
data.Add("bundle_id", AndroidDeviceInfo.Instance.GetPackageName());
|
||||
data.Add("platfrom", AppConst.Platform);
|
||||
data.Add("device_id", GetDeviceId());
|
||||
|
||||
data.Add("xx_id", SDK.SDKManager.Instance.GetChannel());
|
||||
data.Add("packId", SDK.SDKManager.Instance.GetSubChannel());
|
||||
|
||||
ThinkingAnalyticsAPI.SetSuperProperties(data);
|
||||
}
|
||||
// 以时间戳校准 SDK 时间
|
||||
//ThinkingAnalyticsAPI.CalibrateTime(1585555578000);
|
||||
ThinkingAnalyticsAPI.CalibrateTimeWithNtp("ntp.aliyun.com");
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace SDK
|
|||
public virtual void NewRoleTutorial(string eventName, string guide_start_time, string guide_end_time, string serverId, string serverName, string roleName, string roleId) { }
|
||||
|
||||
public virtual void OpenWeb(string url) { }
|
||||
public virtual string GetChannel() { return ""; }
|
||||
public virtual string GetSubChannel() { return ""; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,5 +146,15 @@ namespace SDK
|
|||
{
|
||||
currentActivity.Call("Logout");
|
||||
}
|
||||
//获取渠道名
|
||||
public override string GetChannel()
|
||||
{
|
||||
return currentActivity.Call<string>("GetChannel");
|
||||
}
|
||||
//获取子渠道名
|
||||
public override string GetSubChannel()
|
||||
{
|
||||
return currentActivity.Call<string>("GetSubChannel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,20 @@ namespace SDK
|
|||
public override void OpenWeb(string url) {
|
||||
m_SDK_OpenWeb(url);
|
||||
}
|
||||
|
||||
//获取渠道名
|
||||
[DllImport("__Internal")]
|
||||
private static extern string m_GetChannel();
|
||||
public override string GetChannel() {
|
||||
return m_GetChannel();
|
||||
}
|
||||
//获取子渠道名
|
||||
[DllImport("__Internal")]
|
||||
private static extern string m_GetSubChannel();
|
||||
public override string GetSubChannel() {
|
||||
return m_GetSubChannel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace SDK
|
|||
|
||||
|
||||
private static Proxy proxy;
|
||||
|
||||
|
||||
private Hashtable packConfig;
|
||||
|
||||
public bool IsInit { get; private set; }
|
||||
public void Initialize()
|
||||
|
@ -59,9 +60,21 @@ namespace SDK
|
|||
|
||||
// 初始化打点
|
||||
SdkCustomEvent.Init();
|
||||
|
||||
LoadPackConfig();
|
||||
}
|
||||
|
||||
|
||||
void LoadPackConfig()
|
||||
{
|
||||
App.ResMgr.LoadStreamingText("PackConfig", (bool ok, string txt) =>
|
||||
{
|
||||
if (ok)
|
||||
{
|
||||
packConfig = MiniJSON.jsonDecode(txt) as Hashtable;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!AppConst.isSDKLogin) return;
|
||||
|
@ -182,6 +195,32 @@ namespace SDK
|
|||
proxy.NewRoleTutorial(eventName, guide_start_time, guide_end_time, serverId, serverName, roleName, roleId);
|
||||
}
|
||||
|
||||
//获取
|
||||
public string GetChannel()
|
||||
{
|
||||
string channel = proxy.GetChannel();
|
||||
if (channel != null && channel != "")
|
||||
return channel;
|
||||
return "unknown";
|
||||
}
|
||||
//sdk获取支付订单号
|
||||
public string GetSubChannel()
|
||||
{
|
||||
string subChannel = proxy.GetSubChannel();
|
||||
if(subChannel != null && subChannel != "")
|
||||
{
|
||||
return subChannel;
|
||||
}
|
||||
else if(packConfig != null )
|
||||
{
|
||||
string packId = packConfig["PackID"] as string;
|
||||
if (packId != null && packId != "")
|
||||
{
|
||||
return packId;
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
/// <summary>
|
||||
/// ///////// sdk层回调
|
||||
/// </summary>
|
||||
|
|
|
@ -42,7 +42,7 @@ function this.Initialize()
|
|||
end
|
||||
end)
|
||||
-- 尝试触发 安装事件(怀疑安装事件是在第一次触发track时触发的)
|
||||
App.TAMgr:Init()
|
||||
-- App.TAMgr:Init()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -194,7 +194,11 @@ namespace GameLogic {
|
|||
|
||||
public void LoadStreamingText(string name, LuaFunction luaFunction)
|
||||
{
|
||||
resMgr.LoadStreamingText(name, luaFunction);
|
||||
resMgr.LoadStreamingText(name, luaFunction, null);
|
||||
}
|
||||
public void LoadStreamingText(string name, UnityAction<bool, string> action)
|
||||
{
|
||||
resMgr.LoadStreamingText(name, null, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,11 +157,11 @@ namespace ResMgr {
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadStreamingText(string name, LuaFunction luaFunction)
|
||||
public void LoadStreamingText(string name, LuaFunction luaFunction, UnityAction<bool, string> unityAction)
|
||||
{
|
||||
StartCoroutine(LoadTextFromStream(name, luaFunction));
|
||||
StartCoroutine(LoadTextFromStream(name, luaFunction, unityAction));
|
||||
}
|
||||
public IEnumerator LoadTextFromStream(string name, LuaFunction luaFunction)
|
||||
public IEnumerator LoadTextFromStream(string name, LuaFunction luaFunction, UnityAction<bool, string> unityAction)
|
||||
{
|
||||
string filePath = Application.streamingAssetsPath + "/Res/" + name + ".txt";
|
||||
#if UNITY_IOS
|
||||
|
@ -177,6 +177,10 @@ namespace ResMgr {
|
|||
{
|
||||
luaFunction.Call(false);
|
||||
}
|
||||
if(unityAction != null)
|
||||
{
|
||||
unityAction.Invoke(false, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -185,6 +189,10 @@ namespace ResMgr {
|
|||
{
|
||||
luaFunction.Call(tex);
|
||||
}
|
||||
if (unityAction != null)
|
||||
{
|
||||
unityAction.Invoke(true, tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,8 @@ public class GameStart : MonoBehaviour
|
|||
IEnumerator StartGame()
|
||||
{
|
||||
yield return App.Instance.Initialize();
|
||||
// 初始化数数
|
||||
App.TAMgr.Init();
|
||||
//App.Instance.Initialize();
|
||||
UpdateManager.Instance.StartUp();
|
||||
}
|
||||
|
@ -107,4 +109,4 @@ public class GameStart : MonoBehaviour
|
|||
// App.Instance.Initialize();
|
||||
// UpdateManager.Instance.StartUp();
|
||||
//}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue