Facebook sdk接入

This commit is contained in:
Caiyanpeng committed 2021-12-23 15:36:11 +08:00
1 parent 4260cf05d3
commit 6423007638
123 files changed
+6764 -39

No files matched your search

+24 -1
View File
@@ -1,6 +1,7 @@
using Assets.Scripts;
using Assets.Scripts.Mobile.Interface;
using DG.Tweening;
using Facebook.Unity;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
@@ -54,13 +55,19 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
#else
transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer-third/otherContainer/Apple").gameObject.SetActive(false);
#endif
UIManager.AddEvent(transform.Find("Panel/LoginContainer/LoginScrollView/Viewport/Content/FormContainer-Login/Mask/FormContainer-third/otherContainer/Facebook").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
FB.LogOut();
FB.LogInWithReadPermissions(callback: onFaceBookResp);
});
//App.weChatController.Init(App.WxAppId);
//var s = App.weChatController.isApplicationAvilible("com.gugoumainapp","powerfun").ToString();
//Utils.showToast(null, SystemInfo.batteryLevel.ToString());
CheckUpdate();
}
private async void CheckUpdate()
{
#if UNITY_ANDROID
@@ -141,6 +148,22 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
}
#endif
}
/// <summary>
/// FaceBook登录返回
/// </summary>
/// <param name="res"></param>
private void onFaceBookResp(ILoginResult res)
{
if (string.IsNullOrEmpty(res.Error))
{
Debug.Log("用戶Id" + res.ResultDictionary["user_id"]);
}
else
{
Utils.showToast(null, res.Error);
}
}
/// <summary>
/// 从ios或者安卓接收code,在c#里不建议调用
/// </summary>