diff --git a/server/notifyserver/build.rs b/server/notifyserver/build.rs index a0ff496..f476603 100644 --- a/server/notifyserver/build.rs +++ b/server/notifyserver/build.rs @@ -1,7 +1,7 @@ fn main() { protobuf_codegen_pure::Codegen::new() - .out_dir("src") - .inputs(&["proto/mt.proto", + .out_dir("src/cs") + .inputs(&[//"proto/mt.proto", "proto/cs_msgid.proto", "proto/cs_proto.proto"]) .include("proto") diff --git a/server/notifyserver/src/main.rs b/server/notifyserver/src/main.rs index 3ddf699..1ec4ac1 100755 --- a/server/notifyserver/src/main.rs +++ b/server/notifyserver/src/main.rs @@ -11,24 +11,21 @@ use r9_macro_derive::SharedFromSelf; use r9_macro_derive::Singleton; pub mod app; -pub mod mt; -pub mod cs_msgid; -pub mod cs_proto; -//pub mod cs_auto_gen; +pub mod cs; //pub mod mtb; pub trait MsgHandler { - +/* fn cm_join(_: &f9::MsgHdr, _: Rc::>) { } - fn cm_move(_: &f9::MsgHdr, _: Rc::>) { + fn cm_move(&self, _: &f9::MsgHdr, _: Rc::>) { } fn cm_emote(_: &f9::MsgHdr, _: Rc::>) { } - +*/ } #[derive(SharedFromSelf)] @@ -48,11 +45,12 @@ impl MsgHandler for PlayerNetHandler { impl PlayerNetHandler { + /* pub fn cm_move(hdr: &f9::MsgHdr, msg: Rc::>) { println!("seq:{}", msg.borrow().get_seq()); } - +*/ } #[derive(SharedFromSelf)] @@ -88,12 +86,13 @@ impl Player { return self.nick_name.clone(); } + /* pub fn cm_move(self_p :&Rc::>, hdr: &f9::MsgHdr, msg: Rc::>) { println!("seq:{}", msg.borrow().get_seq()); } - +*/ } impl PlayerMgr { @@ -145,6 +144,7 @@ fn main() { println!("account_id:{} name:{}", hum.as_ref().unwrap().borrow().get_account_id(), hum.as_ref().unwrap().borrow().get_nick_name()); + /* let msg = Rc::new(RefCell::new(cs_proto::CMMove::new())); msg.borrow_mut().set_seq(100); let msg_hdr = f9::MsgHdr { @@ -157,7 +157,7 @@ fn main() { &hum.unwrap(), &msg_hdr, msg - ) + )*/ } App::instance().borrow_mut().init( crate::app::app::UserApp::instance() diff --git a/server/notifyserver/tools/pbtools/app.js b/server/notifyserver/tools/pbtools/app.js index 290b76d..534940f 100644 --- a/server/notifyserver/tools/pbtools/app.js +++ b/server/notifyserver/tools/pbtools/app.js @@ -68,6 +68,7 @@ class PBTools { let data = `use std::rc::{Rc, Weak}; use std::cell::RefCell; +use crate::cs::cs_proto as cs; //static mut handlers [2000]Option @@ -104,7 +105,7 @@ pub trait MsgHandler {`; item.name[1] == 'M') { data += ` - ${item.name}(&self, _: &f9.MsgHdr, _: Rc::>) { + fn ${item.name}(&self, _: &f9::MsgHdr, _: Rc::>) { panic!("not implement"); }`; } @@ -112,6 +113,7 @@ pub trait MsgHandler {`; data += ` } `; + /* data += ` func init() { `; @@ -135,7 +137,7 @@ func init() { } }); data += ` -}`; +}`;*/ fs.writeFileSync('./src/cs/cs_auto_gen.rs', data); }