修复配置加载

This commit is contained in:
zhaocy 2022-06-30 16:27:35 +08:00
parent 810aec88cc
commit 08d12b0f36
5 changed files with 18 additions and 6 deletions

View File

@ -22,7 +22,7 @@ type MCompConfigure struct {
//组件初始化接口 //组件初始化接口
func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, options) err = this.ModuleCompBase.Init(service, module, comp, options)
this.S = service.(base.IRPCXService) this.S = service.(base.IRPCXService)
this.M = module.(IModule) this.M = module.(IModule)
err = this.LoadConfigure(game_global, cfg.NewGame_global) err = this.LoadConfigure(game_global, cfg.NewGame_global)

View File

@ -31,7 +31,7 @@ func (this *apiComp) Create(session comm.IUserSession, result map[string]interfa
if self, ok := result["self"]; ok { if self, ok := result["self"]; ok {
v := self.(*pb.DBUser) v := self.(*pb.DBUser)
if v.Name != "" { if v.Created {
code = pb.ErrorCode_RoleCreated code = pb.ErrorCode_RoleCreated
return return
} }
@ -39,6 +39,7 @@ func (this *apiComp) Create(session comm.IUserSession, result map[string]interfa
update := map[string]interface{}{ update := map[string]interface{}{
"name": req.NickName, "name": req.NickName,
"created": true,
} }
//设置初始金币 //设置初始金币

View File

@ -11,6 +11,6 @@ type configureComp struct {
//组件初始化接口 //组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options) err = this.ModuleCompBase.Init(service, module, comp, options)
return return
} }

View File

@ -23,4 +23,5 @@ message DBUser {
int32 avatar = 12; //@go_tags(`bson:"avatar"`) int32 avatar = 12; //@go_tags(`bson:"avatar"`)
int32 gold = 13; //@go_tags(`bson:"gold"`) int32 gold = 13; //@go_tags(`bson:"gold"`)
int32 exp = 14; //@go_tags(`bson:"exp"`) int32 exp = 14; //@go_tags(`bson:"exp"`)
bool created = 15; //@go_tags(`bson:"created"`)
} }

View File

@ -102,6 +102,7 @@ type DBUser struct {
Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像 Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像
Gold int32 `protobuf:"varint,13,opt,name=gold,proto3" json:"gold" bson:"gold"` //金币 Gold int32 `protobuf:"varint,13,opt,name=gold,proto3" json:"gold" bson:"gold"` //金币
Exp int32 `protobuf:"varint,14,opt,name=exp,proto3" json:"exp" bson:"exp"` //经验 Exp int32 `protobuf:"varint,14,opt,name=exp,proto3" json:"exp" bson:"exp"` //经验
Created bool `protobuf:"varint,15,opt,name=created,proto3" json:"created" bson:"created"` //创角
} }
func (x *DBUser) Reset() { func (x *DBUser) Reset() {
@ -234,6 +235,13 @@ func (x *DBUser) GetExp() int32 {
return 0 return 0
} }
func (x *DBUser) GetCreated() bool {
if x != nil {
return x.Created
}
return false
}
var File_user_user_db_proto protoreflect.FileDescriptor var File_user_user_db_proto protoreflect.FileDescriptor
var file_user_user_db_proto_rawDesc = []byte{ var file_user_user_db_proto_rawDesc = []byte{
@ -244,7 +252,7 @@ var file_user_user_db_proto_rawDesc = []byte{
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74,
0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xd0, 0x02, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0xea, 0x02,
0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75,
@ -266,7 +274,9 @@ var file_user_user_db_proto_rawDesc = []byte{
0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6f, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x6f,
0x6c, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x6f, 0x6c, 0x64, 0x12, 0x10, 0x6c, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x67, 0x6f, 0x6c, 0x64, 0x12, 0x10,
0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28,
0x08, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (