package dragon import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" ) func NewModule() core.IModule { m := new(Dragon) return m } type Dragon struct { modules.ModuleBase service core.IService api *apiComp configure *configureComp modelDragon *ModelDragon } // 模块名 func (this *Dragon) GetType() core.M_Modules { return comm.ModuleHero } // 模块初始化接口 注册用户创建角色事件 func (this *Dragon) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service return } // 装备组件 func (this *Dragon) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelDragon = this.RegisterComp(new(ModelDragon)).(*ModelDragon) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } func (this *Dragon) Start() (err error) { err = this.ModuleBase.Start() return } // 获取坐骑列表 func (this *Dragon) GetDragonList(uid string) (list []*pb.DBDragon, err error) { return this.modelDragon.GetDragonList(uid) } // 创建坐骑 func (this *Dragon) CreateDragon(session comm.IUserSession, dragons map[string]int32, bPush bool) (errdata *pb.ErrorData) { return this.modelDragon.CreateDragon(session, dragons) }