相关渠道统一添加devicehelper package
parent
2174a09054
commit
ceba0d14cb
|
|
@ -57,6 +57,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- ThinkingData@1.0.0
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
# 爱加密配置
|
||||
Encryption:
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- TapTap@latest
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
# 爱加密配置
|
||||
Encryption:
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- ThinkingData@1.0.0
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
# 爱加密配置
|
||||
Encryption:
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- ThinkingData@1.0.0
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
# 爱加密配置
|
||||
Encryption:
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- TapTap@latest
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
|
||||
# 爱加密配置
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ Packages:
|
|||
- AliPay@0.0.1
|
||||
- TapTap@latest
|
||||
- AIhelper@latest
|
||||
- DeviceHelper@0.0.1
|
||||
|
||||
# 爱加密配置
|
||||
Encryption:
|
||||
|
|
|
|||
|
|
@ -45,6 +45,19 @@ namespace PhxhSDK
|
|||
|
||||
SdkHelper sdkHelper = SDKManager.Instance.GetSdkHelper(SDKManager.SdkName.Bilibili);
|
||||
BilibiliSdkHelper biliSdkHelper = sdkHelper as BilibiliSdkHelper;
|
||||
if (biliSdkHelper == null)
|
||||
{
|
||||
DebugUtil.LogError("[BilibiliSdkHelper.Login] 获取 BilibiliSdkHelper 失败,sdkHelper=" + sdkHelper);
|
||||
onLoginFail?.Invoke(-1, "BilibiliSdkHelper is null");
|
||||
return;
|
||||
}
|
||||
if (biliSdkHelper.BiliListerner == null)
|
||||
{
|
||||
DebugUtil.LogError("[BilibiliSdkHelper.Login] BiliListerner 为 null,无法注册登录回调");
|
||||
onLoginFail?.Invoke(-1, "BiliListerner is null");
|
||||
return;
|
||||
}
|
||||
DebugUtil.Log("[BilibiliSdkHelper.Login] 注册登录回调并调用 GSCSdkInterface.login()");
|
||||
biliSdkHelper.BiliListerner.RegistLoginCallback(LoginSuccess, onLoginFail);
|
||||
GSCSdkInterface.login();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ namespace PhxhSDK
|
|||
|
||||
public override void EarlyInit()
|
||||
{
|
||||
DebugUtil.Log("[BilibiliSdkHelper] EarlyInit 开始");
|
||||
GameObject goBilibili = GameObject.Find("BiliBiliSDK");
|
||||
if (null == goBilibili)
|
||||
{
|
||||
|
|
@ -145,12 +146,21 @@ namespace PhxhSDK
|
|||
UnityEngine.Object.DontDestroyOnLoad(goBilibili);
|
||||
DebugUtil.Log("[BilibiliSdkHelper] 创建 BiliBiliSDK GameObject 并设置 DontDestroyOnLoad");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtil.Log("[BilibiliSdkHelper] 找到已有 BiliBiliSDK GameObject");
|
||||
}
|
||||
BiliListerner = goBilibili.GetComponent<GSCCallbackListerner>();
|
||||
if (null == BiliListerner)
|
||||
{
|
||||
BiliListerner = goBilibili.AddComponent<GSCCallbackListerner>();
|
||||
DebugUtil.Log("[BilibiliSdkHelper] 挂载 GSCCallbackListerner 组件");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtil.Log("[BilibiliSdkHelper] GSCCallbackListerner 已存在");
|
||||
}
|
||||
DebugUtil.Log($"[BilibiliSdkHelper] 调用 GSCSdkInterface.init, MerchantID={MerchantID} AppID={AppID} ServerID={ServerID}");
|
||||
GSCSdkInterface.init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,11 +63,12 @@ namespace PhxhSDK.AOT.Bilibili
|
|||
|
||||
public void OnGSCSdkCallback(string jsonstr)
|
||||
{
|
||||
Debug.Log("OnGSCSdkCallback message: jsonstr=" + jsonstr);
|
||||
Debug.Log("[GSCCallbackListerner] OnGSCSdkCallback: " + jsonstr);
|
||||
JsonData json = JsonMapper.ToObject(jsonstr);
|
||||
string callbackType = (string)json["callbackType"];
|
||||
int code = (int)json["code"];
|
||||
JsonData data = json["data"];
|
||||
Debug.Log($"[GSCCallbackListerner] callbackType={callbackType}, code={code}");
|
||||
switch (callbackType)
|
||||
{
|
||||
case CALLBACKTYPE_INIT:
|
||||
|
|
@ -133,6 +134,7 @@ namespace PhxhSDK.AOT.Bilibili
|
|||
/// <param name="data"></param>
|
||||
public virtual void OnInitCallback(int code, string data)
|
||||
{
|
||||
Debug.Log($"[GSCCallbackListerner] OnInitCallback code={code}, data={data}");
|
||||
if (code == StatusCode_Success)
|
||||
{
|
||||
Debug.Log($"初始化成功,code:{code},data:{data}");
|
||||
|
|
@ -271,12 +273,15 @@ namespace PhxhSDK.AOT.Bilibili
|
|||
/// <param name="data"></param>
|
||||
public void OnLoginCallback(int code, string data)
|
||||
{
|
||||
Debug.Log($"[GSCCallbackListerner] OnLoginCallback code={code}, data={data}");
|
||||
if (code == StatusCode_Success)
|
||||
{
|
||||
JsonData json = JsonMapper.ToObject(data);
|
||||
string username = (string)json["username"];
|
||||
string access_token = (string)json["access_token"];
|
||||
string uid = (string)json["uid"];
|
||||
Debug.Log($"[GSCCallbackListerner] 登录成功 uid={uid}, username={username}");
|
||||
if (loginAction == null) Debug.LogError("[GSCCallbackListerner] loginAction 为 null!回调丢失");
|
||||
loginAction?.Invoke(uid, username, access_token);
|
||||
Debug.Log($"登录成功,code:{code},data:{data}");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue