From 49192dbb98e0ab1f2a66b4786fac86d63f69be64 Mon Sep 17 00:00:00 2001 From: "1992414357@qq.com" <1992414357@qq.com> Date: Mon, 9 Jun 2025 01:44:36 +0800 Subject: 重构所有部分 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/plugin_client.rs | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 client/src/plugin_client.rs (limited to 'client/src/plugin_client.rs') diff --git a/client/src/plugin_client.rs b/client/src/plugin_client.rs new file mode 100644 index 0000000..2449f3a --- /dev/null +++ b/client/src/plugin_client.rs @@ -0,0 +1,66 @@ + + +// #[derive(Component)] +// struct ClientComponent { +// pad_client: Arc, +// } + +use bevy::prelude::{App, Plugin}; + +pub struct PadClientPlugin; +impl Plugin for PadClientPlugin { + fn build(&self, app: &mut App) { + // app.add_systems(PreStartup, client_init); + // app.add_systems(Startup, client_start); + // app.add_systems(Update, client_exit.run_if(input_just_pressed(KeyCode::Escape))); + } +} +// +// fn client_init( +// mut commands: Commands +// ) { +// // 构建玩家信息 +// let mut player_info = PlayerInfo::new(); +// player_info.setup_account_info( +// env!("TEST_PLAYER_ACCOUNT"), +// env!("TEST_PLAYER_PASSWORD")); +// player_info.set_nickname(env!("TEST_PLAYER_NICKNAME")); +// player_info.set_customize_color_hsv(320, 0.5, 1.0); // PINK +// +// // 构建客户端 +// let mut pad_client = PadClient::default(); +// pad_client.bind_player(player_info); +// pad_client.quiet(); +// +// // 将客户端放入实体 +// commands.spawn( +// ClientComponent { +// pad_client: pad_client.build(), +// } +// ); +// } +// +// fn client_start( +// client_components: Query<&mut ClientComponent>, +// runtime: ResMut +// ) { +// for client_component in client_components.iter() { +// let pad_client = Arc::clone(&client_component.pad_client); +// +// // 启动服务器 +// runtime.spawn_background_task(|_ctx|async move { +// let entry = pad_client.get_connect_entry(); +// block_on(entry); +// info!("Finished"); +// }); +// } +// } +// +// fn client_exit( +// client_components: Query<&mut ClientComponent> +// ){ +// for client_component in client_components.iter() { +// let pad_client = Arc::clone(&client_component.pad_client); +// pad_client.request_disconnect(); +// } +// } \ No newline at end of file -- cgit