43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package worldtask
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/modules"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
const (
|
|
WorldtaskSubtypeMine = "mine"
|
|
WorldtaskSubtypeAccept = "accept"
|
|
WorldtaskSubtypeFinish = "finish"
|
|
WorldtaskNexttaskPush = "nexttask"
|
|
WorldtaskBattleStart = "battlestart"
|
|
WorldtaskBattleFinish = "battlefinish"
|
|
WorldtaskComplete = "completecondi"
|
|
WorldtaskChapterReward = "chapterreward"
|
|
)
|
|
|
|
type apiComp struct {
|
|
modules.MCompGate
|
|
service base.IRPCXService
|
|
module *Worldtask
|
|
}
|
|
|
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
_ = this.MCompGate.Init(service, module, comp, options)
|
|
this.service = service.(base.IRPCXService)
|
|
this.module = module.(*Worldtask)
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) sendMsg(session comm.IUserSession, subType string, rsp proto.Message) {
|
|
if err := session.SendMsg(string(this.module.GetType()), subType, rsp); err != nil {
|
|
this.module.Error("Worldtask sendMsg err", log.Field{Key: "err", Value: err.Error()})
|
|
return
|
|
}
|
|
}
|