game_ops.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package actorRemote
  2. import (
  3. capp "f1-game/internal/cherry_app"
  4. nameActor "f1-game/internal/name/actor"
  5. nameRemote "f1-game/internal/name/remote"
  6. "f1-game/internal/pb"
  7. cfacade "github.com/cherry-game/cherry/facade"
  8. )
  9. type gameOps struct {
  10. }
  11. func newGameOps() *gameOps {
  12. return &gameOps{}
  13. }
  14. func (p *gameOps) GetDBReport(gameNodeID string) (*pb.DBQueueReportList, int32) {
  15. rsp := &pb.DBQueueReportList{}
  16. errCode := capp.CallWait(p.targetPath(gameNodeID), nameRemote.Ops_DbReport, nil, rsp)
  17. return rsp, errCode
  18. }
  19. func (p *gameOps) Online(gameNodeID string) (int64, int32) {
  20. rsp := &pb.I64{}
  21. errCode := capp.CallWait(p.targetPath(gameNodeID), nameRemote.Ops_Online, nil, rsp)
  22. return rsp.Value, errCode
  23. }
  24. // 设置战斗验证开关
  25. func (p *gameOps) SetBattleValidation(gameNodeID string, req *pb.Bool) int32 {
  26. return capp.CallWait(p.targetPath(gameNodeID), nameRemote.Ops_SetBattleValidation, req, nil)
  27. }
  28. func (*gameOps) targetPath(gameNodeID string) string {
  29. targetPath := cfacade.NewPath(gameNodeID, nameActor.GameOps)
  30. return targetPath
  31. }