Skip to content

Instantly share code, notes, and snippets.

@ado3s
Created December 25, 2016 17:09
Show Gist options
  • Save ado3s/20f98a0052a6d794ed9821add6c901ba to your computer and use it in GitHub Desktop.
Save ado3s/20f98a0052a6d794ed9821add6c901ba to your computer and use it in GitHub Desktop.
【Unity】Fabric TwitterKit ログイン処理
using Fabric.Twitter;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SampleView : MonoBehaviour
{
void Start()
{
var btn = transform.FindChild("TWLoginButton").GetComponent<Button>();
btn.onClick.AddListener(Login);
}
private void Login()
{
var session = Twitter.Session;
if (null == session)
{
Twitter.LogIn(
success =>
{
var userId = success.id;
Debug.Log(string.Format("Twitter UserId : {0}", userId));
// これでユーザID取れる
// んで、このユーザIDをキーにDBから情報とってくるてな感じ
// のソースをここに書けばおk
},
failure =>
{
// エラー時の処理を書いてね
}
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment