nex-protocols-common-go/matchmake-extension/protocol.go
Daniel López Guimaraes e598334373
Address PR issues
And other improvements
2023-06-06 21:29:47 +01:00

33 lines
1.4 KiB
Go

package matchmake_extension
import (
nex "github.com/PretendoNetwork/nex-go"
match_making "github.com/PretendoNetwork/nex-protocols-go/match-making"
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
"github.com/PretendoNetwork/plogger-go"
)
var commonMatchmakeExtensionProtocol *CommonMatchmakeExtensionProtocol
var logger = plogger.NewLogger()
type CommonMatchmakeExtensionProtocol struct {
*matchmake_extension.MatchmakeExtensionProtocol
server *nex.Server
cleanupSearchMatchmakeSessionHandler func(matchmakeSession *match_making.MatchmakeSession)
}
// CleanupSearchMatchmakeSession sets the CleanupSearchMatchmakeSession handler function
func (commonMatchmakeExtensionProtocol *CommonMatchmakeExtensionProtocol) CleanupSearchMatchmakeSession(handler func(matchmakeSession *match_making.MatchmakeSession)) {
commonMatchmakeExtensionProtocol.cleanupSearchMatchmakeSessionHandler = handler
}
// NewCommonMatchmakeExtensionProtocol returns a new CommonMatchmakeExtensionProtocol
func NewCommonMatchmakeExtensionProtocol(server *nex.Server) *CommonMatchmakeExtensionProtocol {
MatchmakeExtensionProtocol := matchmake_extension.NewMatchmakeExtensionProtocol(server)
commonMatchmakeExtensionProtocol = &CommonMatchmakeExtensionProtocol{MatchmakeExtensionProtocol: MatchmakeExtensionProtocol, server: server}
MatchmakeExtensionProtocol.AutoMatchmake_Postpone(autoMatchmake_Postpone)
return commonMatchmakeExtensionProtocol
}