public void RegisterAuthMethod(AuthMethod amethod) { if (!Methodsdb.ContainsKey(amethod.Id)) { Methodsdb.Add(amethod.Id, amethod); } }
internal bool AuthMethodEnabled(string methodName) { AuthMethod amethod = null; if (Methodsdb.TryGetValue(methodName, out amethod)) { return(amethod.Enabled); } return(false); }
// RUN AUTH METHOD ---- private IEnumerator I_ExecuteMethod() { if (SelectedMethod != null) { bool Method_Retry = false; AuthRunning = true; DisplayLayout(true); IAuthCustomUI customUI = SelectedMethod as IAuthCustomUI; if (customUI != null) { customUI.DisplayUI(auth.CurrentUser != null && auth.CurrentUser.IsAnonymous); } IAuthCustomNavigation customNavigation = SelectedMethod as IAuthCustomNavigation; SelectedMethod.OnEnter(); ProcessResult tres = ProcessResult.None; do { if (Method_Retry) { SelectedMethod.OnEnter(); Method_Retry = false; } tres = SelectedMethod.GetResult(); bool goback = (customNavigation != null) ? customNavigation.GoBack() : Input.GetKey(KeyCode.Escape); if (customUI != null && tres == ProcessResult.None && goback) { customUI.HideUI(); if (OnAuthCancelled != null) { OnAuthCancelled.Invoke(); } fsm.MoveNext(AuthCheckCommand.GoBack); break; } if (tres == ProcessResult.Failure) { Logger.LogWarning("Got Error during process of Method " + SelectedMethod.GetException(), this); yield return(new WaitForSeconds(0.5f)); Logger.LogWarning("Retrying...", this); Method_Retry = true; } yield return(new WaitForEndOfFrame()); } while (tres != ProcessResult.Completed); if (tres == ProcessResult.Completed) { if (customUI != null) { customUI.HideUI(); } SelectedMethod.OnFinish(); if (OnAuthCompleted != null) { OnAuthCompleted.Invoke(); } AuthCheckCommand cmd = auth.CurrentUser != null ? AuthCheckCommand.Next : AuthCheckCommand.Exit; fsm.MoveNext(cmd); } } AuthRunning = false; SelectedMethod = null; Logger.Log("Auth Execution Finished", this, true); yield return(0); }