Documentation ¶
Index ¶
- Constants
- Variables
- func AddPlayResult(sv IService, pr *sgc7pb.ReplyPlay, results []*sgc7game.PlayResult)
- type BasicService
- type Client
- func (client *Client) GetConfig() (*sgc7game.Config, error)
- func (client *Client) Initialize() (*sgc7pb.PlayerState, error)
- func (client *Client) Initialize2() (string, error)
- func (client *Client) PlayEx(param *sgc7pb.RequestPlay) (*sgc7pb.ReplyPlay, error)
- func (client *Client) PlayEx2(param string) (string, error)
- type Config
- type IService
- type Serv
Constants ¶
View Source
const BasicURL = "/game"
BasicURL - basic url
Variables ¶
View Source
var ( // ErrUnkonow - unknow error ErrUnkonow = errors.New("unknow error") // ErrNonStatusOK - non statusOK ErrNonStatusOK = errors.New("non statusOK") )
Functions ¶
func AddPlayResult ¶
func AddPlayResult(sv IService, pr *sgc7pb.ReplyPlay, results []*sgc7game.PlayResult)
AddPlayResult - []*sgc7game.PlayResult => *PlayResult
Types ¶
type BasicService ¶
type BasicService struct {
// contains filtered or unexported fields
}
BasicService - basic service
func NewBasicService ¶
func NewBasicService(game sgc7game.IGame) (*BasicService, error)
NewBasicService - new a 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
func (*BasicService) GetGame ¶
func (serv *BasicService) GetGame() sgc7game.IGame
GetGame - get game
type Client ¶
type Client struct {
ServURL string
}
Client - client
func NewClient ¶
NewClient - new Client, servurl is like http://127.0.0.1:7891/game/
func (*Client) Initialize ¶
func (client *Client) Initialize() (*sgc7pb.PlayerState, error)
Initialize - initialize a player
func (*Client) Initialize2 ¶
Initialize2 - initialize a player
type Config ¶
type Config struct { GameCode string `yaml:"gamecode"` BindAddr string `yaml:"bindaddr"` IsDebugMode bool `yaml:"isdebugmode"` LogLevel string `yaml:"loglevel"` }
Config - configuration
type IService ¶
type IService interface { // GetGame - get game GetGame() sgc7game.IGame // 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 - interface{} -> *any.Any BuildPBGameModParam(gp interface{}) (*any.Any, error) // BuildPBGameModParamFromAny - interface{} -> *any.Any BuildPBGameModParamFromAny(msg *any.Any) (interface{}, error) }
IService - service
Source Files ¶
Click to show internal directories.
Click to hide internal directories.