Documentation
¶
Index ¶
- Variables
- func RegisterGameServiceServer(s *grpc.Server, srv GameServiceServer)
- type Client
- func (*Client) Descriptor() ([]byte, []int)deprecated
- func (x *Client) GetCall() *base.Instances
- func (x *Client) GetCancel() bool
- func (x *Client) GetContinueGame() bool
- func (x *Client) GetDraw() bool
- func (x *Client) GetDrop() *ClientDrop
- func (x *Client) GetNoten() bool
- func (m *Client) GetOneofClient() isClient_OneofClient
- func (x *Client) GetSettings() *Settings
- func (x *Client) GetSuggestId() int64
- func (x *Client) GetWin() bool
- func (*Client) ProtoMessage()
- func (x *Client) ProtoReflect() protoreflect.Message
- func (x *Client) Reset()
- func (x *Client) String() string
- type ClientDrop
- type Client_Call
- type Client_Cancel
- type Client_ContinueGame
- type Client_Draw
- type Client_Drop
- type Client_Noten
- type Client_Settings
- type Client_Win
- type GameEndEvent
- func (*GameEndEvent) Descriptor() ([]byte, []int)deprecated
- func (x *GameEndEvent) GetChanges() *log.Changes
- func (x *GameEndEvent) GetEndReason() log.GameEndReason
- func (*GameEndEvent) ProtoMessage()
- func (x *GameEndEvent) ProtoReflect() protoreflect.Message
- func (x *GameEndEvent) Reset()
- func (x *GameEndEvent) String() string
- type GameServiceClient
- type GameServiceServer
- type GameService_ConnectClient
- type GameService_ConnectServer
- type GameStartEvent
- func (*GameStartEvent) Descriptor() ([]byte, []int)deprecated
- func (x *GameStartEvent) GetClientIndex() int64
- func (x *GameStartEvent) GetInfo() *log.GameInfo
- func (*GameStartEvent) ProtoMessage()
- func (x *GameStartEvent) ProtoReflect() protoreflect.Message
- func (x *GameStartEvent) Reset()
- func (x *GameStartEvent) String() string
- type RoundRecover
- type Server
- func (*Server) Descriptor() ([]byte, []int)deprecated
- func (x *Server) GetChanges() *log.ScoreChangesEvent
- func (x *Server) GetDeclare() *log.DeclareEvent
- func (x *Server) GetDraw() *log.DrawEvent
- func (x *Server) GetDrop() *log.DropEvent
- func (x *Server) GetFuriten() log.Furiten
- func (x *Server) GetGameEnd() *GameEndEvent
- func (x *Server) GetGameStart() *GameStartEvent
- func (x *Server) GetIndicator() *log.IndicatorEvent
- func (m *Server) GetOneofEvents() isServer_OneofEvents
- func (x *Server) GetPlayerStatus() *log.PlayerStatusEvent
- func (x *Server) GetRecover() *RoundRecover
- func (x *Server) GetRoundStart() *log.RoundInfo
- func (x *Server) GetSay() *log.SayEvent
- func (x *Server) GetSettings() *Settings
- func (x *Server) GetSuggest() *Suggest
- func (x *Server) GetTake() *log.TakeEvent
- func (x *Server) GetWin() *log.WinEvent
- func (*Server) ProtoMessage()
- func (x *Server) ProtoReflect() protoreflect.Message
- func (x *Server) Reset()
- func (x *Server) String() string
- type Server_Changes
- type Server_Declare
- type Server_Draw
- type Server_Drop
- type Server_Furiten
- type Server_GameEnd
- type Server_GameStart
- type Server_Indicator
- type Server_PlayerStatus
- type Server_Recover
- type Server_RoundStart
- type Server_Say
- type Server_Settings
- type Server_Take
- type Server_Win
- type Settings
- func (*Settings) Descriptor() ([]byte, []int)deprecated
- func (x *Settings) GetAutoEndGame() bool
- func (x *Settings) GetAutoTempai() bool
- func (x *Settings) GetAutoWin() bool
- func (x *Settings) GetDropTsumo() bool
- func (x *Settings) GetNoDeclare() bool
- func (*Settings) ProtoMessage()
- func (x *Settings) ProtoReflect() protoreflect.Message
- func (x *Settings) Reset()
- func (x *Settings) String() string
- type Suggest
- func (*Suggest) Descriptor() ([]byte, []int)deprecated
- func (x *Suggest) GetCanceled() bool
- func (x *Suggest) GetChiCenter() bool
- func (x *Suggest) GetChiLeft() bool
- func (x *Suggest) GetChiRight() bool
- func (x *Suggest) GetClosedKanMask() int64
- func (x *Suggest) GetContinueGame() bool
- func (x *Suggest) GetDraw() bool
- func (x *Suggest) GetDropMask() int64
- func (x *Suggest) GetKan() bool
- func (x *Suggest) GetNoten() bool
- func (x *Suggest) GetPon() bool
- func (x *Suggest) GetRiichiMask() int64
- func (x *Suggest) GetSuggestId() int64
- func (x *Suggest) GetTimeout() *duration.Duration
- func (x *Suggest) GetUpgradeInstances() *base.Instances
- func (x *Suggest) GetWin() bool
- func (*Suggest) ProtoMessage()
- func (x *Suggest) ProtoReflect() protoreflect.Message
- func (x *Suggest) Reset()
- func (x *Suggest) String() string
- type UnimplementedGameServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_public_game_client_proto protoreflect.FileDescriptor
var File_public_game_game_service_proto protoreflect.FileDescriptor
var File_public_game_server_proto protoreflect.FileDescriptor
Functions ¶
func RegisterGameServiceServer ¶
func RegisterGameServiceServer(s *grpc.Server, srv GameServiceServer)
Types ¶
type Client ¶
type Client struct { // See Server.suggest.suggest_id SuggestId int64 `protobuf:"varint,1,opt,name=suggest_id,json=suggestId,proto3" json:"suggest_id,omitempty"` // Types that are assignable to OneofClient: // // *Client_Cancel // *Client_Drop // *Client_Call // *Client_Win // *Client_Draw // *Client_Noten // *Client_ContinueGame // *Client_Settings OneofClient isClient_OneofClient `protobuf_oneof:"oneof_client"` // contains filtered or unexported fields }
Server will treat any incorrect answer as a cancel event. For example, when you try to Drop tile with riichi flag, on a wrong tile or when not in tempai - it will lead to tsumogiri. When you get Server response with, previously sent suggest_id and cancel=true, this means that the event is outdated (ex. priority action by other player or timeout). It is still safe to send answers on outdated event, in this case server just omits the answer and continues waiting for answer with valid suggest_id (if any).
func (*Client) Descriptor
deprecated
func (*Client) GetContinueGame ¶
func (*Client) GetDrop ¶
func (x *Client) GetDrop() *ClientDrop
func (*Client) GetOneofClient ¶
func (m *Client) GetOneofClient() isClient_OneofClient
func (*Client) GetSettings ¶
func (*Client) GetSuggestId ¶
func (*Client) ProtoMessage ¶
func (*Client) ProtoMessage()
func (*Client) ProtoReflect ¶
func (x *Client) ProtoReflect() protoreflect.Message
type ClientDrop ¶
type ClientDrop struct { Instance int64 `protobuf:"varint,1,opt,name=instance,proto3" json:"instance,omitempty"` Riichi bool `protobuf:"varint,2,opt,name=riichi,proto3" json:"riichi,omitempty"` // contains filtered or unexported fields }
func (*ClientDrop) Descriptor
deprecated
func (*ClientDrop) Descriptor() ([]byte, []int)
Deprecated: Use ClientDrop.ProtoReflect.Descriptor instead.
func (*ClientDrop) GetInstance ¶
func (x *ClientDrop) GetInstance() int64
func (*ClientDrop) GetRiichi ¶
func (x *ClientDrop) GetRiichi() bool
func (*ClientDrop) ProtoMessage ¶
func (*ClientDrop) ProtoMessage()
func (*ClientDrop) ProtoReflect ¶
func (x *ClientDrop) ProtoReflect() protoreflect.Message
func (*ClientDrop) Reset ¶
func (x *ClientDrop) Reset()
func (*ClientDrop) String ¶
func (x *ClientDrop) String() string
type Client_Call ¶
type Client_Cancel ¶
type Client_Cancel struct { // It is safe to answer cancel on any suggest. // In this case server will take default action. // For take is will be tsumogiri. // For call actions it will be any possible tile dropped. Cancel bool `protobuf:"varint,2,opt,name=cancel,proto3,oneof"` }
type Client_ContinueGame ¶
type Client_ContinueGame struct {
ContinueGame bool `protobuf:"varint,8,opt,name=continue_game,json=continueGame,proto3,oneof"`
}
type Client_Draw ¶
type Client_Draw struct {
Draw bool `protobuf:"varint,6,opt,name=draw,proto3,oneof"`
}
type Client_Drop ¶
type Client_Drop struct {
Drop *ClientDrop `protobuf:"bytes,3,opt,name=drop,proto3,oneof"`
}
type Client_Noten ¶
type Client_Noten struct {
Noten bool `protobuf:"varint,7,opt,name=noten,proto3,oneof"`
}
type Client_Settings ¶
type Client_Settings struct { // New client settings, applied on server. Settings *Settings `protobuf:"bytes,9,opt,name=settings,proto3,oneof"` }
type Client_Win ¶
type Client_Win struct {
Win bool `protobuf:"varint,5,opt,name=win,proto3,oneof"`
}
type GameEndEvent ¶
type GameEndEvent struct { Changes *log.Changes `protobuf:"bytes,1,opt,name=changes,proto3" json:"changes,omitempty"` EndReason log.GameEndReason `protobuf:"varint,2,opt,name=end_reason,json=endReason,proto3,enum=mahjong.log.GameEndReason" json:"end_reason,omitempty"` // contains filtered or unexported fields }
Final screen
func (*GameEndEvent) Descriptor
deprecated
func (*GameEndEvent) Descriptor() ([]byte, []int)
Deprecated: Use GameEndEvent.ProtoReflect.Descriptor instead.
func (*GameEndEvent) GetChanges ¶
func (x *GameEndEvent) GetChanges() *log.Changes
func (*GameEndEvent) GetEndReason ¶
func (x *GameEndEvent) GetEndReason() log.GameEndReason
func (*GameEndEvent) ProtoMessage ¶
func (*GameEndEvent) ProtoMessage()
func (*GameEndEvent) ProtoReflect ¶
func (x *GameEndEvent) ProtoReflect() protoreflect.Message
func (*GameEndEvent) Reset ¶
func (x *GameEndEvent) Reset()
func (*GameEndEvent) String ¶
func (x *GameEndEvent) String() string
type GameServiceClient ¶
type GameServiceClient interface { // Use tokens, gained in Create to auth Play via "token" header Connect(ctx context.Context, opts ...grpc.CallOption) (GameService_ConnectClient, error) }
GameServiceClient is the client API for GameService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewGameServiceClient ¶
func NewGameServiceClient(cc grpc.ClientConnInterface) GameServiceClient
type GameServiceServer ¶
type GameServiceServer interface { // Use tokens, gained in Create to auth Play via "token" header Connect(GameService_ConnectServer) error }
GameServiceServer is the server API for GameService service.
type GameStartEvent ¶
type GameStartEvent struct { ClientIndex int64 `protobuf:"varint,1,opt,name=client_index,json=clientIndex,proto3" json:"client_index,omitempty"` Info *log.GameInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` // contains filtered or unexported fields }
func (*GameStartEvent) Descriptor
deprecated
func (*GameStartEvent) Descriptor() ([]byte, []int)
Deprecated: Use GameStartEvent.ProtoReflect.Descriptor instead.
func (*GameStartEvent) GetClientIndex ¶
func (x *GameStartEvent) GetClientIndex() int64
func (*GameStartEvent) GetInfo ¶
func (x *GameStartEvent) GetInfo() *log.GameInfo
func (*GameStartEvent) ProtoMessage ¶
func (*GameStartEvent) ProtoMessage()
func (*GameStartEvent) ProtoReflect ¶
func (x *GameStartEvent) ProtoReflect() protoreflect.Message
func (*GameStartEvent) Reset ¶
func (x *GameStartEvent) Reset()
func (*GameStartEvent) String ¶
func (x *GameStartEvent) String() string
type RoundRecover ¶
type RoundRecover struct { Events []*Server `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` // contains filtered or unexported fields }
Send after reconnect
func (*RoundRecover) Descriptor
deprecated
func (*RoundRecover) Descriptor() ([]byte, []int)
Deprecated: Use RoundRecover.ProtoReflect.Descriptor instead.
func (*RoundRecover) GetEvents ¶
func (x *RoundRecover) GetEvents() []*Server
func (*RoundRecover) ProtoMessage ¶
func (*RoundRecover) ProtoMessage()
func (*RoundRecover) ProtoReflect ¶
func (x *RoundRecover) ProtoReflect() protoreflect.Message
func (*RoundRecover) Reset ¶
func (x *RoundRecover) Reset()
func (*RoundRecover) String ¶
func (x *RoundRecover) String() string
type Server ¶
type Server struct { // If server message contains suggset, the client is expected // to answer with Client message, with same "suggest_id" set. // The exception is when suggest.canceled = true. With such message // server tells that on of previous messages (selected by suggest_id) is // out of date (ex. by timeout) and the response is no longer expected. Suggest *Suggest `protobuf:"bytes,1,opt,name=suggest,proto3" json:"suggest,omitempty"` // Types that are assignable to OneofEvents: // // *Server_Take // *Server_Drop // *Server_Changes // *Server_Say // *Server_Declare // *Server_Win // *Server_Draw // *Server_Indicator // *Server_RoundStart // *Server_GameStart // *Server_GameEnd // *Server_Furiten // *Server_Recover // *Server_PlayerStatus // *Server_Settings OneofEvents isServer_OneofEvents `protobuf_oneof:"oneof_events"` // contains filtered or unexported fields }
Server initiated message
func (*Server) Descriptor
deprecated
func (*Server) GetChanges ¶
func (x *Server) GetChanges() *log.ScoreChangesEvent
func (*Server) GetDeclare ¶
func (x *Server) GetDeclare() *log.DeclareEvent
func (*Server) GetFuriten ¶
func (*Server) GetGameEnd ¶
func (x *Server) GetGameEnd() *GameEndEvent
func (*Server) GetGameStart ¶
func (x *Server) GetGameStart() *GameStartEvent
func (*Server) GetIndicator ¶
func (x *Server) GetIndicator() *log.IndicatorEvent
func (*Server) GetOneofEvents ¶
func (m *Server) GetOneofEvents() isServer_OneofEvents
func (*Server) GetPlayerStatus ¶
func (x *Server) GetPlayerStatus() *log.PlayerStatusEvent
func (*Server) GetRecover ¶
func (x *Server) GetRecover() *RoundRecover
func (*Server) GetRoundStart ¶
func (*Server) GetSettings ¶
func (*Server) GetSuggest ¶
func (*Server) ProtoMessage ¶
func (*Server) ProtoMessage()
func (*Server) ProtoReflect ¶
func (x *Server) ProtoReflect() protoreflect.Message
type Server_Changes ¶
type Server_Changes struct {
Changes *log.ScoreChangesEvent `protobuf:"bytes,5,opt,name=changes,proto3,oneof"`
}
type Server_Declare ¶
type Server_Declare struct {
Declare *log.DeclareEvent `protobuf:"bytes,7,opt,name=declare,proto3,oneof"`
}
type Server_Draw ¶
type Server_Drop ¶
type Server_Furiten ¶
type Server_GameEnd ¶
type Server_GameEnd struct {
GameEnd *GameEndEvent `protobuf:"bytes,13,opt,name=game_end,json=gameEnd,proto3,oneof"`
}
type Server_GameStart ¶
type Server_GameStart struct {
GameStart *GameStartEvent `protobuf:"bytes,12,opt,name=game_start,json=gameStart,proto3,oneof"`
}
type Server_Indicator ¶
type Server_Indicator struct {
Indicator *log.IndicatorEvent `protobuf:"bytes,10,opt,name=indicator,proto3,oneof"`
}
type Server_PlayerStatus ¶
type Server_PlayerStatus struct {
PlayerStatus *log.PlayerStatusEvent `protobuf:"bytes,16,opt,name=player_status,json=playerStatus,proto3,oneof"`
}
type Server_Recover ¶
type Server_Recover struct { // Special message, sent by server when reconnected to recover state // Contains previously sent messages with no suggest field. Recover *RoundRecover `protobuf:"bytes,15,opt,name=recover,proto3,oneof"` }
type Server_RoundStart ¶
type Server_Say ¶
type Server_Settings ¶
type Server_Settings struct { // Setting applied on server side. Settings *Settings `protobuf:"bytes,17,opt,name=settings,proto3,oneof"` }
type Server_Take ¶
type Server_Win ¶
type Settings ¶
type Settings struct { DropTsumo bool `protobuf:"varint,1,opt,name=drop_tsumo,json=dropTsumo,proto3" json:"drop_tsumo,omitempty"` AutoWin bool `protobuf:"varint,2,opt,name=auto_win,json=autoWin,proto3" json:"auto_win,omitempty"` NoDeclare bool `protobuf:"varint,3,opt,name=no_declare,json=noDeclare,proto3" json:"no_declare,omitempty"` AutoTempai bool `protobuf:"varint,4,opt,name=auto_tempai,json=autoTempai,proto3" json:"auto_tempai,omitempty"` // For optional agari-yame AutoEndGame bool `protobuf:"varint,5,opt,name=auto_end_game,json=autoEndGame,proto3" json:"auto_end_game,omitempty"` // contains filtered or unexported fields }
Settings will be applied on server, even when disconnected. You will get confirmation on settings changes from server (see Server.settings).
func (*Settings) Descriptor
deprecated
func (*Settings) GetAutoEndGame ¶
func (*Settings) GetAutoTempai ¶
func (*Settings) GetAutoWin ¶
func (*Settings) GetDropTsumo ¶
func (*Settings) GetNoDeclare ¶
func (*Settings) ProtoMessage ¶
func (*Settings) ProtoMessage()
func (*Settings) ProtoReflect ¶
func (x *Settings) ProtoReflect() protoreflect.Message
type Suggest ¶
type Suggest struct { // Should response with this id SuggestId int64 `protobuf:"varint,1,opt,name=suggest_id,json=suggestId,proto3" json:"suggest_id,omitempty"` Pon bool `protobuf:"varint,2,opt,name=pon,proto3" json:"pon,omitempty"` Kan bool `protobuf:"varint,3,opt,name=kan,proto3" json:"kan,omitempty"` ClosedKanMask int64 `protobuf:"varint,4,opt,name=closed_kan_mask,json=closedKanMask,proto3" json:"closed_kan_mask,omitempty"` UpgradeInstances *base.Instances `protobuf:"bytes,5,opt,name=upgrade_instances,json=upgradeInstances,proto3" json:"upgrade_instances,omitempty"` // 1+23 ChiLeft bool `protobuf:"varint,6,opt,name=chi_left,json=chiLeft,proto3" json:"chi_left,omitempty"` // 2+13 ChiCenter bool `protobuf:"varint,7,opt,name=chi_center,json=chiCenter,proto3" json:"chi_center,omitempty"` // 3+12 ChiRight bool `protobuf:"varint,8,opt,name=chi_right,json=chiRight,proto3" json:"chi_right,omitempty"` DropMask int64 `protobuf:"varint,9,opt,name=drop_mask,json=dropMask,proto3" json:"drop_mask,omitempty"` RiichiMask int64 `protobuf:"varint,10,opt,name=riichi_mask,json=riichiMask,proto3" json:"riichi_mask,omitempty"` Win bool `protobuf:"varint,11,opt,name=win,proto3" json:"win,omitempty"` Draw bool `protobuf:"varint,12,opt,name=draw,proto3" json:"draw,omitempty"` // Suggested to show noten (could show tempai) // Could be used for some rulesets Noten bool `protobuf:"varint,13,opt,name=noten,proto3" json:"noten,omitempty"` // Specific for some rules, where leader could continue game (agari yame). ContinueGame bool `protobuf:"varint,14,opt,name=continue_game,json=continueGame,proto3" json:"continue_game,omitempty"` // Time to answer. Should be used to display timer to player. // Client should not take any action if player does not select an answer in given time. // After the timeout server will discard the event. // Server could add additional time on its side to gurantee player will have at least // timeout time. Timeout *duration.Duration `protobuf:"bytes,15,opt,name=timeout,proto3" json:"timeout,omitempty"` // Means all suggest are canceled. Must not be answered. Canceled bool `protobuf:"varint,16,opt,name=canceled,proto3" json:"canceled,omitempty"` // contains filtered or unexported fields }
func (*Suggest) Descriptor
deprecated
func (*Suggest) GetCanceled ¶
func (*Suggest) GetChiCenter ¶
func (*Suggest) GetChiLeft ¶
func (*Suggest) GetChiRight ¶
func (*Suggest) GetClosedKanMask ¶
func (*Suggest) GetContinueGame ¶
func (*Suggest) GetDropMask ¶
func (*Suggest) GetRiichiMask ¶
func (*Suggest) GetSuggestId ¶
func (*Suggest) GetTimeout ¶
func (*Suggest) GetUpgradeInstances ¶
func (*Suggest) ProtoMessage ¶
func (*Suggest) ProtoMessage()
func (*Suggest) ProtoReflect ¶
func (x *Suggest) ProtoReflect() protoreflect.Message
type UnimplementedGameServiceServer ¶
type UnimplementedGameServiceServer struct { }
UnimplementedGameServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedGameServiceServer) Connect ¶
func (*UnimplementedGameServiceServer) Connect(GameService_ConnectServer) error