package ops

import (
	"github.com/mhaya/game/game_cluster/internal/code"
	"github.com/mhaya/game/game_cluster/internal/pb"
	cactor "github.com/mhaya/net/actor"
	"sync"
)

var (
	pingReturn = &pb.Bool{Value: true}
)

type (
	ActorOps struct {
		cactor.Base
	}
)

var (
	lock        = &sync.RWMutex{}
	playerIdMap = make(map[string]string) // key:playerId, value:agentActorPath
	uidMap      = make(map[int64]int64)   // key:UID, value:playerId
)

func (p *ActorOps) AliasID() string {
	return "ops"
}

// OnInit 注册remote函数
func (p *ActorOps) OnInit() {
	p.Remote().Register("ping", p.ping)

}

// ping 请求center是否响应
func (p *ActorOps) ping() (*pb.Bool, int32) {
	return pingReturn, code.OK
}
