go_dreamfactory/modules/hero/api.go
2024-01-03 11:06:35 +08:00

66 lines
2.3 KiB
Go

package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"time"
)
type apiComp struct {
//cbase.ModuleCompBase
modules.MCompGate
service core.IService
module *Hero
chat comm.IChat
}
type DBHeroDrawCardRecord struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
HeroId []string `protobuf:"bytes,3,rep,name=heroId,proto3" json:"heroId"` // 英雄ID
Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"`
ExpireAt time.Time `bson:"expireAt,omitempty"`
}
const ( //消息回复的头名称
StrengthenUplv = "strengthenuplv"
HeroSubTypeInfo = "info" //英雄卡片信息
HeroSubTypeList = "list" //英雄列表
HeroSubTypeChouka = "chouka" //抽卡
ResonanceUseEnergy = "resonanceuseenergy" // 使用共鸣能量
Resonance = "resonance" // 英雄共鸣属性
ResonanceReset = "resonancereset" // 共鸣重置
StrengthenUpSkill = "strengthenupskill" // 技能强化
StrengthenUpStar = "strengthenupstar" // 英雄升星
Awaken = "awaken" // 英雄觉醒
HeroLock = "lock" // 英雄锁定
DrawCard = "drawcard" // 抽卡
DrawCardFloor = "drawcardfloor" // 抽卡保底
HeroFusionResp = "fusion"
HeroTalentLearnResp = "talentlearn" // 天赋学习
HeroTalentListResp = "talentlist" // 天赋列表
HeroTalentResetResp = "talentreset" // 天赋重置
HeroPeachRewardReq = "peachreward" // 圣桃树领奖
HeroAppointHeroResp = "appointhero" //
)
//组件初始化接口
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.(*Hero)
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.ModuleChat); err != nil {
return
}
this.chat = module.(comm.IChat)
return
}