猜颜色优化

This commit is contained in:
hahwu 2025-03-25 14:51:50 +08:00
parent de271d25ef
commit b650706f2f
3 changed files with 1548 additions and 1382 deletions

View File

@ -2891,7 +2891,7 @@ func ReqGuessColorTake(player *Player, buf []byte) error {
})
return err
}
GuessColorMod.Take(req.Map, req.OMap)
GuessColorMod.Take(req.Map.Map, req.OMap)
player.PlayMod.save()
GuessColorBackData(player)
player.NotifyRed(ACT_TYPE_GUESS_COLOR)

View File

@ -12,7 +12,7 @@ type GuessColorMod struct {
Id int
Pass int
Opponent simplePlayer
Map map[int32]int32
MapList []map[int32]int32
OMap map[int32]int32
WinTime int
First bool
@ -32,8 +32,8 @@ const (
)
func (g *GuessColorMod) InitData() {
if g.Map == nil {
g.Map = make(map[int32]int32)
if g.MapList == nil {
g.MapList = make([]map[int32]int32, 0)
}
if g.OMap == nil {
g.OMap = make(map[int32]int32)
@ -68,7 +68,7 @@ func (g *GuessColorMod) Login(Id int) {
Progress: 0,
}
g.Guess = 0
g.Map = make(map[int32]int32)
g.MapList = make([]map[int32]int32, 0)
g.OMap = make(map[int32]int32)
}
@ -85,7 +85,7 @@ func (g *GuessColorMod) FirstIn() []*item.Item {
}
func (g *GuessColorMod) Take(Map map[int32]int32, OMap map[int32]int32) {
g.Map = Map
g.MapList = append(g.MapList, Map)
g.OMap = OMap
g.Guess++
}
@ -110,7 +110,7 @@ func (g *GuessColorMod) GetReward() ([]*item.Item, error) {
g.Pass++
g.Guess = 0
g.WinTime = guesscolorCfg.GetWinTime(g.Pass)
g.Map = make(map[int32]int32)
g.MapList = make([]map[int32]int32, 0)
g.OMap = make(map[int32]int32)
return Item, nil
}

File diff suppressed because it is too large Load Diff