feat: 完善设备连接流程与多资源更新

1.  新增视频加载中的提示文案与图标资源
2.  调整服务器API地址为正式环境
3.  重构连接设备页面逻辑,优化设备注册绑定流程
4.  更新教学视频与文案为中文版本
5.  增加视频播放前的就绪校验逻辑
This commit is contained in:
“虞渠成” 2026-08-21 09:49:21 +08:00
parent 3703d3a233
commit 0f14d60f2f
8 changed files with 2321 additions and 2227 deletions

View File

@ -1653,8 +1653,12 @@
"key": "100331",
"zh": "设备未录入",
"en": "Device not enrolled"
},
{
"key": "100332",
"zh": "视频加载中,请稍候",
"en": "Video loading, please wait"
}
]

View File

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 862 B

View File

@ -347,9 +347,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: 'Safety protection measure
'
m_Text: "\u5B89\u5168\u9632\u62A4\u63AA\u65BD"
--- !u!1 &319738443453391380
GameObject:
m_ObjectHideFlags: 0
@ -428,7 +426,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: User Registration & Login
m_Text: "\u7528\u6237\u6CE8\u518C\u4E0E\u767B\u5F55"
--- !u!1 &377262142876916419
GameObject:
m_ObjectHideFlags: 0
@ -1284,7 +1282,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Device Sharing
m_Text: "\u8BBE\u5907\u5171\u4EAB"
--- !u!1 &1112031181701958041
GameObject:
m_ObjectHideFlags: 0
@ -1560,7 +1558,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Mosquito Elimination Statistics
m_Text: "\u706D\u868A\u7EDF\u8BA1"
--- !u!1 &1527725899181210923
GameObject:
m_ObjectHideFlags: 0
@ -1622,8 +1620,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/5.+Parameter+Adjustment.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/5.+Parameter+Adjustment.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/5.png
image: {fileID: 3717260069730345174}
--- !u!114 &8904254235188368929
MonoBehaviour:
@ -2238,8 +2236,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/7.+safety+protection+measure.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/7.+safety+protection+measure.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/7.png
image: {fileID: 6967456612895005607}
--- !u!114 &95031282175311434
MonoBehaviour:
@ -2698,8 +2696,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/6.+Mosquito+Elimination+Statistics.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/6.+Mosquito+Elimination+Statistics.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/6.png
image: {fileID: 7215578562602136488}
--- !u!114 &3994667249577245065
MonoBehaviour:
@ -2853,7 +2851,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Timer Settings
m_Text: "\u5B9A\u65F6\u8BBE\u7F6E"
--- !u!1 &3268935626042943130
GameObject:
m_ObjectHideFlags: 0
@ -3008,7 +3006,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Parameter Adjustment
m_Text: "\u53C2\u6570\u8C03\u8282"
--- !u!1 &3564624263664583154
GameObject:
m_ObjectHideFlags: 0
@ -3814,8 +3812,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/2.+Device+Addition+%26+Connection.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/2.+Device+Addition+%26+Connection.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/2.png
image: {fileID: 3943948886744788191}
--- !u!114 &3637757140113248362
MonoBehaviour:
@ -4874,7 +4872,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Device Installation '
m_Text: "\u8BBE\u5907\u5B89\u88C5"
--- !u!1 &6931199043294900238
GameObject:
m_ObjectHideFlags: 0
@ -5012,8 +5010,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/3.+Device+Status+Display+%26+Switching.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/3.+Device+Status+Display+%26+Switching.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/3.png
image: {fileID: 7347704670004227049}
--- !u!114 &427482757974910419
MonoBehaviour:
@ -5800,8 +5798,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/1.+User+Registration+%26+Login.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/1.+User+Registration+%26+Login.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/1.png
image: {fileID: 3516205297615684607}
--- !u!114 &2527040907156600269
MonoBehaviour:
@ -6401,7 +6399,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Device Addition & Connection
m_Text: "\u8BBE\u5907\u6DFB\u52A0\u4E0E\u8FDE\u63A5"
--- !u!1 &7990778163716030203
GameObject:
m_ObjectHideFlags: 0
@ -6693,7 +6691,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.2
m_Text: Device Status Display & Switching
m_Text: "\u8BBE\u5907\u72B6\u6001\u663E\u793A\u4E0E\u5207\u6362"
--- !u!1 &8198818992938206726
GameObject:
m_ObjectHideFlags: 0
@ -6755,8 +6753,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/8.+Device+Sharing.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/8.+Device+Sharing.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/8.png
image: {fileID: 5096007432847472676}
--- !u!114 &336041833714006352
MonoBehaviour:
@ -7063,8 +7061,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 86fb6d9da09c7e84585340890874f0d0, type: 3}
m_Name:
m_EditorClassIdentifier:
videoUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/4.+Timer+Settings.mp4
imageUrl: https://photon-matrix-dev-681536611183-us-east-1-an.s3.us-east-1.amazonaws.com/videos/res/teaching/EN/device.jpg
videoUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/4.+Timer+Settings.mp4
imageUrl: https://d1le8tk1c3nn33.cloudfront.net/videos/res/teaching/CN/4.png
image: {fileID: 6460932027056559218}
--- !u!114 &8317445454359637353
MonoBehaviour:

File diff suppressed because it is too large Load Diff

View File

@ -484,7 +484,7 @@ MonoBehaviour:
serverBaseUrls:
- https://nextreal.cn/photon-matrix-api
- https://api.photonmatrixlab.com
serverBaseUrl: https://nextreal.cn/photon-matrix-api
serverBaseUrl: https://api.photonmatrixlab.com
enableServerBackdoor: 1
backdoorTapCount: 15
backdoorTapInterval: 1

View File

@ -382,6 +382,12 @@ namespace Kill.UI.Components
if (currentFullImage == null) currentFullImage = fullImage;
if (isFullScreen)
{
// 视频未加载完成时提示,避免全屏操作无效(此时 renderTextures 也未就绪)
if (!videoPlayer.isPrepared || renderTextures == null || renderTextures.Count < 2)
{
ToastUI.Show("100332");
return;
}
#if UNITY_ANDROID
AndroidStatusBar.statusBarState = AndroidStatusBar.States.Hidden;
#endif

View File

@ -344,8 +344,10 @@ public class ConnectDevicePageCtrl : MonoBehaviour
private System.Collections.IEnumerator DelayedQueryRegistration()
{
yield return new WaitForSeconds(0.5f);
//OnQueryRegistrationClick();
OnRegisterDeviceClick();
// 抵消连接设备时的Loading点击设备/扫码时Show过后续由BandDevice自行管理Loading
LoadingUI.Hide();
// 连接成功后:先调用服务器绑定接口,绑定成功后再走蓝牙流程
BandDevice();
}
private void OnConnectFailed(string address)
@ -442,29 +444,128 @@ public class ConnectDevicePageCtrl : MonoBehaviour
}
/// <summary>
/// 查询设备注册状态
/// 服务器绑定成功后调用:未注册→蓝牙注册;已注册→查询设备端用户列表
/// </summary>
private void OnQueryRegistrationClick()
{
BLECommunicationManager.Instance.QueryRegistrationStatus((success,status) =>
{
Loom.QueueOnMainThread(() =>
{
if (success)
{
bool IsRegistered = status.IsRegistered;
if (IsRegistered)
if (status.IsRegistered)
{
errorTip = "100070";
ShowErrorPage();
// 已注册:查询设备端用户列表,挨个注销
OnQueryUserListClick();
}
else
{
// 未注册:蓝牙注册当前用户
OnRegisterDeviceClick();
}
}
else
{
LoadingUI.Hide();
errorTip = "100069";
ShowErrorPage();
}
});
});
}
/// <summary>
/// 查询设备端用户列表
/// 有用户挨个注销注销完注册当前用户无用户固件bug直接登录当前用户
/// </summary>
private void OnQueryUserListClick()
{
BLECommunicationManager.Instance.QueryUserList((userList) =>
{
Loom.QueueOnMainThread(() =>
{
if (userList.Status != 0)
{
LoadingUI.Hide();
errorTip = "100069";
ShowErrorPage();
return;
}
if (userList.UserCount > 0 && userList.Users != null && userList.Users.Length > 0)
{
// 打印用户列表,方便排查注销失败原因
StringBuilder sb = new StringBuilder();
sb.Append($"用户列表: UserCount={userList.UserCount}, Users.Length={userList.Users.Length}");
for (int i = 0; i < userList.Users.Length; i++)
{
var u = userList.Users[i];
sb.Append($" [{i}] Username={u.Username}, FingerprintId={u.FingerprintId}, HasFingerprint={u.HasFingerprint}");
}
Debug.Log(sb.ToString());
// 挨个注销设备端用户
UnregisterAllUsers(userList.Users, 0);
}
else
{
// 设备端已注册但用户列表为空固件bug直接登录当前用户
Debug.Log("设备已注册但用户列表为空,直接登录当前用户");
UserLoginAndContinue();
}
});
});
}
/// <summary>
/// 挨个注销设备端用户,全部注销完后注册当前用户
/// </summary>
private void UnregisterAllUsers(Kill.Bluetooth.Protocol.UserInfo[] users, int index)
{
if (index >= users.Length)
{
// 全部注销完成,注册当前用户
OnRegisterDeviceClick();
return;
}
string username = users[index].Username;
BLECommunicationManager.Instance.UnregisterUser(username, (response) =>
{
Loom.QueueOnMainThread(() =>
{
if (response.IsSuccess)
{
Debug.Log($"用户 {username} 注销成功");
}
else
{
// 注销失败不阻塞,继续注销下一个
Debug.LogWarning($"用户 {username} 注销失败, 状态码={response.Status:X2},继续注销下一个");
}
UnregisterAllUsers(users, index + 1);
});
});
}
/// <summary>
/// 登录当前用户并进入 WiFi 配置流程
/// </summary>
private void UserLoginAndContinue()
{
string username = DataManager.Instance.userInfo.id;
BLECommunicationManager.Instance.UserLogin(username, (response) =>
{
Loom.QueueOnMainThread(() =>
{
if (response.IsSuccess)
{
Debug.Log($"用户登录成功,继续设备配置流程: {username}");
LoadingUI.Hide();
ShowWifiPage();
}
else
{
Debug.LogError($"用户登录失败: {response.Status}");
LoadingUI.Hide();
errorTip = "100069";
ShowErrorPage();
}
@ -485,8 +586,8 @@ public class ConnectDevicePageCtrl : MonoBehaviour
if (success)
{
LoadingUI.Hide();
// 蓝牙注册成功后,再调用服务器绑定接口
BandDevice();
// 蓝牙注册成功后,进入 WiFi 配置流程(服务器绑定已在前面完成)
ShowWifiPage();
}
else
{
@ -513,8 +614,8 @@ public class ConnectDevicePageCtrl : MonoBehaviour
{
Debug.Log($"用户登录成功,继续设备配置流程: {username}");
LoadingUI.Hide();
// 登录成功后,再调用服务器绑定接口
BandDevice();
// 登录成功后,进入 WiFi 配置流程(服务器绑定已在前面完成)
ShowWifiPage();
}
else
{
@ -656,33 +757,16 @@ public class ConnectDevicePageCtrl : MonoBehaviour
/// <summary>
/// 注销用户
/// 返回主页
/// </summary>
private void OnUnregisterUserClick()
{
string username = DataManager.Instance.userInfo.id;
BLECommunicationManager.Instance.UnregisterUser(username, (response) =>
{
Loom.QueueOnMainThread(() =>
{
if (response.IsSuccess)
{
Debug.Log($"用户 {username} 注销成功!");
}
else
{
OnUnregisterUserClick();
}
});
});
}
public void BackToHomePage()
{
OnStopScanClick();
UIManager.Instance.OpenPage(UIManager.PageName.homePage, null, true);
}
/// <summary>
/// 绑定设备(服务器接口,在蓝牙注册/登录成功后调用)
/// 绑定设备(服务器接口,连接成功后调用)
/// 绑定失败:显示错误页提示失败原因;绑定成功:蓝牙查询设备注册状态
/// </summary>
public async void BandDevice()
{
@ -704,8 +788,10 @@ public class ConnectDevicePageCtrl : MonoBehaviour
onSuccess: (data) =>
{
Debug.Log($"绑定设备成功");
ShowWifiPage();
DataManager.Instance.SavaSelectedDeviceMac(nowDeviceMac);
// 服务器绑定成功后,蓝牙查询设备注册状态
LoadingUI.Show();
OnQueryRegistrationClick();
}
,
onError: (code,message) =>