using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AuthenticationTest : MonoBehaviour { public Text text; // Start is called before the first frame update void Start() { //PlayerPrefs.DeleteAll(); AuthenticationManager.Instance.onAuthenticationEventCallback += OnAuthenticationInfoCallback; } private void OnDestroy() { AuthenticationManager.Instance.onAuthenticationEventCallback -= OnAuthenticationInfoCallback; } public void GetAuthenticationInfo() { Debug.Log("GetAuthenticationInfo: CLICK"); AuthenticationManager.Instance.GetAuthenticationInfo(); } public void GeAuthenticationInfoForTest() { AuthenticationManager.Instance.GetAuthenticationInfo(); } private void OnAuthenticationInfoCallback(AuthenticationEvent authenticationEvent, string message) { string result = string.Empty; switch (authenticationEvent) { case AuthenticationEvent.NetworkAuthenticationOK: result = "联网鉴权成功"; break; case AuthenticationEvent.LocalAuthenticationOK: result = "本地鉴权成功"; break; case AuthenticationEvent.GetChannelPackageNameFail: result = "获取个人中心包名失败"; break; case AuthenticationEvent.NetworkAuthenticationFail: result = "联网鉴权失败"; break; case AuthenticationEvent.CannotGetChannelUserId: result = "无法获取个人中心用户信息(无网时)"; break; case AuthenticationEvent.NoAuthenticationDataInLocal: result = "本地无缓存鉴权信息,需要联网"; break; case AuthenticationEvent.ChannelUserIdNotMatch: result = "本地健全信息与个人中心用户信息不一致(需要联网)"; break; case AuthenticationEvent.LocalAuthenticationExpire: result = "无网状态本地鉴权信息已过期"; break; } text.text = "鉴权结果:" + result + "\n额外信息:" + message; } }