go_dreamfactory/modules/viking/api.go
2023-07-06 18:02:48 +08:00

58 lines
1.3 KiB
Go

package viking
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
VikingGetListResp = "getlist"
VikingChallengeResp = "challenge"
VikingChallengeOverResp = "challengeover"
VikingSkillLvResp = "skilllv"
VikingGetRewardResp = "getreward"
VikingBuyResp = "buy"
VikingRankListResp = "ranklist"
VikingSeasonRankReq = "seasonrank"
)
type apiComp struct {
modules.MCompGate
service core.IService
configure *configureComp
module *Viking
friend comm.IFriend
chat comm.IChat
equip comm.IEquipment
}
//组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompGate.Init(service, module, comp, options)
this.module = module.(*Viking)
this.service = service
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleFriend); err != nil {
return
}
this.friend = module.(comm.IFriend)
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
return
}
this.chat = module.(comm.IChat)
if module, err = this.service.GetModule(comm.ModuleEquipment); err != nil {
return
}
this.equip = module.(comm.IEquipment)
return
}