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 /core/src/data/game/runtime/structs.rs | |
| parent | c9dbba0d288becb7f05cebe526be25c76e5a850a (diff) | |
重构所有部分
Diffstat (limited to 'core/src/data/game/runtime/structs.rs')
| -rw-r--r-- | core/src/data/game/runtime/structs.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/src/data/game/runtime/structs.rs b/core/src/data/game/runtime/structs.rs new file mode 100644 index 0000000..bf68424 --- /dev/null +++ b/core/src/data/game/runtime/structs.rs @@ -0,0 +1,40 @@ +use std::collections::{HashMap, VecDeque}; +use std::sync::atomic::AtomicBool; +use crate::data::game::structs::GameControlData; +use crate::data::game::types::{GameInfo, Players}; +use crate::data::message::enums::{ControlMessage, GameMessage}; +use crate::data::player::structs::Account; +use crate::service::service_types::ServiceType; + +/// Game pad_client runtime +/// Stores the game state, player information, and all data involved in controller-side interactions during runtime +pub struct GameRuntime { + + pub info: GameInfo, + pub data: GameRuntimeData, + pub control: GameControlRuntime, + + pub writer_count: i32, + pub reader_count: i32, +} + +pub struct GameRuntimeData { + + pub(crate) received: HashMap<(ServiceType, Account), VecDeque<(Account, ControlMessage)>>, + pub(crate) send: HashMap<(ServiceType, Account), VecDeque<(Account, GameMessage)>>, + + pub(crate) players_online: Players, + pub(crate) players_banned: Players, + + pub locked: AtomicBool, + pub close: AtomicBool, +} + +#[derive(Default)] +pub struct GameControlRuntime { + pub(crate) keys: GameControlData, + pub(crate) directions : HashMap<u8, HashMap<Account, (f64, f64)>>, + pub(crate) axes : HashMap<u8, HashMap<Account, f64>>, + pub(crate) button : HashMap<u8, HashMap<Account, bool>>, + pub(crate) events : VecDeque<(Account, ControlMessage)> +}
\ No newline at end of file |
