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/controller/implements.rs | |
| parent | c9dbba0d288becb7f05cebe526be25c76e5a850a (diff) | |
重构所有部分
Diffstat (limited to 'core/src/data/controller/implements.rs')
| -rw-r--r-- | core/src/data/controller/implements.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/data/controller/implements.rs b/core/src/data/controller/implements.rs new file mode 100644 index 0000000..86a19de --- /dev/null +++ b/core/src/data/controller/implements.rs @@ -0,0 +1,21 @@ +use std::sync::{Arc, Mutex}; +use crate::data::controller::runtime::structs::ControllerRuntime; +use crate::data::controller::structs::ControllerData; +use crate::data::player::structs::Player; + +impl ControllerData { + + pub fn bind_player(&mut self, player: Player) -> &mut ControllerData { + self.player = player; + self + } + + /// Build the controller-side runtime using controller data + pub fn runtime(self) -> Arc<Mutex<ControllerRuntime>> { + let runtime = ControllerRuntime { + player: self.player, + ..Default::default() + }; + Arc::new(Mutex::new(runtime)) + } +}
\ No newline at end of file |
