diff --git a/gen/ppgo/text.go b/gen/ppgo/text.go index 1502eb2..2d6ceb9 100644 --- a/gen/ppgo/text.go +++ b/gen/ppgo/text.go @@ -123,23 +123,23 @@ func (self *{{.Name}}) Unmarshal(buffer *wire.Buffer, fieldIndex uint64, wt wire const RegTemplateText = `// Generated by github.com/davyxu/protoplus package {{.PackageName}} -import ( - "github.com/davyxu/cellnet" +import ( "github.com/davyxu/cellnet/codec" + "github.com/davyxu/cellnet/meta" "reflect" ) var ( - _ cellnet.MessageMeta - _ codec.CodecRecycler + _ cellmeta.Meta + _ cellcodec.CodecRecycler _ reflect.Kind ) func init() { {{range .Structs}} - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ - Codec: codec.MustGetCodec("{{StructCodec .}}"), + cellmeta.Register(&cellmeta.Meta{ + Codec: cellcodec.MustGetByName("{{StructCodec .}}"), Type: reflect.TypeOf((*{{.Name}})(nil)).Elem(), ID: {{StructMsgID .}}, New: func() interface{} { return &{{.Name}}{} }, diff --git a/tests/reg_gen.go b/tests/reg_gen.go index c0c47a6..bb39098 100644 --- a/tests/reg_gen.go +++ b/tests/reg_gen.go @@ -8,38 +8,38 @@ import ( ) var ( - _ cellnet.MessageMeta + _ cellmeta.Meta _ codec.CodecRecycler _ reflect.Kind ) func init() { - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ + cellnet.RegisterMessageMeta(&cellmeta.Meta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*MyTypeMini)(nil)).Elem(), ID: 0, New: func() interface{} { return &MyTypeMini{} }, }) - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ + cellnet.RegisterMessageMeta(&cellmeta.Meta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*MySubType)(nil)).Elem(), ID: 0, New: func() interface{} { return &MySubType{} }, }) - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ + cellnet.RegisterMessageMeta(&cellmeta.Meta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*MyType)(nil)).Elem(), ID: 0, New: func() interface{} { return &MyType{} }, }) - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ + cellnet.RegisterMessageMeta(&cellmeta.Meta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*LoginREQ)(nil)).Elem(), ID: 17076, New: func() interface{} { return &LoginREQ{} }, }) - cellnet.RegisterMessageMeta(&cellnet.MessageMeta{ + cellnet.RegisterMessageMeta(&cellmeta.Meta{ Codec: codec.MustGetCodec("protoplus"), Type: reflect.TypeOf((*LoginACK)(nil)).Elem(), ID: 44443,