feat(control): 添加选手 FPS 键鼠操作与 C3 用户 UART 输出
This commit is contained in:
43 files changed
+2389
-77
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user