refactor(controller): 重构控制器函数命名和代码注释

- 重命名 EGG 函数为 EggGamePlay,更新宠物生成逻辑
- 重命名 Leiyi 函数为 GetLeiyiTrainStatus
- 重命名 Cacthpet 函数为 CatchPet,添加详细函数注释
- 为 ArenaSetOwner、ArenaFightOwner、ArenaGetInfo、ArenaUpfight、ArenaOwnerAcce
  等擂台相关函数添加注释前缀
- 重命名 PETKing 函数为 PetKing
- 重命名 FRESH_CHOICE_FIGHT_LEVEL 函数为 FreshChoiceFightLevel,添加详细参数说明
- 重命名 BuyMItem 函数为 BuyMultipleItems
- 重命名 ITEM_S
This commit is contained in:
2025-12-24 19:03:11 +08:00
parent 9baca27033
commit 502d497dce
32 changed files with 533 additions and 615 deletions

View File

@@ -31,35 +31,39 @@ func newbaseplayer() baseplayer {
}
return ret
}
func (p *baseplayer) GetInfo() *model.PlayerInfo {
// GetInfo 获取玩家基础信息
func (p *baseplayer) GetInfo() *model.PlayerInfo {
return p.Info
}
func (f *baseplayer) SetFightC(ff common.FightI) {
f.FightC = ff
// SetFightC 设置玩家战斗控制器
func (f *baseplayer) SetFightC(fightController common.FightI) {
f.FightC = fightController
}
// GetPlayerCaptureContext 获取玩家捕捉上下文
func (f *baseplayer) GetPlayerCaptureContext() *info.PlayerCaptureContext {
return f.PlayerCaptureContext
}
func (f *baseplayer) FindPet(CatchTime uint32) (int, *model.PetInfo, bool) {
// FindPet 根据捕捉时间查找宠物
// 返回值: (索引, 宠物信息, 是否找到)
func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
return utils.FindWithIndex(f.Info.PetList, func(item model.PetInfo) bool {
return item.CatchTime == CatchTime
return item.CatchTime == catchTime
})
}
func (f *Player) Pet_del(CatchTime uint32) {
//println("删除精灵1", CatchTime)
index, _, ok := f.FindPet(CatchTime)
// Pet_del 删除指定宠物
// catchTime: 宠物的捕捉时间戳
func (f *Player) Pet_del(catchTime uint32) {
index, _, ok := f.FindPet(catchTime)
if ok {
// println("删除精灵", CatchTime)
copy(f.Info.PetList[index:], f.Info.PetList[index+1:])
f.Info.PetList = f.Info.PetList[:len(f.Info.PetList)-1]
f.Service.Pet.Pet_del(CatchTime)
f.Service.Pet.Pet_del(catchTime)
}
}
// // 计算整数的二进制1的个数Integer.bitCount