room

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMessage

type ChatMessage struct {
	Nickname string
	Message  string
	// contains filtered or unexported fields
}

type Lobby

type Lobby struct {
	actor.Base[LobbyEvent]
	// contains filtered or unexported fields
}

func NewLobby

func NewLobby(ctx context.Context, log zerolog.Logger, accounts *accounts.Service, configProvider gameconfig.Provider) *Lobby

func (*Lobby) GetRoom

func (l *Lobby) GetRoom(ctx context.Context, roomNumber int16) *Room

func (*Lobby) NewRoom

func (l *Lobby) NewRoom(ctx context.Context, room gamemodel.RoomState) (*Room, error)

type LobbyEvent

type LobbyEvent interface {
	// contains filtered or unexported methods
}

type LobbyPlayer

type LobbyPlayer struct {
	Entry  gamemodel.LobbyPlayer
	Conn   *gamepacket.ServerConn
	Joined time.Time
}

type LobbyPlayerJoin

type LobbyPlayerJoin struct {
	Entry gamemodel.LobbyPlayer
	Conn  *gamepacket.ServerConn
	// contains filtered or unexported fields
}

type LobbyPlayerLeave

type LobbyPlayerLeave struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type LobbyPlayerUpdate

type LobbyPlayerUpdate struct {
	Entry gamemodel.LobbyPlayer
	// contains filtered or unexported fields
}

type LobbyPlayerUpdateRoom

type LobbyPlayerUpdateRoom struct {
	ConnID     uint32
	RoomNumber int16
	// contains filtered or unexported fields
}

type LobbyRoomCreate

type LobbyRoomCreate struct {
	Room gamemodel.RoomState
	// contains filtered or unexported fields
}

type LobbyRoomRemove

type LobbyRoomRemove struct {
	Room gamemodel.RoomState
	// contains filtered or unexported fields
}

type LobbyRoomUpdate

type LobbyRoomUpdate struct {
	Room gamemodel.RoomState
	// contains filtered or unexported fields
}

type Room

type Room struct {
	actor.Base[RoomEvent]
	// contains filtered or unexported fields
}

func (*Room) GetRoomInfo

func (r *Room) GetRoomInfo(ctx context.Context) (gamemodel.RoomInfo, error)

func (*Room) Number

func (r *Room) Number() int16

func (*Room) Start

func (r *Room) Start(ctx context.Context, state gamemodel.RoomState, lobby *Lobby, accounts *accounts.Service) bool

type RoomAction

type RoomAction struct {
	ConnID uint32
	Action gamemodel.RoomAction
	// contains filtered or unexported fields
}

type RoomEntry

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

type RoomEvent

type RoomEvent interface {
	// contains filtered or unexported methods
}

type RoomGameHoleEnd

type RoomGameHoleEnd struct {
	ConnID uint32
	Stats  pangya.PlayerStats
	// contains filtered or unexported fields
}

type RoomGameHoleInfo added in v0.0.3

type RoomGameHoleInfo struct {
	Par  uint8
	TeeX float32
	TeeZ float32
	PinX float32
	PinZ float32
	// contains filtered or unexported fields
}

type RoomGameReady

type RoomGameReady struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type RoomGameShotClubChange

type RoomGameShotClubChange struct {
	ConnID uint32
	Club   uint8
	// contains filtered or unexported fields
}

type RoomGameShotCometRelief

type RoomGameShotCometRelief struct {
	ConnID  uint32
	X, Y, Z float32
	// contains filtered or unexported fields
}

type RoomGameShotCommit

type RoomGameShotCommit struct {
	ConnID           uint32
	ShotStrength     float32
	ShotAccuracy     float32
	ShotEnglishCurve float32
	ShotEnglishSpin  float32
	Unknown2         [30]byte
	Unknown3         [4]float32
	// contains filtered or unexported fields
}

type RoomGameShotItemUse

type RoomGameShotItemUse struct {
	ConnID     uint32
	ItemTypeID uint32
	// contains filtered or unexported fields
}

type RoomGameShotPower

type RoomGameShotPower struct {
	ConnID uint32
	Level  uint8
	// contains filtered or unexported fields
}

type RoomGameShotRotate

type RoomGameShotRotate struct {
	ConnID uint32
	Angle  float32
	// contains filtered or unexported fields
}

type RoomGameShotSync

type RoomGameShotSync struct {
	ConnID uint32
	Data   gamemodel.ShotSyncData
	// contains filtered or unexported fields
}

type RoomGameTurn

type RoomGameTurn struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type RoomGameTurnEnd

type RoomGameTurnEnd struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type RoomGameTypingIndicator

type RoomGameTypingIndicator struct {
	ConnID uint32
	Status int16
	// contains filtered or unexported fields
}

type RoomGetInfo

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

type RoomHeap

type RoomHeap []*RoomEntry

RoomHeap implements a heap.Interface for the room list. It provides a min heap such that the lowest-numbered inactive room will be at the lowest index.

func (RoomHeap) Len

func (h RoomHeap) Len() int

func (RoomHeap) Less

func (h RoomHeap) Less(i, j int) bool

func (*RoomHeap) Pop

func (h *RoomHeap) Pop() any

func (*RoomHeap) Push

func (h *RoomHeap) Push(x any)

func (RoomHeap) Swap

func (h RoomHeap) Swap(i, j int)

type RoomLoadingProgress

type RoomLoadingProgress struct {
	ConnID   uint32
	Progress uint8
	// contains filtered or unexported fields
}

type RoomPlayer

type RoomPlayer struct {
	Entry      *gamemodel.RoomPlayerEntry
	Conn       *gamepacket.ServerConn
	PlayerData pangya.PlayerData
	UpdateFunc func()
	GameReady  bool
	ShotSync   *gamemodel.ShotSyncData
	TurnEnd    bool
	HoleEnd    bool
	GameEnd    bool
	StartShot  bool
	Pang       uint64
	BonusPang  uint64
	LastTotal  int8
	Stroke     int8
	Score      int32
	TurnOrder  int
	Distance   float64
}

type RoomPlayerIdle

type RoomPlayerIdle struct {
	ConnID uint32
	Idle   bool
	// contains filtered or unexported fields
}

type RoomPlayerJoin

type RoomPlayerJoin struct {
	Entry      *gamemodel.RoomPlayerEntry
	PlayerData pangya.PlayerData
	Conn       *gamepacket.ServerConn
	UpdateFunc func()
	// contains filtered or unexported fields
}

type RoomPlayerKick

type RoomPlayerKick struct {
	ConnID     uint32
	KickConnID uint32
	// contains filtered or unexported fields
}

type RoomPlayerLeave

type RoomPlayerLeave struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type RoomPlayerReady

type RoomPlayerReady struct {
	ConnID uint32
	Ready  bool
	// contains filtered or unexported fields
}

type RoomPlayerUpdateData added in v0.0.3

type RoomPlayerUpdateData struct {
	ConnID     uint32
	Entry      *gamemodel.RoomPlayerEntry
	PlayerData pangya.PlayerData
	// contains filtered or unexported fields
}

type RoomSettingsChange

type RoomSettingsChange struct {
	ConnID  uint32
	Changes []gamemodel.RoomSettingsChange
	// contains filtered or unexported fields
}

type RoomStartGame

type RoomStartGame struct {
	ConnID uint32
	// contains filtered or unexported fields
}

type Storage

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

func (*Storage) GetRoom

func (m *Storage) GetRoom(ctx context.Context, roomNumber int16) *Room

GetRoom gets a room by ID. This can be called from any thread.

func (*Storage) GetRoomList

func (m *Storage) GetRoomList() []*Room

GetRoomList returns a full list of rooms.

func (*Storage) NewRoom

func (m *Storage) NewRoom(ctx context.Context, log zerolog.Logger) *Room

NewRoom returns a new room.

func (*Storage) UpdateRoom

func (m *Storage) UpdateRoom(ctx context.Context, state gamemodel.RoomState) error

UpdateRoom updates the room state for a given room.

Jump to

Keyboard shortcuts

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