12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Example : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- API_Module_PlatformAccount.RegistLoginSuccessCallback(LoginSuccessCallback);
- API_Module_PlatformAccount.RegistLoginFailCallback(LoginFailedCallback);
- API_Module_PlatformAccount.RegisteLogoutSuccessCakkback(LogoutSuccessCallback);
- API_Module_PlatformAccount.RegisteLogoutSuccessCakkback(LogoutFailedCallback);
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.L))
- {
- API_Module_PlatformAccount.Logout();
- }
- if (Input.GetKeyDown(KeyCode.R))
- {
- API_Module_PlatformAccount.RefreshUserData();
- }
- if (Input.GetKeyDown(KeyCode.U))
- {
- Debug.Log("UserData : " + JsonUtility.ToJson(API_Module_PlatformAccount.UserData));
- }
- if (Input.GetKeyDown(KeyCode.C))
- {
- API_Module_PlatformAccount.CheckUserState();
- }
- }
- private void OnDestroy()
- {
- API_Module_PlatformAccount.UnRegistLoginSuccessCallback(LoginSuccessCallback);
- API_Module_PlatformAccount.UnRegistLoginFailCallback(LoginFailedCallback);
- API_Module_PlatformAccount.UnRegisteLogoutSuccessCakkback(LogoutSuccessCallback);
- API_Module_PlatformAccount.UnRegisteLogoutSuccessCakkback(LogoutFailedCallback);
- }
- private void LoginSuccessCallback(string json)
- {
- Debug.Log("登录成功");
- }
- private void LoginFailedCallback(string json)
- {
- Debug.Log("登录失败");
- }
- private void LogoutSuccessCallback(string json)
- {
- Debug.Log("退出登录成功");
- }
- private void LogoutFailedCallback(string json)
- {
- Debug.Log("退出登录失败");
- }
- }
|