IEnumerator CheckForSuccessfulLogout() { // keep yielding until no longer logged in if (FB.IsLoggedIn) { Debug.Log("Logging out - still logged in" + DateTime.Now.ToString("h:mm:ss tt")); yield return(new WaitForSeconds(0.1f)); StartCoroutine("CheckForSuccessfulLogout"); } else { // successful logout, do what you want here //clear facebook instance var inst = FacebookManager.Instance(); inst.FB_ID = null; inst.user_ID = -1; inst.ProfilePic = null; inst.Gender = ""; inst.FullName = ""; inst.callLogout(); Debug.Log("Logged out!"); Application.LoadLevel("login"); // logged out, go load the login level now } }
void Update() { if (isTouched()) { FacebookManager.Invite("Play Floppy BunBun with me!", "Check out this very addicting mobile game."); } }
public void ClickLogin() { if (!FB.IsInitialized) { loginText.text = "Error, try restarting :)"; } else { if (!FB.IsLoggedIn) { FacebookManager.Loggin( (string result) => { if (result.Contains("Sucess")) { ShowWaitingScreenAndLoadScores(); } else { loginText.text = result; } } ); } else { ShowWaitingScreenAndLoadScores(); } } }
void DisplayScores(ScoreData[] scores) { loadingCanvas.SetActive(false); listCanvas.SetActive(true); RectTransform scrollRectT = scrollViewContent.GetComponent <RectTransform> (); scrollRectT.sizeDelta = new Vector2(0f, 155f * scores.Length); scrollRectT.anchoredPosition = new Vector3(0f, 0f, 0f); GameObject prefabUi = Resources.Load <GameObject> ("Prefab UI/Profil Pic"); for (int i = 0; i < scores.Length; i++) { GameObject playerUI = Instantiate(prefabUi) as GameObject; Image pic = playerUI.GetComponent <Image> (); Text name = playerUI.transform.FindChild("Name").GetComponent <Text> (); Text scoreText = playerUI.transform.FindChild("Score").GetComponent <Text> (); scoreText.text = scores [i].score.ToString(); name.text = scores [i].user_name; FacebookManager.RequestFriendProfilPic(200, (Sprite sprite) => { pic.sprite = sprite; }, scores [i].user_id); RectTransform rect = pic.GetComponent <RectTransform> (); rect.SetParent(scrollViewContent.transform); rect.anchoredPosition = new Vector3(-300f, (((155f * scores.Length) / 2) - pic.rectTransform.sizeDelta.y) + (i * -150f), 0f); } }
void Awake() { GameObject.Find("HolderGornjiDesniUgaoDugmici").GetComponent <Transform>().position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.one).x, Camera.main.ViewportToWorldPoint(Vector3.one).y, -0.05f); GameObject.Find("HolderGornjiLeviUgaoDugmici").GetComponent <Transform>().position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.zero).x, Camera.main.ViewportToWorldPoint(Vector3.one).y, -0.05f); GameObject.Find("HolderDonjiDesniUgaoDugmici").GetComponent <Transform>().position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.one).x, Camera.main.ViewportToWorldPoint(Vector3.zero).y, -0.05f); GameObject.Find("HolderDonjiLeviUgaoDugmici").GetComponent <Transform>().position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.zero).x, Camera.main.ViewportToWorldPoint(Vector3.zero).y, -0.05f); Face = GameObject.Find("FacebookManager").GetComponent <FacebookManager>(); //dugmeMuzika = GameObject.Find( HolderLanguageFlagsMove // holderLogo = GameObject.Find("HolderLogoGlavni"); // majmunLogo = GameObject.Find("HolderMajmun"); LeaderBoard = GameObject.Find("HolderLeaderboardMove"); dugmeMuzika = GameObject.Find("ButtonMusic"); dugmeSound = GameObject.Find("ButtonSound"); dugmeMuzikaSprite = GameObject.Find("ButtonMusic").GetComponent <SpriteRenderer>().sprite; dugmeSoundSprite = GameObject.Find("ButtonSound").GetComponent <SpriteRenderer>().sprite; dugmeMuzikaOffSprite = GameObject.Find("ButtonMusicOff").GetComponent <SpriteRenderer>().sprite; dugmeSoundOffSprite = GameObject.Find("ButtonSoundOff").GetComponent <SpriteRenderer>().sprite; Languages = GameObject.Find("HolderLanguageFlagsMove"); Languages.GetComponent <Animation>().Play("MainLanguageFlagsPosition"); Zastave = GameObject.Find("Zastave"); Zastave.SetActive(false); LanguagesAktivan = false; TrenutnaZastava = GameObject.Find("TrenutniJezik"); TextJezik = GameObject.Find("Text2letters"); // holderLogo.transform.position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.zero).x,Camera.main.ViewportToWorldPoint(Vector3.one).y,holderLogo.transform.position.z); // majmunLogo.transform.position = new Vector3(Camera.main.ViewportToWorldPoint(Vector3.one).x,Camera.main.ViewportToWorldPoint(Vector3.one).y,majmunLogo.transform.position.z); // nivoManager = GameObject.Find("NivoManager").GetComponent<NivoManager>(); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; AppObject.init(new CurrentGameInfomation(), new AvengerService()); FacebookManager.init(); }
/* * void _browser_Navigating(object sender, NavigatingEventArgs e) { * //throw new NotImplementedException(); * } * * void _browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) { * fail(); * } * * void _browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { * String uri = e.Uri.ToString(); * if (uri.StartsWith("https://www.facebook.com/connect/login_success.html") || uri.StartsWith("http://www.facebook.com/connect/login_success.html") || uri.StartsWith("https://m.facebook.com/connect/login_success.html") || uri.StartsWith("http://m.facebook.com/connect/login_success.html")) { || if (uri.EndsWith("#_=_")) { || uri = uri.Substring(0, uri.Length - 4); || } || String queryString = e.Uri.Query.ToString(); || try { || IEnumerable<KeyValuePair<string, string>> pairs = UriToolKits.ParseQueryString(queryString); || string code = KeyValuePairUtils.GetValue(pairs, "code"); || string tokenurl = FacebookClient.Instance.getAccessTokenRequestUrl(code); || WebClient client = new WebClient(); || client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(AccessTokenDownloadCompleted); || client.DownloadStringAsync(new Uri(tokenurl)); || } catch (Exception ex) { || fail(); || } || } || else if (uri.StartsWith("https://m.facebook.com/dialog/oauth/write") || uri.StartsWith("http://m.facebook.com/dialog/oauth/write")) || { || string url = FacebookClient.Instance.getLoginUrl(); || _browser.Source = new Uri(url); || } ||} ||void AccessTokenDownloadCompleted(object sender, DownloadStringCompletedEventArgs e) { || if (!e.Cancelled && e.Error == null) { || try { || string data = e.Result; || data = "?" + data; || IEnumerable<KeyValuePair<string, string>> pairs = UriToolKits.ParseQueryString(data); || string accessToken = KeyValuePairUtils.GetValue(pairs, "access_token"); || string expires = KeyValuePairUtils.GetValue(pairs, "expires"); || success(accessToken, expires); || } catch (Exception ex) { || fail(); || } || } else { || fail(); || } ||}*/ private async Task Authenticate() { string message = String.Empty; try { session = await FacebookManager.SessionClient.LoginAsync("basic_info,publish_actions,user_about_me,read_stream"); string state = session.State; if (session.AccessToken.Length > 0) { state = session.State; FacebookManager.setToken(session.AccessToken); success(session.AccessToken, session.Expires.ToString()); } //Facebook.FacebookClient client = new Facebook.FacebookClient(session.AccessToken); //var result = await client.GetTaskAsync("/me?fields=id,name"); //state = session.State; } catch (InvalidOperationException e) { //message = "Login failed! Exception details: " + e.Message; // MessageDialog dialog = new MessageDialog(message); //dialog.ShowAsync(); cancel(); } }
public void FacebookLogin(Delegates.UserLoginSuccess successListener, Delegates.UserLoginFail failListener) { FacebookManager.FacebookManagerInstance().FacebookLogin(delegate(string accessToken) { Firebase.Auth.Credential credential = Firebase.Auth.FacebookAuthProvider.GetCredential(accessToken); auth.SignInWithCredentialAsync(credential).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("SignInWithCredentialAsync was canceled."); failListener("SignInWithCredentialAsync was canceled."); return; } if (task.IsFaulted || task.Exception != null) { Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception); failListener(GetErrorMessage(task.Exception.InnerExceptions [0] as FirebaseException)); return; } Firebase.Auth.FirebaseUser newUser = task.Result; successListener(newUser.UserId); Debug.LogFormat("User signed in successfully: {0} ({1})", newUser.DisplayName, newUser.UserId); }); }, delegate(string error) { failListener(error); }); }
void Update() { if (isTouched()) { FacebookManager.Share("Check out my Floppy Clone greatness!", "I have a high score of " + (PlayerPrefs.GetInt("high_score", 0)).ToString() + " points. Can you beat me?", "Open source Flappy Bird type game created with Unity3D", "https://raw.githubusercontent.com/nraboy/Floppy-Clone/master/Assets/Icons/android.png", "https://github.com/nraboy/Floppy-Clone"); } }
void Awake() { DontDestroyOnLoad(this.gameObject); _instance = this; IsLoggedIn = true; }
void Update() { if (isTouched()) { FacebookManager.Share("Check out my Floppy BunBun greatness!", "I have a high score of " + (PlayerPrefs.GetInt("high_score", 0)).ToString() + " points. Can you beat me?", "Floppy BunBun How far can you flap those ears?", "", ""); } }
// Code run when starting the script component void Awake () { // Not very sure of how this works... Debug.Log ("FBManager Awake is being called"); DontDestroyOnLoad (this.gameObject); _instance = this; }
private void Awake() { if (instance == null) { instance = this; } }
/// <summary> /// Registers a new user using the given password key to decrypt their password /// </summary> /// <param name="newUser"></param> /// <param name="passwordKey"></param> public void Register(User newUser, string passwordKey, string facebookAuthCode) { // check if user already exists List <User> allUsers = DataManager.GetDataContext <User>().GetAll <User>(); if (allUsers.Any(u => u.UserName == newUser.UserName)) { throw new Exception(USER_EXISTS); } if (newUser.SyncWithFacebook) { newUser.FacebookAccessToken = FacebookManager.GetFacebookAccessToken(facebookAuthCode); } // decrypt password string decrypted = EncryptionUtility.Decrypt(passwordKey, newUser.Password); // re-encrypt password with server key string serverEncrypt = EncryptionUtility.Encrypt(ServerPasswordKey, decrypted); // set the user's password to the server-encrypted version newUser.Password = serverEncrypt; // add the users to the data context and save DataManager.GetDataContext <User>().AddObjects <User>(new User[] { newUser }.ToList()); DataManager.GetDataContext <User>().Save(); // add the user the logged on users if (!LoggedOnUsers.Any(u => u.Email == newUser.Email)) { LoggedOnUsers.Add(newUser); } }
void Awake() { DontDestroyOnLoad(this.gameObject); _instance = this; profileScore = 0; }
private void Start() { _facebookManager = FacebookManager.Instance; _tabsRootCanvasGroup = _tabsRoot.GetComponent <CanvasGroup>(); _backgroundVeilCanvasGroup = _backgroundVeil.GetComponent <CanvasGroup>(); _backgroundVeil.GetComponent <Button>().onClick.AddListener(CloseWindow); foreach (var tabWindow in _tabWindows) { tabWindow.Hide(); } foreach (var tabButton in _tabButtons) { var button = tabButton; button.Button.ControlButton.onClick.AddListener(() => OnTabButtonClicked(button)); } if (_facebookManager == null || !_facebookManager.IsInitialized || !_facebookManager.IsLoggedIn) { _tabButtons[2].Button.ControlButton.gameObject.SetActive(false); } if (_facebookManager != null) { _facebookManager.OnFbLoggedIn += OnFbLoggedIn; _facebookManager.OnFbLoggedOut += OnFbLoggedOut; } }
void Awake() { if (_instance == null) { requestCallbacks = new Dictionary<string,Action<IDictionary>> (); _instance = this; } }
private void Awake() { if (Instance == null) { Instance = this; } // if (!FB.IsInitialized) // { // FB.Init(() => // { // if (FB.IsInitialized) // FB.ActivateApp(); // else // Debug.LogError("Couldn't initialize"); // }, // isGameShown => // { // if (!isGameShown) // Time.timeScale = 0; // else // Time.timeScale = 1; // }); // } // // else // FB.ActivateApp(); }
public void CallLogin() { try{ InputField[] arr = UnityEngine.Object.FindObjectsOfType <InputField>(); string username = arr[0].text; string password = arr[1].text; if (!IsValidEmailAddress(username)) { throw new Exception("E-mail is in wrong format"); } DAO database = new DAO(); database.Register(username, password); FacebookManager.Instance().user_ID = database.LoginWithEmail(username, password); if (FacebookManager.Instance().user_ID > -1) { Texture2D tex = Resources.Load("profile") as Texture2D; FacebookManager.Instance().ProfilePic = Sprite.Create(tex , new Rect(0, 0, 336, 336), new Vector2(0, 0)); AppMaster.currentScene = "user"; AppMaster.Instance().callHit(); Application.LoadLevel("user"); } else { Debug.Log("Failed Login"); } } catch (Exception ex) { Debug.Log("Error : " + ex.Message); } }
public void SetItem(UserLeaderboardData data) { if (data != null) { if (_facebookManager == null) { _facebookManager = FacebookManager.Instance; } _positionText.text = (data.Position + 1).ToString(); _scoresText.text = data.LeaderboardValue.ToString(); _nameText.text = data.DisplayName; if (_facebookManager != null) { if (_facebookManager.CurrentUserFacebookUserInfo.id == data.FacebookId) { _nameText.text = "You"; _userIconFrame.sprite = _iconFramePlayer; var fbUser = _facebookManager.CurrentUserFacebookUserInfo; if (fbUser.ProfilePicture != null) { _userImage.sprite = fbUser.ProfilePicture; Debug.Log("Switching image player"); } else { fbUser.OnImageLoaded += () => { _userImage.sprite = fbUser.ProfilePicture; Debug.Log("Switching image player"); }; } } if (!string.IsNullOrEmpty(data.FacebookId) && _facebookManager.FriendUserFacebookInfos != null && _facebookManager.FriendUserFacebookInfos.Exists(f => f.id == data.FacebookId)) { var fbUser = _facebookManager.FriendUserFacebookInfos.First(f => f.id == data.FacebookId); if (fbUser.ProfilePicture != null) { _userImage.sprite = fbUser.ProfilePicture; Debug.Log("Switching image"); } else { fbUser.OnImageLoaded += () => { _userImage.sprite = fbUser.ProfilePicture; Debug.Log("Switching image"); }; } } } else { Debug.Log("facebook == null"); } } }
private void OnFacebookLogin() { this.IsLoggingIn = false; if (FacebookManager.IsLoggedIn) { FacebookManager.GetSelfData(new FacebookGetSelfDataCompleteDelegate(this.OnGetSelfData)); } }
void Awake() { if (_instance == null) { requestCallbacks = new Dictionary <string, Action <IDictionary> > (); _instance = this; } }
public void PopulateFacebookData() { if (FacebookManager.IsLoggedIn) { FacebookManager.GetFriends(new FacebookGetFriendsCompleteDelegate(this.OnGetFriendsData)); FacebookManager.GetSelfData(new FacebookGetSelfDataCompleteDelegate(this.OnGetSelfData)); } }
private void Start() { _fbManager = FacebookManager.Instance; if (_fbManager != null) { _fbManager.OnUserInfoDownloadedEvent += OnUserInfoDownloadedEvent; } }
/// <summary> /// Prevents object from being destroyed, gets necessary references. /// </summary> void Awake() { instance = this; DontDestroyOnLoad(this.gameObject); facebookManager = this.GetComponent <FacebookManager>(); playFabManager = this.GetComponent <PlayFabManager>(); }
private void Awake() { DontDestroyOnLoad(transform.gameObject); if (_instance == null) { _instance = this; } }
// Use this for initialization void Awake() { DAO database = new DAO(); Pedometer ped = database.GetPedometerInfo(FacebookManager.Instance().user_ID); pedometersteps = ped.Total_step; isClosed = true; }
private void OnInitLoginAndGetUserDataAction(FacebookManager.FacebookHelperResultType resultType) { if (resultType == FacebookManager.FacebookHelperResultType.OK) { FacebookManager.Instance.AutoConnectOnStartup = true; SetButtonText(); } }
public void PopulateFacebookData() { if (FacebookManager.IsLoggedIn) { FacebookManager.GetFriends(new FacebookDelegate <IGraphResult>(this.OnGetFriendsData)); FacebookManager.GetSelfData(new FacebookDelegate <IGraphResult>(this.OnGetSelfData)); } }
public static FacebookManager Instance() { if (instance == null) { instance = new FacebookManager(); } return(instance); }
private void Start() { if (_facebookManager == null) { _facebookManager = FacebookManager.Instance; } _facebookManager.OnFbLoggedIn += OnFbLoggedIn; }
private void Start() { _animationManager = GetComponent <AnimationManager>(); _facebookManager = FacebookManager.Instance; if (_facebookManager != null) { _facebookManager.OnSendInviteSuccess += OnSendInviteSuccess; } }
void Awake() { Debug.Log("Login: Awake"); Debug.Log("FB.IsLoggedIn value: " + FacebookManager.Instance().IsLogged()); if (FacebookManager.Instance().IsLogged()) { Application.LoadLevel("augmon_select"); } }
public Form1() { InitializeComponent(); m_FacebookManager = new FacebookManager(); m_Paint = new Paint(); m_Youtube = new YoutubeProxy(); axShockwaveFlashYoutube.Visible = false; initializePanel(panelPaint.Width, panelPaint.Height); listBoxFavoritesVideos.DataSource = m_Youtube.MyFavoritesVideos; loadFeauter4(); }
void Awake() { if(instance == null ) instance = this; }
void Awake() { if(facebookInstance == null) { facebookInstance = this; } }
/// <summary> /// Prevents object from being destroyed, gets necessary references. /// </summary> void Awake() { instance = this; DontDestroyOnLoad(this.gameObject); facebookManager = this.GetComponent<FacebookManager>(); playFabManager = this.GetComponent<PlayFabManager>(); }
// Use this for initialization void Start() { ///Inicializamos en Start en vez de Awake /// porque, de lo contrario, se va a ejecutar /// cada que activemos el script facebookManager = this; initialized = false; isUpAndRunning = false; StartFacebook(); }
void Awake() { DontDestroyOnLoad (this.gameObject); _instance = this; }
void Awake() { DontDestroyOnLoad(this.gameObject); _instance = this; isLoggedIn = true; }
void Start() { if (_instance == null) { _instance = this; DontDestroyOnLoad (this); } else { if(this != _instance) Destroy(this.gameObject); } FB.Init(SetInit, OnHideUnity); }
// // // void Awake() { mInstance = this; Initialize(); }
void OnEnable() { facebookManager = (FacebookManager)target; }