ecs/servers/game/logic/player_temp.go

90 lines
2.0 KiB
Go
Raw Normal View History

2025-06-04 18:17:39 +08:00
package logic
import (
"ecs/proto/pb"
)
type PlayerThirdData struct {
NickName string
AvatarUrl string
}
type PlayerTemp struct {
Address string
PreScene uint32
CurScene uint32
2025-06-04 18:17:39 +08:00
Fighting bool
RandSeed uint64
2025-06-04 18:17:39 +08:00
//ArenaEnemy *RankingPlayer
//ChosenPlanetId uint32
//ChosenCivilizationId uint32
//
//requestTime map[int]int64
//adFunction map[uint32]int64
}
func (this *Player) initTemp() {
this.Temp.PreScene = 0
this.Temp.CurScene = 0
2025-06-04 18:17:39 +08:00
this.Temp.Fighting = false
this.Temp.RandSeed = 0
//this.Temp.ArenaEnemy = nil
//this.Temp.ChosenPlanetId = 0
//this.Temp.ChosenCivilizationId = 0
//this.Temp.requestTime = map[int]int64{}
//this.Temp.adFunction = map[uint32]int64{}
}
2025-06-05 17:47:59 +08:00
func (this *Player) enterScene(sceneId uint32) {
if sceneId == 0 {
this.Temp.CurScene = this.Temp.PreScene
this.Temp.PreScene = 0
} else {
this.Temp.PreScene = this.Temp.CurScene
this.Temp.CurScene = sceneId
}
2025-06-20 15:34:46 +08:00
_ = this.Send(pb.ModId_ModuleLevel, pb.MsgId_ModLevelSceneEnter, &pb.SceneEnterAck{SceneId: this.Temp.CurScene})
2025-06-04 18:17:39 +08:00
}
//func (this *Player) CheckRequestTime(reqType int) bool {
// var now = util.Unix()
// if now-this.Temp.requestTime[reqType] < 3 {
// return false
// }
// this.Temp.requestTime[reqType] = now
// return true
//}
//
//func (this *Player) ResetRequestTime(reqType int) {
// delete(this.Temp.requestTime, reqType)
//}
//func (this *Player) AddAdFunction(adTable *data.Ad) {
// this.Temp.adFunction[uint32(adTable.Id)] = util.Unix()
//}
//func (this *Player) CheckAdFunction(tipe proto.AdFunctionType, arg1, arg2, arg3 uint32) bool {
// var adTable = this.manager.tables.AdExtend.Get(int(tipe), int(arg1), int(arg2), int(arg3))
// if adTable == nil {
// return false
// }
//
// var time, ok = this.Temp.adFunction[uint32(adTable.Id)]
// if !ok {
// return false
// }
//
// delete(this.Temp.adFunction, uint32(adTable.Id))
//
// if util.Unix()-time > 90 {
// return false
// }
//
// this.AddCounter(proto.CounterTypeAdWatching, uint32(adTable.Id), 1)
//
// return true
//}