This commit is contained in:
meixiongfeng 2023-10-27 20:07:02 +08:00
parent 90d05da98f
commit db89a8b32e
2 changed files with 29 additions and 39 deletions

View File

@ -41,6 +41,7 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.EntertainRewardRe
Code: pb.ErrorCode_UserRepeadReward, Code: pb.ErrorCode_UserRepeadReward,
Title: pb.ErrorCode_UserRepeadReward.ToString(), Title: pb.ErrorCode_UserRepeadReward.ToString(),
} }
return
} }
if _, ok := list.Reward[conf.Key]; !ok { if _, ok := list.Reward[conf.Key]; !ok {
if errdata, atno = this.module.DispenseAtno(session, conf.Rewards, true); errdata != nil { if errdata, atno = this.module.DispenseAtno(session, conf.Rewards, true); errdata != nil {

View File

@ -114,11 +114,13 @@ func (this *MapData) Check5X() (bEliminate bool, xiaochu []int, s map[int]int) {
k5 := this.Plat[k+4].Color k5 := this.Plat[k+4].Color
if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 { if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 {
s[k+2] = FiveType s[k+2] = FiveType
xiaochu = append(xiaochu, []int{k, k + 1, k + 2, k + 3, k + 4}...)
xiaochu = append(xiaochu, k+2) this.Plat[k].Cid = 0
xiaochu = append(xiaochu, []int{k, k + 1, k + 3, k + 4}...) this.Plat[k+1].Cid = 0
this.Plat[k+2].Cid = 0
this.Plat[k+3].Cid = 0
this.Plat[k+4].Cid = 0
bEliminate = true bEliminate = true
} }
} }
@ -130,37 +132,18 @@ func (this *MapData) Check5X() (bEliminate bool, xiaochu []int, s map[int]int) {
k5 := this.Plat[k+4*Width].Color k5 := this.Plat[k+4*Width].Color
if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 { if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 {
s[k+2*Width] = FiveType
this.oid++ xiaochu = append(xiaochu, []int{k, k + Width, k + 2*Width, k + 3*Width, k + 4*Width}...)
this.Plat[k+2*Width] = &pb.GirdeData{ this.Plat[k].Cid = 0
Oid: this.oid, this.Plat[k+Width].Cid = 0
Color: k1, this.Plat[k+2*Width].Cid = 0
Cid: 1, this.Plat[k+3*Width].Cid = 0
Score: 1, this.Plat[k+4*Width].Cid = 0
Special: 1,
}
// 生成一个新的类型元素
// if conf, err := this.module.configure.GetGameBlock(k1, FiveType); err == nil {
// this.Plat[k+2*Width] = &pb.GirdeData{
// Oid: this.oid,
// Color: k1,
// Cid: conf.Key,
// Score: conf.Score,
// Special: conf.Type,
// }
// } else {
// xiaochu = append(xiaochu, k+2*Width)
// }
xiaochu = append(xiaochu, []int{k, k + Width, k + 3*Width, k + 4*Width}...)
bEliminate = true bEliminate = true
} }
} }
} }
for _, v := range xiaochu {
this.Plat[v].Cid = 0
}
return return
} }
@ -169,7 +152,7 @@ func (this *MapData) Check4X() (bEliminate bool, xiaochu []int, s map[int]int) {
newElem int // 生成的一个新的元素CID newElem int // 生成的一个新的元素CID
) )
s = make(map[int]int) s = make(map[int]int)
fmt.Printf("=====开始检测消除4x===========\n")
//var xiaochu []int // 即将消除的key //var xiaochu []int // 即将消除的key
for k, v := range this.Plat { for k, v := range this.Plat {
if v.Cid == 0 { if v.Cid == 0 {
@ -201,6 +184,9 @@ func (this *MapData) Check4X() (bEliminate bool, xiaochu []int, s map[int]int) {
s[newElem] = FourUType s[newElem] = FourUType
xiaochu = append(xiaochu, []int{k, k + 1, k + 2, k + 3}...) xiaochu = append(xiaochu, []int{k, k + 1, k + 2, k + 3}...)
for _, v := range xiaochu {
this.Plat[v].Cid = 0
}
bEliminate = true bEliminate = true
} }
} }
@ -229,15 +215,14 @@ func (this *MapData) Check4X() (bEliminate bool, xiaochu []int, s map[int]int) {
s[newElem] = FourLType s[newElem] = FourLType
xiaochu = append(xiaochu, k+Width) xiaochu = append(xiaochu, k+Width)
xiaochu = append(xiaochu, []int{k, k + Width, k + 2*Width, k + 3*Width}...) xiaochu = append(xiaochu, []int{k, k + Width, k + 2*Width, k + 3*Width}...)
for _, v := range xiaochu {
this.Plat[v].Cid = 0
}
bEliminate = true bEliminate = true
} }
} }
} }
for _, v := range xiaochu {
this.Plat[v].Cid = 0
}
return return
} }
@ -255,6 +240,9 @@ func (this *MapData) Check3X() (bEliminate bool, xiaochu []int) {
k3 := this.Plat[k+2].Color k3 := this.Plat[k+2].Color
if k1 == k2 && k2 == k3 { if k1 == k2 && k2 == k3 {
xiaochu = append(xiaochu, []int{k, k + 1, k + 2}...) xiaochu = append(xiaochu, []int{k, k + 1, k + 2}...)
this.Plat[k].Cid = 0
this.Plat[k+1].Cid = 0
this.Plat[k+2].Cid = 0
bEliminate = true bEliminate = true
} }
} }
@ -266,13 +254,14 @@ func (this *MapData) Check3X() (bEliminate bool, xiaochu []int) {
if k1 == k2 && k2 == k3 { if k1 == k2 && k2 == k3 {
xiaochu = append(xiaochu, []int{k, k + Width, k + 2*Width}...) xiaochu = append(xiaochu, []int{k, k + Width, k + 2*Width}...)
this.Plat[k].Cid = 0
this.Plat[k+Width].Cid = 0
this.Plat[k+2*Width].Cid = 0
bEliminate = true bEliminate = true
} }
} }
} }
for _, v := range xiaochu {
this.Plat[v].Cid = 0
}
return return
} }