game

package
v0.0.0-...-7f16e2a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_public_game_client_proto protoreflect.FileDescriptor
View Source
var File_public_game_game_service_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Client.ProtoReflect.Descriptor instead.

func (*Client) GetCall

func (x *Client) GetCall() *base.Instances

func (*Client) GetCancel

func (x *Client) GetCancel() bool

func (*Client) GetContinueGame

func (x *Client) GetContinueGame() bool

func (*Client) GetDraw

func (x *Client) GetDraw() bool

func (*Client) GetDrop

func (x *Client) GetDrop() *ClientDrop

func (*Client) GetNoten

func (x *Client) GetNoten() bool

func (*Client) GetOneofClient

func (m *Client) GetOneofClient() isClient_OneofClient

func (*Client) GetSettings

func (x *Client) GetSettings() *Settings

func (*Client) GetSuggestId

func (x *Client) GetSuggestId() int64

func (*Client) GetWin

func (x *Client) GetWin() bool

func (*Client) ProtoMessage

func (*Client) ProtoMessage()

func (*Client) ProtoReflect

func (x *Client) ProtoReflect() protoreflect.Message

func (*Client) Reset

func (x *Client) Reset()

func (*Client) String

func (x *Client) String() string

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_Call struct {
	// Selected tiles.
	// Server will autodetect call type.
	Call *base.Instances `protobuf:"bytes,4,opt,name=call,proto3,oneof"`
}

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.

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 GameService_ConnectClient

type GameService_ConnectClient interface {
	Send(*Client) error
	Recv() (*Server, error)
	grpc.ClientStream
}

type GameService_ConnectServer

type GameService_ConnectServer interface {
	Send(*Server) error
	Recv() (*Client, error)
	grpc.ServerStream
}

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) Descriptor() ([]byte, []int)

Deprecated: Use Server.ProtoReflect.Descriptor instead.

func (*Server) GetChanges

func (x *Server) GetChanges() *log.ScoreChangesEvent

func (*Server) GetDeclare

func (x *Server) GetDeclare() *log.DeclareEvent

func (*Server) GetDraw

func (x *Server) GetDraw() *log.DrawEvent

func (*Server) GetDrop

func (x *Server) GetDrop() *log.DropEvent

func (*Server) GetFuriten

func (x *Server) GetFuriten() log.Furiten

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 (x *Server) GetRoundStart() *log.RoundInfo

func (*Server) GetSay

func (x *Server) GetSay() *log.SayEvent

func (*Server) GetSettings

func (x *Server) GetSettings() *Settings

func (*Server) GetSuggest

func (x *Server) GetSuggest() *Suggest

func (*Server) GetTake

func (x *Server) GetTake() *log.TakeEvent

func (*Server) GetWin

func (x *Server) GetWin() *log.WinEvent

func (*Server) ProtoMessage

func (*Server) ProtoMessage()

func (*Server) ProtoReflect

func (x *Server) ProtoReflect() protoreflect.Message

func (*Server) Reset

func (x *Server) Reset()

func (*Server) String

func (x *Server) String() string

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_Draw struct {
	Draw *log.DrawEvent `protobuf:"bytes,9,opt,name=draw,proto3,oneof"`
}

type Server_Drop

type Server_Drop struct {
	Drop *log.DropEvent `protobuf:"bytes,4,opt,name=drop,proto3,oneof"`
}

type Server_Furiten

type Server_Furiten struct {
	Furiten log.Furiten `protobuf:"varint,14,opt,name=furiten,proto3,enum=mahjong.log.Furiten,oneof"`
}

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_RoundStart struct {
	// Round info could contain information about only one or more hands (some training mode)
	RoundStart *log.RoundInfo `protobuf:"bytes,11,opt,name=round_start,json=roundStart,proto3,oneof"`
}

type Server_Say

type Server_Say struct {
	Say *log.SayEvent `protobuf:"bytes,6,opt,name=say,proto3,oneof"`
}

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_Take struct {
	// Take could contain information about others taken tiles in some training mode
	Take *log.TakeEvent `protobuf:"bytes,3,opt,name=take,proto3,oneof"`
}

type Server_Win

type Server_Win struct {
	Win *log.WinEvent `protobuf:"bytes,8,opt,name=win,proto3,oneof"`
}

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) Descriptor() ([]byte, []int)

Deprecated: Use Settings.ProtoReflect.Descriptor instead.

func (*Settings) GetAutoEndGame

func (x *Settings) GetAutoEndGame() bool

func (*Settings) GetAutoTempai

func (x *Settings) GetAutoTempai() bool

func (*Settings) GetAutoWin

func (x *Settings) GetAutoWin() bool

func (*Settings) GetDropTsumo

func (x *Settings) GetDropTsumo() bool

func (*Settings) GetNoDeclare

func (x *Settings) GetNoDeclare() bool

func (*Settings) ProtoMessage

func (*Settings) ProtoMessage()

func (*Settings) ProtoReflect

func (x *Settings) ProtoReflect() protoreflect.Message

func (*Settings) Reset

func (x *Settings) Reset()

func (*Settings) String

func (x *Settings) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Suggest.ProtoReflect.Descriptor instead.

func (*Suggest) GetCanceled

func (x *Suggest) GetCanceled() bool

func (*Suggest) GetChiCenter

func (x *Suggest) GetChiCenter() bool

func (*Suggest) GetChiLeft

func (x *Suggest) GetChiLeft() bool

func (*Suggest) GetChiRight

func (x *Suggest) GetChiRight() bool

func (*Suggest) GetClosedKanMask

func (x *Suggest) GetClosedKanMask() int64

func (*Suggest) GetContinueGame

func (x *Suggest) GetContinueGame() bool

func (*Suggest) GetDraw

func (x *Suggest) GetDraw() bool

func (*Suggest) GetDropMask

func (x *Suggest) GetDropMask() int64

func (*Suggest) GetKan

func (x *Suggest) GetKan() bool

func (*Suggest) GetNoten

func (x *Suggest) GetNoten() bool

func (*Suggest) GetPon

func (x *Suggest) GetPon() bool

func (*Suggest) GetRiichiMask

func (x *Suggest) GetRiichiMask() int64

func (*Suggest) GetSuggestId

func (x *Suggest) GetSuggestId() int64

func (*Suggest) GetTimeout

func (x *Suggest) GetTimeout() *duration.Duration

func (*Suggest) GetUpgradeInstances

func (x *Suggest) GetUpgradeInstances() *base.Instances

func (*Suggest) GetWin

func (x *Suggest) GetWin() bool

func (*Suggest) ProtoMessage

func (*Suggest) ProtoMessage()

func (*Suggest) ProtoReflect

func (x *Suggest) ProtoReflect() protoreflect.Message

func (*Suggest) Reset

func (x *Suggest) Reset()

func (*Suggest) String

func (x *Suggest) String() string

type UnimplementedGameServiceServer

type UnimplementedGameServiceServer struct {
}

UnimplementedGameServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedGameServiceServer) Connect

Jump to

Keyboard shortcuts

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