service

package
v0.0.11-otel Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameServerDispatch

type GameServerDispatch interface {
	Dispatch(ctx context.Context, gameMode constant.GameMode, modeVersion int64) (info pto.GameServerInfo, err error)
}

GameServerDispatch dispatches game server info base on game mode and mode version.

type Match

type Match interface {
	// CreateGroup creates a new group with the given parameters
	CreateGroup(ctx context.Context, param *pto.CreateGroup) (entry.Group, error)

	// EnterGroup makes the player join the existed group with the given groupID
	EnterGroup(ctx context.Context, info *pto.EnterGroup, groupID int64) error

	// ExitGroup makes the player leave the group
	ExitGroup(ctx context.Context, uid string) error

	// DissolveGroup dissolves a group and remove all players of the group
	DissolveGroup(ctx context.Context, uid string) error

	// Invite invites the invitee to join the group
	Invite(ctx context.Context, inviterUID, inviteeUID string) error

	// AcceptInvite accepts the invite and enter the group
	AcceptInvite(ctx context.Context, inviterUID string, inviteeInfo *pto.PlayerInfo, groupID int64) error

	// RefuseInvite refuses the invite from the inviter
	RefuseInvite(ctx context.Context, inviterUID, inviteeUID string, groupID int64, refuseMsg string)

	// KickPlayer kicks the kicked player from the group
	KickPlayer(ctx context.Context, captainUID, kickedUID string) error

	// ChangeRole changes the role of the target player
	ChangeRole(ctx context.Context, captainUID, targetUID string, role entry.GroupRole) error

	// SetNearbyJoinGroup sets whether the group can be joined by nearby players
	SetNearbyJoinGroup(ctx context.Context, captainUID string, allow bool) error

	// SetRecentJoinGroup sets whether the group can be joined by recent players
	SetRecentJoinGroup(ctx context.Context, captainUID string, allow bool) error

	// SetVoiceState sets whether the player can speak in the group
	SetVoiceState(ctx context.Context, uid string, state entry.PlayerVoiceState) error

	// Ready marks the player as ready
	Ready(ctx context.Context, uid string) error

	// UnReady marks the player as unready
	Unready(ctx context.Context, uid string) error

	// StartMatch starts to add the group to matching queue
	StartMatch(ctx context.Context, captainUID string) error

	// CancelMatch cancels the match and return `entry.GroupStateInvite` state
	CancelMatch(ctx context.Context, uid string) error

	// ExitGame exits the game (escape)
	ExitGame(ctx context.Context, uid string, roomID int64) error

	// UploadPlayerAttr uploads player attributes
	UploadPlayerAttr(ctx context.Context, uid string, attrs *pto.UploadPlayerAttr) error

	// HandleMatchResult handles the match result
	HandleMatchResult(r entry.Room)

	// HandleGameResult handles the game result
	HandleGameResult(result *pto.GameResult) error
}

type Push

type Push interface {
	// PushPlayerOnlineState pushes the player's online state to the client.
	PushPlayerOnlineState(ctx context.Context, uids []string, state entry.PlayerOnlineState)

	// PushGroupInfo pushes the group's players infos to the client.
	PushGroupInfo(ctx context.Context, uids []string, users *pto.GroupInfo)

	// PushInviteMsg pushes the invite message to the client.
	PushInviteMsg(ctx context.Context, param *pto.InviteMsg)

	// PushAcceptInvite pushes the accept invite message to the client.
	PushAcceptInvite(ctx context.Context, inviter, invitee string)

	// PushRefuseInvite pushes the refuse invite message to the client.
	PushRefuseInvite(ctx context.Context, inviter, invitee, refuseMsg string)

	// PushGroupDissolve pushes the group dissolve message to the client.
	PushGroupDissolve(ctx context.Context, uids []string, groupID int64)

	// PushGroupState pushes the group state to the client.
	PushGroupState(ctx context.Context, uids []string, groupID int64, state entry.GroupState)

	// PushVoiceState pushes the voice state to the client.
	PushVoiceState(ctx context.Context, uids []string, states *pto.UserVoiceState)

	// PushKick pushes the kick message to the client.
	PushKick(ctx context.Context, uid string, groupID int64)

	// PushMatchInfo pushes the match success info to the client.
	PushMatchInfo(ctx context.Context, uids []string, info *pto.MatchInfo)

	// PushCancelMatch pushes the cancel match message to the client.
	PushCancelMatch(ctx context.Context, uids []string, cancelUID string)

	// PushReady pushes the ready message to the client.
	PushReady(ctx context.Context, uids []string, readyUID string)

	// PushUnReady pushes the unready message to the client.
	PushUnReady(ctx context.Context, uids []string, unreadyUID string)
}

Push pushes the message to the client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL