86 lines
1.9 KiB
Go
86 lines
1.9 KiB
Go
package logic
|
|
|
|
import (
|
|
"ecs/proto/pb"
|
|
)
|
|
|
|
type PlayerThirdData struct {
|
|
NickName string
|
|
AvatarUrl string
|
|
}
|
|
|
|
type PlayerTemp struct {
|
|
Address string
|
|
|
|
WechatSessionKey string
|
|
|
|
ThirdData *PlayerThirdData
|
|
|
|
SceneId uint32
|
|
Fighting bool
|
|
RandSeed uint64
|
|
|
|
//ArenaEnemy *RankingPlayer
|
|
|
|
//ChosenPlanetId uint32
|
|
//ChosenCivilizationId uint32
|
|
//
|
|
//requestTime map[int]int64
|
|
//adFunction map[uint32]int64
|
|
}
|
|
|
|
func (this *Player) initTemp() {
|
|
this.Temp.SceneId = 0
|
|
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{}
|
|
}
|
|
|
|
func (this *Player) enterScene(sceneId uint32) {
|
|
this.Temp.SceneId = sceneId
|
|
_ = this.Send(uint16(pb.ModId_ModuleLevel), uint16(pb.MsgId_ModLevelSceneEnter), &pb.SceneEnterAck{SceneId: this.Temp.SceneId})
|
|
}
|
|
|
|
//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
|
|
//}
|