【m】1111

This commit is contained in:
2025-09-23 11:18:38 +08:00
parent b04e548850
commit a2e0062a34
202 changed files with 13296 additions and 56 deletions

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using Newtonsoft.Json;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
@@ -13,6 +14,11 @@ namespace Stary.Evo
{
private static string authorization;
static WebRequestSystem()
{
authorization = EditorPrefs.GetString("Authorization");
}
public static async Task<bool> Login(string url, string username, string password)
{
var data = new
@@ -53,7 +59,7 @@ namespace Stary.Evo
JsonConvert.DeserializeObject<AuthenticationResponse>(authResponse.data.ToString());
Debug.Log("UnityEvo:AuthenticationResponse" + authResponseData.Token);
authorization = authResponseData.Token;
PlayerPrefs.SetString("Authorization", authorization);
EditorPrefs.SetString("Authorization", authorization);
Debug.Log("UnityEvo:登录成功");
return true;
}
@@ -76,7 +82,7 @@ namespace Stary.Evo
/// <returns></returns>
public static async Task<bool> GetValidateToken(string url)
{
authorization = PlayerPrefs.GetString("Authorization");
authorization = EditorPrefs.GetString("Authorization");
try
{
using UnityWebRequest webRequest = UnityWebRequest.Get($"{url}?token={authorization}");