package module

import (
	"github.com/mhaya/game/game_cluster/internal/mdb/models"
	"github.com/mhaya/net/parser/simple"
)

type (
	// ActorDBChild 玩家总管理actor
	ActorDBChild struct {
		simple.ActorBase
	}
)

func (p *ActorDBChild) OnInit() {
	// 注册角色登陆事件
	p.Remote().Register("setAccountDb", p.setAccountDb)
	p.Remote().Register("setPlayerDb", p.setPlayerDb)
}

func (p *ActorDBChild) setAccountDb(req *models.Account) {
	BindAccountId(req)
}
func (p *ActorDBChild) setPlayerDb(req *models.Player) {
	BindPlayerId(req)
}

/*func (p *ActorDBs) OnFindChild(msg *cfacade.Message) (cfacade.IActor, bool) {
	// 动态创建 player child actor
	childID := msg.TargetPath().ChildID
	childActor, err := p.Child().Create(childID, &{
		isOnline: false,
	})

	if err != nil {
		return nil, false
	}

	return childActor, true
}*/
