bggserv

package
v0.12.110 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidBasicPlayerState - invalid BasicPlayerState
	ErrInvalidBasicPlayerState = errors.New("invalid BasicPlayerState")
)

Functions

func AddPlayResult

func AddPlayResult(sv IService, pr *sgc7pb.ReplyPlay, results []*sgc7game.PlayResult)

AddPlayResult - []*sgc7game.PlayResult => *PlayResult

Types

type BasicService

type BasicService struct {
}

BasicService - BasicService

func NewBasicService

func NewBasicService() *BasicService

NewBasicService - new BasicService

func (*BasicService) BuildPBPlayerState

func (bs *BasicService) BuildPBPlayerState(ps sgc7game.IPlayerState) (*sgc7pb.PlayerState, error)

BuildPBPlayerState - sgc7game.IPlayerState -> *sgc7pb.PlayerState

func (*BasicService) BuildPlayerStateFromPB

func (bs *BasicService) BuildPlayerStateFromPB(ps sgc7game.IPlayerState, pspb *sgc7pb.PlayerState) error

BuildPlayerStateFromPB - *sgc7pb.PlayerState -> sgc7game.IPlayerState

type BasicService2

type BasicService2 struct {
}

BasicService2 - BasicService2

func NewBasicService2

func NewBasicService2() *BasicService2

NewBasicService - new BasicService2

func (*BasicService2) BuildPBPlayerState

func (bs *BasicService2) BuildPBPlayerState(ps sgc7game.IPlayerState) (*sgc7pb.PlayerState, error)

BuildPBPlayerState - sgc7game.IPlayerState -> *sgc7pb.PlayerState

func (*BasicService2) BuildPlayerStateFromPB

func (bs *BasicService2) BuildPlayerStateFromPB(ps sgc7game.IPlayerState, pspb *sgc7pb.PlayerState) error

BuildPlayerStateFromPB - *sgc7pb.PlayerState -> sgc7game.IPlayerState

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client - GameLogicClient

func NewClient

func NewClient(servAddr string) (*Client, error)

NewClient - new GameLogicClient

func (*Client) GetConfig

func (client *Client) GetConfig(ctx context.Context) (*sgc7pb.GameConfig, error)

GetConfig - get config

func (*Client) Initialize

func (client *Client) Initialize(ctx context.Context) (*sgc7pb.PlayerState, error)

Initialize - initialize a player

func (*Client) Play

func (client *Client) Play(ctx context.Context, ps *sgc7pb.PlayerState,
	cheat string,
	stake *sgc7pb.Stake,
	clientParams string,
	cmd string) (*sgc7pb.ReplyPlay, error)

Play - play game

type IService

type IService interface {
	// BuildPlayerStateFromPB - *sgc7pb.PlayerState -> sgc7game.IPlayerState
	BuildPlayerStateFromPB(ps sgc7game.IPlayerState, pspb *sgc7pb.PlayerState) error
	// BuildPBPlayerState - sgc7game.IPlayerState -> *sgc7pb.PlayerState
	BuildPBPlayerState(ps sgc7game.IPlayerState) (*sgc7pb.PlayerState, error)
	// BuildPBGameModParam - any -> *anypb.Any
	BuildPBGameModParam(gp any) (*anypb.Any, error)
	// BuildPBGameModParamFromAny - any -> *anypb.Any
	BuildPBGameModParamFromAny(msg *anypb.Any) (any, error)
}

IService - service

type Serv

type Serv struct {
	sgc7pb.UnimplementedGameLogicServer
	// contains filtered or unexported fields
}

Serv - Game Logic Service

func NewServ

func NewServ(service IService, game sgc7game.IGame, bindaddr string, version string, useOpenTelemetry bool) (*Serv, error)

NewServ -

func (*Serv) GetConfig

func (serv *Serv) GetConfig(ctx context.Context, req *sgc7pb.RequestConfig) (*sgc7pb.GameConfig, error)

GetConfig - get config

func (*Serv) Initialize

func (serv *Serv) Initialize(ctx context.Context, req *sgc7pb.RequestInitialize) (*sgc7pb.PlayerState, error)

Initialize - initialize a player

func (*Serv) LogReplyPlay

func (serv *Serv) LogReplyPlay(str string, reply *sgc7pb.ReplyPlay, logLevel zapcore.Level)

Play - play game

func (*Serv) Play

func (serv *Serv) Play(req *sgc7pb.RequestPlay, stream sgc7pb.GameLogic_PlayServer) error

Play - play game

func (*Serv) Play2 added in v0.10.378

func (serv *Serv) Play2(ctx context.Context, req *sgc7pb.RequestPlay) (*sgc7pb.ReplyPlay, error)

Play2 - play game

func (*Serv) ProcCheat

func (serv *Serv) ProcCheat(plugin sgc7plugin.IPlugin, cheat string) error

ProcCheat - process cheat

func (*Serv) Start

func (serv *Serv) Start(ctx context.Context) error

Start - start a service

func (*Serv) Stop

func (serv *Serv) Stop()

Stop - stop service

Jump to

Keyboard shortcuts

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