定义用户创建角色事件

This commit is contained in:
liwei1dao 2022-06-08 15:53:58 +08:00
parent dfd3d6a292
commit acf4969646
2 changed files with 19 additions and 1 deletions

View File

@ -35,6 +35,7 @@ const ( //Rpc
const (
Event_UserLogin core.Event_Key = "Event_UserLogin" //登录事件
Event_CreateUser core.Event_Key = "Event_CreateUser" //创建角色事件
)
type ISC_GateRouteComp interface {

View File

@ -3,8 +3,11 @@ package pack
import (
"go_dreamfactory/comm"
"go_dreamfactory/modules"
"go_dreamfactory/sys/db"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
)
/*
@ -27,8 +30,22 @@ func (this *Pack) GetType() core.M_Modules {
return comm.SM_PackModule
}
func (this *Pack) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
event.RegisterGO(comm.Event_CreateUser, this.event_CreateUser)
return
}
func (this *Pack) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
}
//Evens--------------------------------------------------------------------------------------------------------------------------------
//接收玩家创建角色事件
func (this *Pack) event_CreateUser(uid string) {
if _, err := db.Defsys.Pack_InitUserPack(uid); err != nil {
log.Errorf("event_CreateUser err:%v", err)
}
}