zhengtao il y a 7 mois
Parent
commit
5d0ca88db1
1 fichiers modifiés avec 11 ajouts et 9 suppressions
  1. 11 9
      game/game_cluster/nodes/game/module/player/actor_player.go

+ 11 - 9
game/game_cluster/nodes/game/module/player/actor_player.go

@@ -100,7 +100,7 @@ func (p *actorPlayer) OnInit() {
 	p.Remote().Register("unitTest", p.unitTest)
 
 	//p.Timer().Add(10*time.Second, p.refreshRoll)
-	p.Timer().Add(60*time.Second, p.SetRewardToDB)
+	//	p.Timer().Add(60*time.Second, p.SetRewardToDB)
 	p.Timer().Add(1*time.Minute, p.setRedis)
 	//p.Timer().Add(30*time.Second, p.setDb)
 	//p.Timer().Add(30*time.Second, p.setInviteReward)
@@ -422,14 +422,16 @@ func (p *actorPlayer) playerSessionClose() {
 
 // sessionClose 接收角色session关闭处理
 func (p *actorPlayer) sessionClose() {
-	online.UnBindPlayer(p.uid)
-	p.setDb()
-	//p.SetRewardToDB()
-	p.setRedisAll()
-	//logoutEvent := event.NewPlayerLogout(p.ActorID(), p.playerId, p.targetPath)
-	p.isOnline = false
-	p.Exit()
-	models.SetServerRecord(p.App().NodeId(), online.Count())
+	if p.Player != nil {
+		online.UnBindPlayer(p.uid)
+		p.setDb()
+		//p.SetRewardToDB()
+		p.setRedisAll()
+		//logoutEvent := event.NewPlayerLogout(p.ActorID(), p.playerId, p.targetPath)
+		p.isOnline = false
+		p.Exit()
+		models.SetServerRecord(p.App().NodeId(), online.Count())
+	}
 	//p.PostEvent(&logoutEvent)
 }