Skip to content

Commit

Permalink
update bevy
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuminglilith committed Dec 10, 2024
1 parent de1e170 commit ec0cc82
Show file tree
Hide file tree
Showing 19 changed files with 4,466 additions and 2,573 deletions.
2,289 changes: 1,502 additions & 787 deletions client/Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ serde = "1.0.163"
serde_json = "1.0.96"
tracing = "0.1.37"
uuid = "1.3.3"
async-channel = "2.3.1"
tokio = { version = "1.41.1", features = ["full"] }
pyo3 = { version = "0.20.3", features = ["extension-module"] }
pyo3 = { version = "0.23.3", features = ["extension-module"] }
client = { path = "./lib/client", version = "0.1.0" }

[lib]
Expand Down
4 changes: 2 additions & 2 deletions client/lib/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.14.2"
bevy = "0.15.0"
thrift = "0.17.0"
async-trait = "0.1.68"
tokio = { version = "1.41.1", features = ["full"] }
pyo3 = { version = "0.20.3", features = ["extension-module"] }
pyo3 = { version = "0.23.3", features = ["extension-module"] }
net = { path = "../../../crates/net", version = "0.1.0" }
wss = { path = "../../../crates/wss", version = "0.1.0" }
tcp = { path = "../../../crates/tcp", version = "0.1.0" }
Expand Down
5 changes: 2 additions & 3 deletions client/lib/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ impl ClientPump {
})
}

pub fn poll_conn_msg<'a>(slf: PyRefMut<'a, Self>, py_handle: &'a PyAny) -> bool {
pub fn poll_conn_msg<'a>(slf: PyRefMut<'a, Self>, py_handle: Py<PyAny>) -> bool {
let py = slf.py();
let _py_handle = py_handle.into_py(py);
GateMsgHandle::poll(slf.msg_handle.clone(), py, _py_handle)
GateMsgHandle::poll(slf.msg_handle.clone(), py, py_handle)
}
}
2 changes: 1 addition & 1 deletion client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use pyo3::prelude::*;
use client::{ClientContext, ClientPump};

#[pymodule]
pub fn pyclient(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
pub fn pyclient(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<ClientContext>()?;
m.add_class::<ClientPump>()?;
Ok(())
Expand Down
33 changes: 20 additions & 13 deletions crates/time/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
use std::sync::atomic::{AtomicI64, Ordering};
use chrono::prelude::*;

pub fn utc_unix_time() -> i64 {
let utc: DateTime<Utc> = Utc::now();
utc.timestamp_millis()
pub struct OffsetTime {
off_set: AtomicI64
}

static mut OFFSET: AtomicI64 = AtomicI64::new(0);
impl OffsetTime {
pub fn new() -> OffsetTime {
OffsetTime {
off_set: AtomicI64::new(0)
}
}

pub fn set_time_offset(offset: i64) {
unsafe {
OFFSET.store(offset, Ordering::SeqCst)
fn utc_unix_time(&self) -> i64 {
let utc: DateTime<Utc> = Utc::now();
utc.timestamp_millis()
}

pub fn set_time_offset(&mut self, offset: i64) {
self.off_set.store(offset, Ordering::SeqCst)
}
}

pub fn utc_unix_time_with_offset() -> i64 {
unsafe {
let offset = OFFSET.load(Ordering::SeqCst);
utc_unix_time() + offset
pub fn utc_unix_time_with_offset(&self) -> i64 {
let offset = self.off_set.load(Ordering::SeqCst);
self.utc_unix_time() + offset
}
}
}

Loading

0 comments on commit ec0cc82

Please sign in to comment.