Created
December 25, 2016 17:09
-
-
Save ado3s/20f98a0052a6d794ed9821add6c901ba to your computer and use it in GitHub Desktop.
【Unity】Fabric TwitterKit ログイン処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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