diff options
| author | 1992414357@qq.com <1992414357@qq.com> | 2025-06-09 01:44:36 +0800 |
|---|---|---|
| committer | 1992414357@qq.com <1992414357@qq.com> | 2025-06-09 01:44:36 +0800 |
| commit | 49192dbb98e0ab1f2a66b4786fac86d63f69be64 (patch) | |
| tree | 7cdf27c7cab5fb6b1aabc2ac7c44b7b492558945 /client/src/plugin_client.rs | |
| parent | c9dbba0d288becb7f05cebe526be25c76e5a850a (diff) | |
重构所有部分
Diffstat (limited to 'client/src/plugin_client.rs')
| -rw-r--r-- | client/src/plugin_client.rs | 66 |
1 files changed, 66 insertions, 0 deletions
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<PadClient>, +// } + +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<TokioTasksRuntime> +// ) { +// 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 |
