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 --- core/src/data/controller/implements.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core/src/data/controller/implements.rs (limited to 'core/src/data/controller/implements.rs') 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> { + let runtime = ControllerRuntime { + player: self.player, + ..Default::default() + }; + Arc::new(Mutex::new(runtime)) + } +} \ No newline at end of file -- cgit