private void Start() { TankPrefs.SetInt("facebookAsked", 1); TankPrefs.Save(); button.SetToggled(BackendManager.ConnectedWithFacebook); button.SetOnClick(ButtonState.Default, delegate { button.SetDisabled(); BackendManager.ConnectWithFacebook(delegate { button.SetToggled(toggled: true); }, delegate { button.SetToggled(toggled: false); }); }); proceedButton.onClick.AddListener(delegate { MenuController.HideMenu <FacebookPopup>(); }); }
private void ToggleFacebook() { if (BackendManager.ConnectedWithFacebook) { BackendManager.DisconnectWithFacebook(); List <ArenaPlayerHUD> list = new List <ArenaPlayerHUD>(); ArenaPlayerHUD[] arenaPlayerHUDs = MenuController.GetMenu <GameMenu>().arenaPlayerHUDs; if (arenaPlayerHUDs != null && arenaPlayerHUDs.Length != 0) { list.AddRange(arenaPlayerHUDs); } arenaPlayerHUDs = MenuController.GetMenu <GameMenu>().arenaMultiplayerHUDs; if (arenaPlayerHUDs != null && arenaPlayerHUDs.Length != 0) { list.AddRange(arenaPlayerHUDs); } foreach (ArenaPlayerHUD item in list) { if ((bool)item.profilePicture) { item.profilePicture.texture = null; } } facebookButton.SetToggled(toggled: false); } else { facebookButton.SetDisabled(); BackendManager.ConnectWithFacebook(delegate { facebookButton.SetToggled(toggled: true); }, delegate { facebookButton.SetToggled(toggled: false); }); } }