// Start is called before the first frame update void Awake() { _db = new DbHelper(); if (FirebaseAuth.DefaultInstance.CurrentUser != null) { StartCoroutine(MySceneManager.LoadScene("MainMenu")); } Button registerBtn = registerButton.GetComponent <Button>(); registerBtn.onClick.AddListener(delegate { SetPanelVisibility(registerPanel, true); }); Button sendRegisterBtn = sendData.GetComponent <Button>(); sendRegisterBtn.onClick.AddListener(CheckCredentialsRegisterUser); Button tryAgain = badPanelButton.GetComponent <Button>(); tryAgain.onClick.AddListener(delegate { SetPanelVisibility(badPanel, false); }); Button okPanelBackButton = okPanelButton.GetComponent <Button>(); okPanelBackButton.onClick.AddListener(delegate { SetPanelVisibility(okPanel, false); SetPanelVisibility(registerPanel, false); }); Button logButton = loginButton.GetComponent <Button>(); logButton.onClick.AddListener(delegate { SetPanelVisibility(loginPanel, true); }); Button loginAuthUserBtn = doLoginButton.GetComponent <Button>(); loginAuthUserBtn.onClick.AddListener(LoginAuthUser); Button loadMainMenu = okLoginPanelButton.GetComponent <Button>(); loadMainMenu.onClick.AddListener(delegate { StartCoroutine(MySceneManager.LoadScene("MainMenu")); }); HideAllPanels(); }
void Start() { UiManager.SetPanelVisibility(okPanel, false); UiManager.SetPanelVisibility(badPanel, false); _currentUsr = FirebaseAuth.DefaultInstance.CurrentUser; Debug.LogFormat("CURRENT USER DATA: EMAIL: {0}, DISPLAY_NAME: {1}, UUID: {2}", _currentUsr.Email, _currentUsr.DisplayName, _currentUsr.UserId); Button logoutBtn = logoutButton.GetComponent <Button>(); logoutBtn.onClick.AddListener(LogoutUser); Button startBtn = startGameButton.GetComponent <Button>(); startBtn.onClick.AddListener(delegate { StartCoroutine(MySceneManager.LoadScene("Level_1")); }); Button leadBtn = optionsButton.GetComponent <Button>(); leadBtn.onClick.AddListener(delegate { StartCoroutine(MySceneManager.LoadScene("Leaderboard")); }); DisplayHelloMessage(); }
private void LogoutUser() { FirebaseAuth.DefaultInstance.SignOut(); StartCoroutine(MySceneManager.LoadScene("StartScreen")); }