完整实现登录注册所有功能

This commit is contained in:
“虞渠成” 2026-04-20 08:31:41 +08:00
parent 01cd15f9c1
commit 80857fdb47
40 changed files with 524 additions and 296 deletions

Binary file not shown.

View File

@ -1,23 +0,0 @@
ManifestFileVersion: 0
CRC: 3747323971
AssetBundleManifest:
AssetBundleInfos:
Info_0:
Name: ui_homepage.ab
Dependencies:
Dependency_0: common.ab
Info_1:
Name: common.ab
Dependencies: {}
Info_2:
Name: language.ab
Dependencies: {}
Info_3:
Name: ui_common.ab
Dependencies:
Dependency_0: common.ab
Dependency_1: ui_loginpage.ab
Info_4:
Name: ui_loginpage.ab
Dependencies:
Dependency_0: ui_common.ab

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8efc0a24208a4ad4199a43f0fff4f33d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2beb8f636348f43418639d8d3b8398f8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
{
"project_info": {
"project_number": "785438724947",
"project_id": "photonmatrix-ac0b5",
"storage_bucket": "photonmatrix-ac0b5.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:785438724947:android:352ede76bb25311f51c7a6",
"android_client_info": {
"package_name": "com.photonmatrix.photonmatrix"
}
},
"oauth_client": [
{
"client_id": "785438724947-kpjbqi43hbj6eddianbjsgkgkkclkfmd.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAntcCsZGurbXg7TFbPMPx5aek6HDYYVxk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "785438724947-kpjbqi43hbj6eddianbjsgkgkkclkfmd.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "785438724947-r578u4au09ebieu0pnahj8ef08s1uhqp.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.photonmatrix.photonmatrix"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c24a7550296d5d54d91f866dd40936db
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,15 +1,15 @@
ManifestFileVersion: 0 ManifestFileVersion: 0
CRC: 1723046804 CRC: 749593259
Hashes: Hashes:
AssetFileHash: AssetFileHash:
serializedVersion: 2 serializedVersion: 2
Hash: 797f6f2f02274927028e5eb11bb9976e Hash: 81a8de0bb4c5928c43220b249b335c6b
TypeTreeHash: TypeTreeHash:
serializedVersion: 2 serializedVersion: 2
Hash: 5ad585dd02dfb5016c0dad519eab8f49 Hash: 5ad585dd02dfb5016c0dad519eab8f49
IncrementalBuildHash: IncrementalBuildHash:
serializedVersion: 2 serializedVersion: 2
Hash: 797f6f2f02274927028e5eb11bb9976e Hash: 81a8de0bb4c5928c43220b249b335c6b
HashAppended: 0 HashAppended: 0
ClassTypes: ClassTypes:
- Class: 49 - Class: 49

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4e4b248a1ea1d1647b673d83229260a8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 92d0cbb4b3e260c4fb37b1f2def9aacd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,30 +1,55 @@
{ {
"version": "1.0.0", "version": "1.0.1",
"assetbundles": [ "assetbundles": [
{ {
"name": "common", "name": "common.ab",
"size": 12854223, "size": 12854223,
"md5": "c2fa51b131e3d8a65d4134c8670ee99b" "md5": "c2fa51b131e3d8a65d4134c8670ee99b"
}, },
{ {
"name": "language", "name": "language.ab",
"size": 2141, "size": 2226,
"md5": "e11b0286b48552dc19ca3c556b2bf1fd" "md5": "6e10d9c8c23778a25684dd8d69350510"
}, },
{ {
"name": "ui_common", "name": "ui_common.ab",
"size": 12606, "size": 12606,
"md5": "1dfaf11957a90b775e0be5f6fe37452b" "md5": "1dfaf11957a90b775e0be5f6fe37452b"
}, },
{ {
"name": "ui_homepage", "name": "ui_homepage.ab",
"size": 9787, "size": 9787,
"md5": "4c4595943f5c31673338e2ca83147ee8" "md5": "4c4595943f5c31673338e2ca83147ee8"
}, },
{ {
"name": "ui_loginpage", "name": "ui_loginpage.ab",
"size": 242126, "size": 241923,
"md5": "55c7e98bc05f6114de0a1445c68d7ea5" "md5": "520989d12bfdae3368c3fd88f8381d3e"
},
{
"name": "common.ab.manifest",
"size": 2173,
"md5": "7f35fb8fc14986f31d17c6483a90b4f3"
},
{
"name": "language.ab.manifest",
"size": 473,
"md5": "335cc7d7481861141ee8e6fff52f3976"
},
{
"name": "ui_common.ab.manifest",
"size": 2905,
"md5": "a05683fbffe6068095d6b7ef877f0ef4"
},
{
"name": "ui_homepage.ab.manifest",
"size": 2419,
"md5": "c3971548d08125ef72bade017cebabdc"
},
{
"name": "ui_loginpage.ab.manifest",
"size": 4757,
"md5": "99941302876547c4759f674f80fee5db"
} }
] ]
} }

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e56d42cf285d10847a9084054c83be13
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 411ccbd3ce3893b4cb7c2f82531993fe
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6692d8124d25ece40acb1da49bb1bf7e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 427bee84e8448674196ec081992050a0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6012662144bcee14e9f85185bd36b2c1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,15 +1,15 @@
ManifestFileVersion: 0 ManifestFileVersion: 0
CRC: 4164004111 CRC: 4028950989
Hashes: Hashes:
AssetFileHash: AssetFileHash:
serializedVersion: 2 serializedVersion: 2
Hash: 7ac2dfa1ef8c51780a36380c1952f749 Hash: 59dce4d2a0ce9e0ae41212946c77f075
TypeTreeHash: TypeTreeHash:
serializedVersion: 2 serializedVersion: 2
Hash: 91ff5ca08bee0306c72c34bd9a34b897 Hash: 70589c2c13c216b3c5fa3022c1dc899e
IncrementalBuildHash: IncrementalBuildHash:
serializedVersion: 2 serializedVersion: 2
Hash: 7ac2dfa1ef8c51780a36380c1952f749 Hash: 59dce4d2a0ce9e0ae41212946c77f075
HashAppended: 0 HashAppended: 0
ClassTypes: ClassTypes:
- Class: 1 - Class: 1
@ -34,6 +34,8 @@ ClassTypes:
Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 271b50f7241504b49a6a7493d13721e7, type: 3} Script: {fileID: 11500000, guid: 271b50f7241504b49a6a7493d13721e7, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: f53257c6334f5224a8c3d192d5653d1c, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
- Class: 114 - Class: 114

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8d67207d165a11a41abac6e85483b748
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 65d66671e6ec89c46a4bd059254702a0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -83,13 +83,31 @@ public class AssetBundleListGenerator : EditorWindow
{ {
List<AssetBundleInfo> bundleInfos = new List<AssetBundleInfo>(); List<AssetBundleInfo> bundleInfos = new List<AssetBundleInfo>();
// 获取目录下所有.ab文件 // 获取目录下所有.ab文件和.ab.manifest文件
string[] abFiles = Directory.GetFiles(folderPath, "*.ab", SearchOption.AllDirectories); string[] abFiles = Directory.GetFiles(folderPath, "*.ab", SearchOption.AllDirectories);
string[] manifestFiles = Directory.GetFiles(folderPath, "*.ab.manifest", SearchOption.AllDirectories);
foreach (string filePath in abFiles) foreach (string filePath in abFiles)
{ {
FileInfo fileInfo = new FileInfo(filePath); FileInfo fileInfo = new FileInfo(filePath);
string fileName = Path.GetFileNameWithoutExtension(filePath); string fileName = Path.GetFileName(filePath);
// 创建AssetBundleInfo对象
AssetBundleInfo info = new AssetBundleInfo()
{
name = fileName,
size = fileInfo.Length,
md5 = GetMD5HashFromFile(filePath)
};
bundleInfos.Add(info);
}
// 添加.manifest文件
foreach (string filePath in manifestFiles)
{
FileInfo fileInfo = new FileInfo(filePath);
string fileName = Path.GetFileName(filePath); // 保留.manifest后缀
// 创建AssetBundleInfo对象 // 创建AssetBundleInfo对象
AssetBundleInfo info = new AssetBundleInfo() AssetBundleInfo info = new AssetBundleInfo()

View File

@ -198,6 +198,16 @@
"key": "100040", "key": "100040",
"zh": "账号或密码错误,请重试", "zh": "账号或密码错误,请重试",
"en": "Incorrect username or password. Please try again" "en": "Incorrect username or password. Please try again"
},
{
"key": "100041",
"zh": "该邮箱已绑定至其他账号,请更换邮箱",
"en": "This email is already linked to another account. Please use a different email"
},
{
"key": "100042",
"zh": "第三方账号授权失败,请重试",
"en": "Authorization failed. Please try again"
} }
] ]

View File

@ -1742,6 +1742,7 @@ MonoBehaviour:
- {fileID: 3193987252293487442} - {fileID: 3193987252293487442}
- {fileID: 6955140603665847554} - {fileID: 6955140603665847554}
- {fileID: 3147153994057625843} - {fileID: 3147153994057625843}
- {fileID: 1019959377021005830}
PrivacyAgreementTip: {fileID: 2496689810772355960} PrivacyAgreementTip: {fileID: 2496689810772355960}
PrivacyAgreementPlane: PrivacyAgreementPlane:
- {fileID: 6381042080645703062} - {fileID: 6381042080645703062}
@ -10183,13 +10184,14 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1639875081832707489} - component: {fileID: 1639875081832707489}
- component: {fileID: 3652785914819211941} - component: {fileID: 3652785914819211941}
- component: {fileID: 1019959377021005830}
m_Layer: 5 m_Layer: 5
m_Name: "\u7ED1\u5B9A\u7B2C\u4E09\u65B9" m_Name: "\u7ED1\u5B9A\u7B2C\u4E09\u65B9"
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &1639875081832707489 --- !u!224 &1639875081832707489
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -10220,6 +10222,22 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8197244891143982658} m_GameObject: {fileID: 8197244891143982658}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!114 &1019959377021005830
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8197244891143982658}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f53257c6334f5224a8c3d192d5653d1c, type: 3}
m_Name:
m_EditorClassIdentifier:
pageType: 5
emailInput: {fileID: 3767868839594136140}
errorText: {fileID: 8713072464975864109}
nextBtn: {fileID: 1994062947339244197}
--- !u!1 &8253023617244837761 --- !u!1 &8253023617244837761
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -224,140 +224,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!1001 &301505139
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1896827481}
m_Modifications:
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2315241295588288027, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_Name
value: loginPage
objectReference: {fileID: 0}
- target: {fileID: 8197244891143982658, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8954635767052804253, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f96c15501623f0a4f9a2d5047a50f35a, type: 3}
--- !u!224 &301505140 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 554090642281332281, guid: f96c15501623f0a4f9a2d5047a50f35a,
type: 3}
m_PrefabInstance: {fileID: 301505139}
m_PrefabAsset: {fileID: 0}
--- !u!1 &433695806 --- !u!1 &433695806
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -506,7 +372,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 05b49f3efc06bd84b91275be192861eb, type: 3} m_Script: {fileID: 11500000, guid: 05b49f3efc06bd84b91275be192861eb, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
resPosition: 1 resPosition: 2
commonList: commonList:
- common - common
- ui_common - ui_common
@ -522,7 +388,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 401839f502466cb4a8a96f5f45e15280, type: 3} m_Script: {fileID: 11500000, guid: 401839f502466cb4a8a96f5f45e15280, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
languageType: 0 languageType: 1
--- !u!114 &609900190 --- !u!114 &609900190
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -546,9 +412,9 @@ MonoBehaviour:
value: value:
maxConcurrentRequests: 5 maxConcurrentRequests: 5
resourceUrls: resourceUrls:
- https://nextreal.cn/photon-matrix-api - https://cdn.muffin100.com/MuffinSpace/test1/
nowResourceIndex: 0 nowResourceIndex: 0
resourceVersion: 1.0.0 resourceVersion: 1.0.1
nowBundleList: nowBundleList:
version: version:
assetbundles: [] assetbundles: []
@ -573,6 +439,9 @@ MonoBehaviour:
email: email:
username: username:
role: role:
exam_completed: 0
device_count: 0
total_kill_count: 0
--- !u!114 &609900193 --- !u!114 &609900193
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1178,8 +1047,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children: []
- {fileID: 301505140}
m_Father: {fileID: 1547547273} m_Father: {fileID: 1547547273}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}

View File

@ -66,6 +66,9 @@ namespace Kill.Managers
public string email; public string email;
public string username; public string username;
public string role; public string role;
public bool exam_completed;
public int device_count;
public int total_kill_count;
} }
#endregion #endregion
#region #region
@ -110,6 +113,27 @@ namespace Kill.Managers
{ {
public string firebase_token; public string firebase_token;
} }
public class BindFireBaseRequest
{
public string code;
public string email;
public string temp_token;
}
/// <summary>
/// Firebase 绑定响应
/// </summary>
public class FirebaseBindResponse
{
public int code;
public string message;
public FirebaseBindData data;
}
public class FirebaseBindData
{
public bool firebase_bind;
}
#endregion #endregion
} }

View File

@ -23,6 +23,7 @@ namespace Kill.Managers
this.token = token; this.token = token;
this.userInfo = userInfo; this.userInfo = userInfo;
string userData =JsonUtility.ToJson(userInfo); string userData =JsonUtility.ToJson(userInfo);
Debug.Log(userData);
PlayerPrefs.SetString("token", token); PlayerPrefs.SetString("token", token);
PlayerPrefs.SetString("userData", userData); PlayerPrefs.SetString("userData", userData);
NetworkCtrl.Instance.RemoveGlobalHeader("Authorization"); NetworkCtrl.Instance.RemoveGlobalHeader("Authorization");

View File

@ -59,7 +59,8 @@ namespace Kill.Managers
/// 谷歌登录 /// 谷歌登录
/// 使用 Firebase 内置的 Google 登录弹窗 /// 使用 Firebase 内置的 Google 登录弹窗
/// </summary> /// </summary>
public void SignInWithGoogle(Action<GoogleLoginResult> onSuccess, Action<string> onError) /// <param name="timeoutSeconds">超时时间默认30秒</param>
public void SignInWithGoogle(Action<GoogleLoginResult> onSuccess, Action<string> onError, int timeoutSeconds = 30)
{ {
#if UNITY_ANDROID && !UNITY_EDITOR #if UNITY_ANDROID && !UNITY_EDITOR
if (auth == null) if (auth == null)
@ -68,6 +69,19 @@ namespace Kill.Managers
return; return;
} }
bool isCompleted = false;
// 启动超时检测
Task.Run(async () =>
{
await Task.Delay(TimeSpan.FromSeconds(timeoutSeconds));
if (!isCompleted)
{
isCompleted = true;
MainThread.Enqueue(() => onError?.Invoke($"Google 登录超时({timeoutSeconds}秒)"));
}
});
// 获取 Google 登录 Provider // 获取 Google 登录 Provider
var provider = new FederatedOAuthProviderData("google.com"); var provider = new FederatedOAuthProviderData("google.com");
provider.Scopes = new string[] { "email", "profile" }; provider.Scopes = new string[] { "email", "profile" };
@ -76,6 +90,9 @@ namespace Kill.Managers
auth.SignInWithProviderAsync(federatedProvider).ContinueWith(task => auth.SignInWithProviderAsync(federatedProvider).ContinueWith(task =>
{ {
if (isCompleted) return; // 已超时,忽略结果
isCompleted = true;
if (task.IsFaulted) if (task.IsFaulted)
{ {
MainThread.Enqueue(() => onError?.Invoke("Google 登录失败")); MainThread.Enqueue(() => onError?.Invoke("Google 登录失败"));
@ -118,13 +135,14 @@ namespace Kill.Managers
{ {
var mockResult = new GoogleLoginResult var mockResult = new GoogleLoginResult
{ {
FirebaseUserId = "mock_firebase_user_id_12345", FirebaseUserId = "1231232345",
Email = "mock@gmail.com", Email = "mock@gmail.com",
DisplayName = "Mock User", DisplayName = "Mock User",
PhotoUrl = "", PhotoUrl = "",
IdToken = "" IdToken = ""
}; };
onSuccess?.Invoke(mockResult); //onSuccess?.Invoke(mockResult);
onError?.Invoke("Google 登录被取消");
}); });
}); });
#endif #endif

View File

@ -3,11 +3,13 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using UnityEngine; using UnityEngine;
namespace Kill.Managers namespace Kill.Managers
{ {
public class LanguageManager : MonoBehaviour public class LanguageManager : MonoBehaviour
{ {
public static LanguageManager Instance; public static LanguageManager Instance;
[System.Serializable] [System.Serializable]
public struct Language public struct Language
{ {
@ -15,18 +17,54 @@ namespace Kill.Managers
public string zh; public string zh;
public string en; public string en;
} }
List<Language> languageList; List<Language> languageList;
[System.Serializable] [System.Serializable]
public enum LanguageType public enum LanguageType
{ {
Chinese, Chinese,
English English
} }
void Awake() void Awake()
{ {
Instance = this; Instance = this;
} }
public LanguageType languageType = LanguageType.English; public LanguageType languageType = LanguageType.English;
/// <summary>
/// 根据系统语言自动设置 App 语言
/// 只有简体中文和繁体中文显示中文,其他全部显示英文
/// </summary>
public void SetLanguageBySystem()
{
SystemLanguage systemLanguage = Application.systemLanguage;
Debug.Log($"系统语言: {systemLanguage}");
if (systemLanguage == SystemLanguage.Chinese ||
systemLanguage == SystemLanguage.ChineseSimplified ||
systemLanguage == SystemLanguage.ChineseTraditional)
{
languageType = LanguageType.Chinese;
Debug.Log("设置语言为: 中文");
}
else
{
languageType = LanguageType.English;
Debug.Log("设置语言为: 英文");
}
}
/// <summary>
/// 手动设置语言
/// </summary>
public void SetLanguage(LanguageType type)
{
languageType = type;
Debug.Log($"手动设置语言为: {type}");
}
public async Task Init() public async Task Init()
{ {
TextAsset textAsset = await LoadRes.Instance.LoadAssetAsync<TextAsset>("language", "language.json"); TextAsset textAsset = await LoadRes.Instance.LoadAssetAsync<TextAsset>("language", "language.json");

View File

@ -447,7 +447,7 @@ namespace Kill.Network
public async Task GetBundleList() public async Task GetBundleList()
{ {
string url = nowResourceUrl + $"{resourceVersion}/{platform}/list.json"; string url = nowResourceUrl + $"{platform}/{resourceVersion}/list.json";
using (UnityWebRequest webRequest = UnityWebRequest.Get(url)) using (UnityWebRequest webRequest = UnityWebRequest.Get(url))
{ {
var operation = webRequest.SendWebRequest(); var operation = webRequest.SendWebRequest();
@ -521,7 +521,7 @@ namespace Kill.Network
} }
else else
{ {
ToastUI.Show("100039"); ToastUI.ShowText("资源更新失败");
Debug.LogError("资源更新失败"); Debug.LogError("资源更新失败");
await UpdateResources(); await UpdateResources();
} }
@ -596,7 +596,7 @@ namespace Kill.Network
foreach (var bundle in updateList) foreach (var bundle in updateList)
{ {
string url = nowResourceUrl + $"{resourceVersion}/{platform}/{bundle.name}"; string url = nowResourceUrl + $"{platform}/{resourceVersion}/{bundle.name}";
string savePath = Path.Combine(localPath, bundle.name); string savePath = Path.Combine(localPath, bundle.name);
string directory = Path.GetDirectoryName(savePath); string directory = Path.GetDirectoryName(savePath);

View File

@ -288,7 +288,6 @@ namespace Kill.UI.Pages
#region #region
private string currentEmail = ""; private string currentEmail = "";
/// <summary> /// <summary>
/// 设置当前登录邮箱 /// 设置当前登录邮箱
/// </summary> /// </summary>
@ -310,7 +309,7 @@ namespace Kill.UI.Pages
#region #region
/// <summary> /// <summary>
/// 验证邮箱是否已注册(模拟接口) /// 验证邮箱是否已注册
/// </summary> /// </summary>
public async Task CheckEmailRegistered(string email, Action<bool> onSuccess, Action<int, string> onError) public async Task CheckEmailRegistered(string email, Action<bool> onSuccess, Action<int, string> onError)
{ {
@ -338,7 +337,6 @@ namespace Kill.UI.Pages
} }
#endregion #endregion
#region #region
@ -447,7 +445,6 @@ namespace Kill.UI.Pages
} }
} }
#endregion #endregion
#region #region
@ -465,7 +462,7 @@ namespace Kill.UI.Pages
}; };
try try
{ {
var response = await NetworkCtrl.Instance.Post<NoDataResponse>("/api/v1/auth/reset-password", requestData); var response = await NetworkCtrl.Instance.Post<NoDataResponse>("/api/v1/auth/password/reset", requestData);
LoadingUI.Hide(); LoadingUI.Hide();
ResponseCodeHandler.HandleResponse(response, ResponseCodeHandler.HandleResponse(response,
onSuccess: (data) => onSuccess: (data) =>
@ -484,7 +481,48 @@ namespace Kill.UI.Pages
} }
} }
#endregion #endregion
#region Id
private string currentFireBaseId="";
public string GetCurrentFireBaseId()
{
return currentFireBaseId;
}
public void SetCurrentFireBaseId(string id)
{
currentFireBaseId = id;
}
#endregion
#region
/// <summary>
/// 验证邮箱是已绑定第三方帐号
/// </summary>
public async Task CheckEmailRegisteredFireBase(string email, Action<bool> onSuccess, Action<int, string> onError)
{
LoadingUI.Show();
var requestData = new EmailCodeRequest
{
email = email
};
var response = await NetworkCtrl.Instance.Post<FirebaseBindResponse>("/api/v1/auth/firebase/check", requestData);
LoadingUI.Hide();
ResponseCodeHandler.HandleResponse(response,
onSuccess: (response) =>
{
Debug.Log(response.data.firebase_bind);
bool isRegistered =response.data.firebase_bind;
onSuccess?.Invoke(isRegistered);
},
onError: onError
);
}
#endregion
#region #region
/// <summary> /// <summary>
/// 谷歌登录 /// 谷歌登录
@ -500,6 +538,7 @@ namespace Kill.UI.Pages
{ {
LoadingUI.Hide(); LoadingUI.Hide();
Debug.Log($"谷歌登录成功: {result.DisplayName}, FirebaseID: {result.FirebaseUserId}"); Debug.Log($"谷歌登录成功: {result.DisplayName}, FirebaseID: {result.FirebaseUserId}");
SetCurrentFireBaseId(result.FirebaseUserId);
FireBaseLogin(result.FirebaseUserId, onSuccess:(response) => FireBaseLogin(result.FirebaseUserId, onSuccess:(response) =>
{ {
Debug.Log(response.token); Debug.Log(response.token);
@ -507,13 +546,14 @@ namespace Kill.UI.Pages
},onError:(code,message)=> },onError:(code,message)=>
{ {
Debug.Log(message); Debug.Log(message);
ShowSubPage(SubPageType.ThirdPartyBind);
}); });
}, },
onError: (error) => onError: (error) =>
{ {
LoadingUI.Hide(); LoadingUI.Hide();
Debug.LogError($"谷歌登录失败: {error}"); Debug.LogError($"谷歌登录失败: {error}");
ToastUI.Show("100036"); // 登录失败提示 ToastUI.Show("100042"); // 登录失败提示
} }
); );
} }
@ -535,7 +575,9 @@ namespace Kill.UI.Pages
onSuccess: (data) => onSuccess: (data) =>
{ {
Debug.Log("Firebase登录成功"); Debug.Log("Firebase登录成功");
ToastUI.ShowText("登录成功");
onSuccess?.Invoke(response.Data.data); onSuccess?.Invoke(response.Data.data);
DataManager.Instance.SetToken(response.Data.data.token,response.Data.data.user);
}, },
onError: onError onError: onError
); );
@ -550,6 +592,38 @@ namespace Kill.UI.Pages
#endregion
#region
public async Task BindFireBase(string code, Action<LoginData> onSuccess, Action<int, string> onError)
{
LoadingUI.Show();
var requestData = new BindFireBaseRequest
{
code = code,
temp_token = currentFireBaseId,
email = currentEmail
};
try
{
var response = await NetworkCtrl.Instance.Post<LoginResponse>("/api/v1/auth/firebase/bind", requestData);
LoadingUI.Hide();
ResponseCodeHandler.HandleResponse(response,
onSuccess: (response) =>
{
Debug.Log("绑定Firebase成功");
DataManager.Instance.SetToken(response.data.token,response.data.user);
onSuccess?.Invoke(response.data);
},
onError: onError
);
}
catch (Exception ex)
{
LoadingUI.Hide();
Debug.LogError("绑定Firebase异常: " + ex.Message);
onError?.Invoke(-1, ex.Message);
}
}
#endregion #endregion
} }
} }

View File

@ -3,6 +3,7 @@ using UnityEngine.UI;
using Kill.Managers; using Kill.Managers;
using Kill.Utils; using Kill.Utils;
using Kill.Network; using Kill.Network;
using Kill.UI.Components;
namespace Kill.UI.Pages namespace Kill.UI.Pages
{ {
@ -53,6 +54,7 @@ namespace Kill.UI.Pages
{ {
// 登录成功 // 登录成功
Debug.Log("登录成功,准备跳转主页"); Debug.Log("登录成功,准备跳转主页");
ToastUI.ShowText("登录成功");
// UIManager.Instance.OpenPage(UIManager.PageName.HomePage); // UIManager.Instance.OpenPage(UIManager.PageName.HomePage);
}, },
onError: (code, message) => onError: (code, message) =>

View File

@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using Kill.Managers; using Kill.Managers;
using Kill.UI.Components; using Kill.UI.Components;
using Kill.Utils;
namespace Kill.UI.Pages namespace Kill.UI.Pages
{ {
@ -10,96 +11,67 @@ namespace Kill.UI.Pages
/// </summary> /// </summary>
public class ThirdPartyBindPanel : LoginSubPageBase public class ThirdPartyBindPanel : LoginSubPageBase
{ {
[Header("登录按钮")]
public Button wechatBtn;
public Button qqBtn;
public Button appleBtn;
public Button googleBtn; // 谷歌登录按钮
[Header("返回")] [Header("输入组件")]
public Button backBtn; public InputField emailInput;
[Header("显示组件")]
public Text errorText;
[Header("按钮")]
public Button nextBtn;
protected override void OnInitialize() protected override void OnInitialize()
{ {
if (wechatBtn != null) // 绑定按钮事件
wechatBtn.onClick.AddListener(() => OnThirdPartyLogin("wechat")); if (nextBtn != null)
nextBtn.onClick.AddListener(OnGetCodeAsync);
if (qqBtn != null)
qqBtn.onClick.AddListener(() => OnThirdPartyLogin("qq"));
if (appleBtn != null)
appleBtn.onClick.AddListener(() => OnThirdPartyLogin("apple"));
if (googleBtn != null)
googleBtn.onClick.AddListener(OnGoogleLogin);
if (backBtn != null)
backBtn.onClick.AddListener(GoBack);
// Android 平台显示谷歌登录按钮
#if UNITY_ANDROID && !UNITY_EDITOR
if (googleBtn != null)
googleBtn.gameObject.SetActive(true);
#else
if (googleBtn != null)
googleBtn.gameObject.SetActive(false);
#endif
} }
/// <summary> protected override void OnShow()
/// 谷歌登录
/// </summary>
private void OnGoogleLogin()
{ {
Debug.Log("开始谷歌登录..."); errorText.text = "";
emailInput.text = "";
}
LoadingUI.Show(); private async void OnGetCodeAsync()
FirebaseAuthManager.Instance.SignInWithGoogle(
onSuccess: (result) =>
{ {
LoadingUI.Hide(); string email = emailInput != null ? emailInput.text : "";
Debug.Log($"谷歌登录成功: {result.DisplayName}, FirebaseID: {result.FirebaseUserId}"); if (string.IsNullOrEmpty(email) || !ValidationUtils.IsValidEmailStrict(email))
{
errorText.text = LanguageManager.Instance.GetLanguage("100006");
return;
}
await LoginPageCtrl.Instance.CheckEmailRegisteredFireBase(email,
onSuccess: async (data) =>
{
if (data)
{
errorText.text = LanguageManager.Instance.GetLanguage("100041");
return;
}
else
{
LoginPageCtrl.Instance.SetCurrentEmail(email);
await LoginPageCtrl.Instance.SendCode(email, () =>
{
// 设置验证码页面为注册场景
var verifyPanel = GetSubPage(LoginPageCtrl.SubPageType.VerificationCode) as VerificationCodePanel;
if (verifyPanel != null)
{
verifyPanel.SetSceneType(VerificationCodePanel.CodeSceneType.bindThirdParty);
}
ShowPage(LoginPageCtrl.SubPageType.VerificationCode);
});
}
// 调用后端绑定接口
BindGoogleAccount(result);
}, },
onError: (error) => onError: (code, message) =>
{ {
LoadingUI.Hide(); errorText.text = message;
Debug.LogError($"谷歌登录失败: {error}"); return;
ToastUI.Show("100036"); // 登录失败提示
} }
); );
}
/// <summary>
/// 绑定谷歌账号到本系统
/// </summary>
private void BindGoogleAccount(GoogleLoginResult googleResult)
{
string email = LoginPageCtrl.Instance.GetCurrentEmail();
}
private void OnThirdPartyLogin(string platform)
{
Debug.Log($"第三方登录: {platform}");
// TODO: 调用对应平台的SDK
switch (platform)
{
case "wechat":
// 微信登录
break;
case "qq":
// QQ登录
break;
case "apple":
// Apple登录
break;
}
} }
} }
} }

View File

@ -36,7 +36,9 @@ namespace Kill.UI.Pages
public enum CodeSceneType public enum CodeSceneType
{ {
Register, // 注册 Register, // 注册
ResetPassword // 忘记密码重置 ResetPassword, // 忘记密码重置
bindThirdParty //绑定第三方帐号
} }
protected override void OnInitialize() protected override void OnInitialize()
{ {
@ -92,10 +94,24 @@ namespace Kill.UI.Pages
currentSceneType = type; currentSceneType = type;
} }
private void OnConfirm() private async Task OnConfirm()
{ {
string code = codeInput != null ? codeInput.GetCode() : ""; string code = codeInput != null ? codeInput.GetCode() : "";
if (currentSceneType == CodeSceneType.bindThirdParty)
{
await LoginPageCtrl.Instance.BindFireBase(code,
onSuccess: (data) =>
{
ToastUI.ShowText("登录成功");
},
onError: (code, message) =>
{
// 显示错误
errorText.text = LanguageManager.Instance.GetLanguage("100017");
}
);
return;
}
// 验证验证码 // 验证验证码
LoginPageCtrl.Instance.VerifyCode(emailText.text, code, LoginPageCtrl.Instance.VerifyCode(emailText.text, code,
onSuccess: () => onSuccess: () =>

View File

@ -39,8 +39,17 @@ namespace Kill.Utils
{ {
if (action == null) return; if (action == null) return;
// 如果已经在主线程,直接执行 // 编辑器环境下,如果调度器未初始化,直接执行
if (_instance != null && _instance.gameObject != null) #if UNITY_EDITOR
if (_instance == null)
{
action?.Invoke();
return;
}
#endif
// 如果调度器已初始化,加入队列
if (_instance != null)
{ {
lock (_lock) lock (_lock)
{ {
@ -49,8 +58,7 @@ namespace Kill.Utils
} }
else else
{ {
// 如果调度器还没初始化,延迟执行 // 真机环境下调度器应该已初始化,如果未初始化则直接执行
Debug.LogWarning("MainThread 未初始化,尝试延迟执行");
action?.Invoke(); action?.Invoke();
} }
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e86b33b2ff0aaba4b90c494668bbb115 guid: c24a7550296d5d54d91f866dd40936db
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

Binary file not shown.

View File

@ -1,15 +1,15 @@
ManifestFileVersion: 0 ManifestFileVersion: 0
CRC: 1723046804 CRC: 749593259
Hashes: Hashes:
AssetFileHash: AssetFileHash:
serializedVersion: 2 serializedVersion: 2
Hash: 797f6f2f02274927028e5eb11bb9976e Hash: 81a8de0bb4c5928c43220b249b335c6b
TypeTreeHash: TypeTreeHash:
serializedVersion: 2 serializedVersion: 2
Hash: 5ad585dd02dfb5016c0dad519eab8f49 Hash: 5ad585dd02dfb5016c0dad519eab8f49
IncrementalBuildHash: IncrementalBuildHash:
serializedVersion: 2 serializedVersion: 2
Hash: 797f6f2f02274927028e5eb11bb9976e Hash: 81a8de0bb4c5928c43220b249b335c6b
HashAppended: 0 HashAppended: 0
ClassTypes: ClassTypes:
- Class: 49 - Class: 49

View File

@ -1,30 +1,55 @@
{ {
"version": "1.0.0", "version": "1.0.1",
"assetbundles": [ "assetbundles": [
{ {
"name": "common", "name": "common.ab",
"size": 12854223, "size": 12854223,
"md5": "c2fa51b131e3d8a65d4134c8670ee99b" "md5": "c2fa51b131e3d8a65d4134c8670ee99b"
}, },
{ {
"name": "language", "name": "language.ab",
"size": 2141, "size": 2226,
"md5": "e11b0286b48552dc19ca3c556b2bf1fd" "md5": "6e10d9c8c23778a25684dd8d69350510"
}, },
{ {
"name": "ui_common", "name": "ui_common.ab",
"size": 12606, "size": 12606,
"md5": "1dfaf11957a90b775e0be5f6fe37452b" "md5": "1dfaf11957a90b775e0be5f6fe37452b"
}, },
{ {
"name": "ui_homepage", "name": "ui_homepage.ab",
"size": 9787, "size": 9787,
"md5": "4c4595943f5c31673338e2ca83147ee8" "md5": "4c4595943f5c31673338e2ca83147ee8"
}, },
{ {
"name": "ui_loginpage", "name": "ui_loginpage.ab",
"size": 242126, "size": 241923,
"md5": "55c7e98bc05f6114de0a1445c68d7ea5" "md5": "520989d12bfdae3368c3fd88f8381d3e"
},
{
"name": "common.ab.manifest",
"size": 2173,
"md5": "7f35fb8fc14986f31d17c6483a90b4f3"
},
{
"name": "language.ab.manifest",
"size": 473,
"md5": "335cc7d7481861141ee8e6fff52f3976"
},
{
"name": "ui_common.ab.manifest",
"size": 2905,
"md5": "a05683fbffe6068095d6b7ef877f0ef4"
},
{
"name": "ui_homepage.ab.manifest",
"size": 2419,
"md5": "c3971548d08125ef72bade017cebabdc"
},
{
"name": "ui_loginpage.ab.manifest",
"size": 4757,
"md5": "99941302876547c4759f674f80fee5db"
} }
] ]
} }

View File

@ -1,15 +1,15 @@
ManifestFileVersion: 0 ManifestFileVersion: 0
CRC: 4164004111 CRC: 4028950989
Hashes: Hashes:
AssetFileHash: AssetFileHash:
serializedVersion: 2 serializedVersion: 2
Hash: 7ac2dfa1ef8c51780a36380c1952f749 Hash: 59dce4d2a0ce9e0ae41212946c77f075
TypeTreeHash: TypeTreeHash:
serializedVersion: 2 serializedVersion: 2
Hash: 91ff5ca08bee0306c72c34bd9a34b897 Hash: 70589c2c13c216b3c5fa3022c1dc899e
IncrementalBuildHash: IncrementalBuildHash:
serializedVersion: 2 serializedVersion: 2
Hash: 7ac2dfa1ef8c51780a36380c1952f749 Hash: 59dce4d2a0ce9e0ae41212946c77f075
HashAppended: 0 HashAppended: 0
ClassTypes: ClassTypes:
- Class: 1 - Class: 1
@ -34,6 +34,8 @@ ClassTypes:
Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 271b50f7241504b49a6a7493d13721e7, type: 3} Script: {fileID: 11500000, guid: 271b50f7241504b49a6a7493d13721e7, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: f53257c6334f5224a8c3d192d5653d1c, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
- Class: 114 - Class: 114