This commit is contained in:
azw 2023-11-01 13:59:13 +00:00
parent cc60d5f801
commit aaa22350f4
2 changed files with 16 additions and 2 deletions

View File

@ -30,7 +30,7 @@ pub struct PlayerNetHandler {
impl cs_auto::MsgHandler for PlayerNetHandler {
fn CMPing(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMPing>>) {
fn cm_ping(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs_proto::CMPing>>) {
panic!("not implement");
}

View File

@ -103,9 +103,10 @@ pub trait MsgHandler {`;
(item) => {
if (item.name[0] == 'C' &&
item.name[1] == 'M') {
const finalyName = this.converLowCaseName(item.name);
data += `
fn ${item.name}(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::${item.name}>>) {
fn ${finalyName}(&self, _: &f9::MsgHdr, _: Rc::<RefCell::<cs::${item.name}>>) {
panic!("not implement");
}`;
}
@ -368,6 +369,19 @@ func (this *${item.name}) LoadFromKv(kv map[string]interface{}) {
return newName;
}
converLowCaseName(name) {
let newName = 'cm';
let preIs_ = false;
for (let i = 2; i < name.length; ++i) {
if (name[i].charCodeAt(0) >= 65 && name[i].charCodeAt(0) <= 90) {
newName += '_' + name[i].toLowerCase();
} else {
newName += name[i];
}
}
return newName;
}
}
(new PBTools).init();