添加TapTap登录
This commit is contained in:
20
Assets/Scripts/Online/Editor/IchniOnline.Editor.asmdef
Normal file
20
Assets/Scripts/Online/Editor/IchniOnline.Editor.asmdef
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "IchniOnline.Editor",
|
||||
"rootNamespace": "IchniOnline.Editor",
|
||||
"references": [
|
||||
"GUID:4c28cc81f4cf77b4281433b444fd27db",
|
||||
"GUID:cfcd2ce455f8d1944942cdd919ecaa60",
|
||||
"GUID:eb59b970a7d779141b50532b8cafd00f"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77df99c74524abf4d92ef9dd1d9bb89c
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
54
Assets/Scripts/Online/Editor/LoginCacheEditor.cs
Normal file
54
Assets/Scripts/Online/Editor/LoginCacheEditor.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using IchniOnline.Online.Logic;
|
||||
using IchniOnline.Online.Models;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace IchniOnline.Editor
|
||||
{
|
||||
public static class LoginCacheEditor
|
||||
{
|
||||
private const string MENU_PATH = "Ichni/Login Cache";
|
||||
|
||||
[MenuItem(MENU_PATH + "/Generate Mock Data")]
|
||||
public static void GenerateMockData()
|
||||
{
|
||||
LoginCacheManager.SaveMockData();
|
||||
var data = LoginCacheManager.CachedData;
|
||||
Debug.Log($"[LoginCacheEditor] 模拟缓存已写入: openId={data.openId}, name={data.name}");
|
||||
}
|
||||
|
||||
[MenuItem(MENU_PATH + "/Clear Cached Data")]
|
||||
public static void ClearCachedData()
|
||||
{
|
||||
LoginCacheManager.Clear();
|
||||
Debug.Log("[LoginCacheEditor] 登录缓存已清除");
|
||||
}
|
||||
|
||||
[MenuItem(MENU_PATH + "/Show Cached Data", false, 200)]
|
||||
public static void ShowCachedData()
|
||||
{
|
||||
if (LoginCacheManager.HasCachedLogin)
|
||||
{
|
||||
var data = LoginCacheManager.CachedData;
|
||||
Debug.Log($"[LoginCacheEditor] 当前缓存:\n" +
|
||||
$" openId: {data.openId}\n" +
|
||||
$" unionId: {data.unionId}\n" +
|
||||
$" name: {data.name}\n" +
|
||||
$" email: {data.email}\n" +
|
||||
$" timestamp: {data.cacheTimestamp}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("[LoginCacheEditor] 无登录缓存");
|
||||
}
|
||||
}
|
||||
|
||||
// 动态禁用:没有缓存时灰显 Clear/Show
|
||||
[MenuItem(MENU_PATH + "/Clear Cached Data", true)]
|
||||
[MenuItem(MENU_PATH + "/Show Cached Data", true)]
|
||||
public static bool ValidateHasCache()
|
||||
{
|
||||
return LoginCacheManager.HasCachedLogin;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Online/Editor/LoginCacheEditor.cs.meta
Normal file
2
Assets/Scripts/Online/Editor/LoginCacheEditor.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d14e73d4506078644a51a3a72cf0c4da
|
||||
Reference in New Issue
Block a user