1
This commit is contained in:
parent
e698f97dbe
commit
91ea484067
@ -1,7 +1,7 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
protobuf_codegen_pure::Codegen::new()
|
protobuf_codegen_pure::Codegen::new()
|
||||||
.out_dir("src")
|
.out_dir("src/cs")
|
||||||
.inputs(&["proto/mt.proto",
|
.inputs(&[//"proto/mt.proto",
|
||||||
"proto/cs_msgid.proto",
|
"proto/cs_msgid.proto",
|
||||||
"proto/cs_proto.proto"])
|
"proto/cs_proto.proto"])
|
||||||
.include("proto")
|
.include("proto")
|
||||||
|
@ -11,24 +11,21 @@ use r9_macro_derive::SharedFromSelf;
|
|||||||
use r9_macro_derive::Singleton;
|
use r9_macro_derive::Singleton;
|
||||||
|
|
||||||
pub mod app;
|
pub mod app;
|
||||||
pub mod mt;
|
pub mod cs;
|
||||||
pub mod cs_msgid;
|
|
||||||
pub mod cs_proto;
|
|
||||||
//pub mod cs_auto_gen;
|
|
||||||
//pub mod mtb;
|
//pub mod mtb;
|
||||||
|
|
||||||
pub trait MsgHandler {
|
pub trait MsgHandler {
|
||||||
|
/*
|
||||||
fn cm_join(_: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMJoin>>) {
|
fn cm_join(_: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMJoin>>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cm_move(_: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMMove>>) {
|
fn cm_move(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMMove>>) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cm_emote(_: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMEmote>>) {
|
fn cm_emote(_: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMEmote>>) {
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(SharedFromSelf)]
|
#[derive(SharedFromSelf)]
|
||||||
@ -48,11 +45,12 @@ impl MsgHandler for PlayerNetHandler {
|
|||||||
|
|
||||||
impl PlayerNetHandler {
|
impl PlayerNetHandler {
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn cm_move(hdr: &f9::MsgHdr,
|
pub fn cm_move(hdr: &f9::MsgHdr,
|
||||||
msg: Rc::<RefCell::<cs_proto::CMMove>>) {
|
msg: Rc::<RefCell::<cs_proto::CMMove>>) {
|
||||||
println!("seq:{}", msg.borrow().get_seq());
|
println!("seq:{}", msg.borrow().get_seq());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(SharedFromSelf)]
|
#[derive(SharedFromSelf)]
|
||||||
@ -88,12 +86,13 @@ impl Player {
|
|||||||
return self.nick_name.clone();
|
return self.nick_name.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn cm_move(self_p :&Rc::<RefCell<Player>>,
|
pub fn cm_move(self_p :&Rc::<RefCell<Player>>,
|
||||||
hdr: &f9::MsgHdr,
|
hdr: &f9::MsgHdr,
|
||||||
msg: Rc::<RefCell::<cs_proto::CMMove>>) {
|
msg: Rc::<RefCell::<cs_proto::CMMove>>) {
|
||||||
println!("seq:{}", msg.borrow().get_seq());
|
println!("seq:{}", msg.borrow().get_seq());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlayerMgr {
|
impl PlayerMgr {
|
||||||
@ -145,6 +144,7 @@ fn main() {
|
|||||||
println!("account_id:{} name:{}",
|
println!("account_id:{} name:{}",
|
||||||
hum.as_ref().unwrap().borrow().get_account_id(),
|
hum.as_ref().unwrap().borrow().get_account_id(),
|
||||||
hum.as_ref().unwrap().borrow().get_nick_name());
|
hum.as_ref().unwrap().borrow().get_nick_name());
|
||||||
|
/*
|
||||||
let msg = Rc::new(RefCell::new(cs_proto::CMMove::new()));
|
let msg = Rc::new(RefCell::new(cs_proto::CMMove::new()));
|
||||||
msg.borrow_mut().set_seq(100);
|
msg.borrow_mut().set_seq(100);
|
||||||
let msg_hdr = f9::MsgHdr {
|
let msg_hdr = f9::MsgHdr {
|
||||||
@ -157,7 +157,7 @@ fn main() {
|
|||||||
&hum.unwrap(),
|
&hum.unwrap(),
|
||||||
&msg_hdr,
|
&msg_hdr,
|
||||||
msg
|
msg
|
||||||
)
|
)*/
|
||||||
}
|
}
|
||||||
App::instance().borrow_mut().init(
|
App::instance().borrow_mut().init(
|
||||||
crate::app::app::UserApp::instance()
|
crate::app::app::UserApp::instance()
|
||||||
|
@ -68,6 +68,7 @@ class PBTools {
|
|||||||
let data =
|
let data =
|
||||||
`use std::rc::{Rc, Weak};
|
`use std::rc::{Rc, Weak};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use crate::cs::cs_proto as cs;
|
||||||
|
|
||||||
//static mut handlers [2000]Option<CsNetMsgHandler>
|
//static mut handlers [2000]Option<CsNetMsgHandler>
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ pub trait MsgHandler {`;
|
|||||||
item.name[1] == 'M') {
|
item.name[1] == 'M') {
|
||||||
data += `
|
data += `
|
||||||
|
|
||||||
${item.name}(&self, _: &f9.MsgHdr, _: Rc::<RefCell::${item.name}>>) {
|
fn ${item.name}(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::${item.name}>>) {
|
||||||
panic!("not implement");
|
panic!("not implement");
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
@ -112,6 +113,7 @@ pub trait MsgHandler {`;
|
|||||||
data += `
|
data += `
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
/*
|
||||||
data += `
|
data += `
|
||||||
func init() {
|
func init() {
|
||||||
`;
|
`;
|
||||||
@ -135,7 +137,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
data += `
|
data += `
|
||||||
}`;
|
}`;*/
|
||||||
fs.writeFileSync('./src/cs/cs_auto_gen.rs', data);
|
fs.writeFileSync('./src/cs/cs_auto_gen.rs', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user