星座图红点需求开发
This commit is contained in:
parent
040b9f668d
commit
67f57d95ea
@ -69,7 +69,7 @@ func (this *configureComp) getHeroConfig(id string) (result *cfg.GameHeroData, e
|
|||||||
v interface{}
|
v interface{}
|
||||||
ok bool
|
ok bool
|
||||||
)
|
)
|
||||||
if v, err = this.GetConfigure(game_horoscope); err != nil {
|
if v, err = this.GetConfigure(game_hero); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
if result, ok = v.(*cfg.GameHero).GetDataMap()[id]; !ok {
|
if result, ok = v.(*cfg.GameHero).GetDataMap()[id]; !ok {
|
||||||
@ -79,3 +79,20 @@ func (this *configureComp) getHeroConfig(id string) (result *cfg.GameHeroData, e
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询下一个节点
|
||||||
|
func (this *configureComp) getHoroscopes() (result *cfg.GameHoroscope, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_horoscope); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
} else {
|
||||||
|
if result, ok = v.(*cfg.GameHoroscope); !ok {
|
||||||
|
err = fmt.Errorf("on found game_horoscope 类型异常")
|
||||||
|
this.module.Errorln(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -139,3 +139,29 @@ func (this *modelHoroscope) compute(info *pb.DBHoroscope, hero *pb.DBHero) (err
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *modelHoroscope) reddot(session comm.IUserSession) bool {
|
||||||
|
var (
|
||||||
|
info *pb.DBHoroscope
|
||||||
|
horoscope *cfg.GameHoroscope
|
||||||
|
code pb.ErrorCode
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if info, err = this.queryInfo(session.GetUserId()); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if horoscope, err = this.module.configure.getHoroscopes(); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range horoscope.GetDataList() {
|
||||||
|
|
||||||
|
if lv, ok := info.Nodes[v.NodeId]; !ok && v.Lv > lv {
|
||||||
|
|
||||||
|
if code = this.module.CheckRes(session, v.CostItem); code == pb.ErrorCode_Success {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -59,11 +59,14 @@ func (this *Horoscope) ComputeHeroNumeric(uid string, hero ...*pb.DBHero) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//红点需求
|
//红点需求
|
||||||
func (this *Horoscope) Reddot(uid string, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) {
|
func (this *Horoscope) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) {
|
||||||
result = make(map[comm.ReddotType]bool)
|
result = make(map[comm.ReddotType]bool)
|
||||||
for _, v := range rid {
|
for _, v := range rid {
|
||||||
switch v {
|
switch v {
|
||||||
case comm.Reddot17:
|
case comm.Reddot17:
|
||||||
|
if isredot := this.modelHoroscope.reddot(session); isredot {
|
||||||
|
result[comm.Reddot17] = true
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,12 +40,13 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code
|
|||||||
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) {
|
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) {
|
||||||
reddot[int32(k)] = v
|
reddot[int32(k)] = v
|
||||||
}
|
}
|
||||||
|
case int32(comm.Reddot17):
|
||||||
|
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) {
|
||||||
|
reddot[int32(k)] = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// for k, v := range this.module.martialhall.Reddot(session.GetUserId(), comm.Reddot1) {
|
|
||||||
// reddot[int32(k)] = v
|
|
||||||
// }
|
|
||||||
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
|
session.SendMsg(string(this.module.GetType()), "get", &pb.ReddotGetAllResp{Reddot: reddot})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
|
|||||||
for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) {
|
for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) {
|
||||||
reddot[int32(k)] = v
|
reddot[int32(k)] = v
|
||||||
}
|
}
|
||||||
|
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) {
|
||||||
|
reddot[int32(k)] = v
|
||||||
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot})
|
session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ type Reddot struct {
|
|||||||
mainline comm.IMainline
|
mainline comm.IMainline
|
||||||
pagoda comm.IPagoda
|
pagoda comm.IPagoda
|
||||||
martialhall comm.IMartialhall
|
martialhall comm.IMartialhall
|
||||||
|
horoscope comm.IHoroscope
|
||||||
api_comp *apiComp
|
api_comp *apiComp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,10 @@ func (this *Reddot) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.martialhall = module.(comm.IMartialhall)
|
this.martialhall = module.(comm.IMartialhall)
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleHoroscope); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.horoscope = module.(comm.IHoroscope)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user