using UnityEngine;
|
|
public class GA_SDK_Manager : MonoBehaviour
|
{
|
private static GA_SDK_Manager _Ins;
|
public static GA_SDK_Manager Ins
|
{
|
get
|
{
|
return _Ins;
|
}
|
}
|
/// <summary>
|
/// Awake is called when the script instance is being loaded.
|
/// </summary>
|
void Awake()
|
{
|
_Ins = this;
|
}
|
|
public string GetDeviceId()
|
{
|
return TalkingDataGA.GetDeviceId();
|
}
|
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
/// <param name="channelId">渠道id</param>
|
public void SDKInit(string channelId)
|
{
|
Debug.Log("Unity SDK init begin channelId:" + channelId);
|
TalkingDataGA.OnStart("B220F5C737384030947B202F19E32086", channelId);//appID是定死的
|
Debug.Log("Unity SDK init completed ");
|
}
|
|
TDGAAccount account;//当前账户
|
|
/// <summary>
|
/// 登录,使用自定义的
|
/// </summary>
|
/// <param name="deviceID"></param>
|
public void Login(string deviceID)
|
{
|
account = TDGAAccount.SetAccount(TalkingDataGA.GetDeviceId());
|
account.SetAccountType(AccountType.ANONYMOUS);
|
}
|
|
|
private void OnDestroy()
|
{
|
Debug.Log("onDestroy");
|
TalkingDataGA.OnEnd();
|
}
|
}
|