feat(control): 添加选手 FPS 键鼠操作与 C3 用户 UART 输出
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s

This commit is contained in:
sloray committed 2026-10-31 18:34:30 +08:00
1 parent aea1cf60ae
commit 38410bacd4
43 files changed
+2389 -77

No files matched your search

+18 -5
View File
@@ -23,14 +23,14 @@
mod commands;
mod demo;
mod version;
mod firmware_build;
mod latency;
mod maintenance;
mod firmware_build;
mod recording;
mod server;
mod state;
mod startup;
mod state;
mod version;
use std::error::Error;
use std::path::PathBuf;
@@ -329,6 +329,8 @@ fn run() -> Result<(), Box<dyn Error>> {
commands::stream_info,
commands::get_snapshot,
commands::match_action,
commands::operator_start,
commands::operator_input,
commands::release_match_source,
commands::get_config,
commands::list_media_files,
@@ -372,7 +374,11 @@ fn run() -> Result<(), Box<dyn Error>> {
// 解锁框。拦不住的路径仍然存在——`kill -9`、强退、拔电源——所以它同样是"防
// 随手误操作",不是安全边界。
.on_window_event(|window, event| {
if let WindowEvent::Focused(focused) = event {
window.state::<Arc<AppState>>().operator_focus(*focused);
}
if let WindowEvent::CloseRequested { api, .. } = event {
window.state::<Arc<AppState>>().stop_operator("窗口正在关闭,操作已停止");
if window.state::<Arc<maintenance::MaintenanceState>>().is_busy() {
api.prevent_close();
let _ = window.emit("maintenance-close-blocked", "固件维护正在进行,请等待完成;编译可先取消。请勿在写入或恢复期间关闭客户端。");
@@ -391,15 +397,22 @@ fn run() -> Result<(), Box<dyn Error>> {
app.run(|app, event| {
if let RunEvent::ExitRequested { api, .. } = &event {
app.state::<Arc<AppState>>()
.stop_operator("正在退出,操作已停止");
if app.state::<Arc<maintenance::MaintenanceState>>().is_busy() {
api.prevent_exit();
let _ = app.emit("maintenance-close-blocked", "固件维护正在进行,请等待完成后退出。");
let _ = app.emit(
"maintenance-close-blocked",
"固件维护正在进行,请等待完成后退出。",
);
return;
}
let state = app.state::<Arc<AppState>>();
if app.state::<startup::StartupState>().finished()
&& state.config().role.needs_password() && !state.is_unlocked() {
&& state.config().role.needs_password()
&& !state.is_unlocked()
{
api.prevent_exit();
state.push(server::WireMsg::ConfirmQuit);
return;