common

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VoteOpen = iota
	VoteClosed
)
View Source
const (
	CommandQuit      = "q"
	CommandNotVoting = "n"
	CommandStartVote = "s"
	CommandCloseVote = "v"
	CommandVote1     = "1"
	CommandVote2     = "2"
	CommandVote3     = "3"
	CommandVote5     = "5"
	CommandVote8     = "8"
	CommandVote13    = "d"
	CommandVote21    = "m"
)

commands and associated keyboard shortcuts

View Source
const (
	VoteReceived    = "r"
	VoteNotReceived = ""
	VoteHidden      = "-"
)

vote status

Variables

This section is empty.

Functions

This section is empty.

Types

type Participant

type Participant struct {
	Id                uuid.UUID         `json:"id"`
	Name              string            `json:"name"`
	Vote              string            `json:"vote"`
	AvailableCommands map[string]string `json:"available_commands"`
	LastCommand       string            `json:"last_command"`
}

func CreateVoter

func CreateVoter(voterName string) *Participant

func (*Participant) UpdateLocalPlayerFromServer

func (localVoter *Participant) UpdateLocalPlayerFromServer(roomFromServer *Room)

for local participant apply server updates to keep display up to date

type Room

type Room struct {
	RoomStatus RoomVoteStatus `json:"roomStatus"`
	Voters     []*Participant `json:"voters"`
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom() *Room

func (*Room) CloseVote

func (room *Room) CloseVote()

closing vote

func (Room) DisplayVotersStatus

func (room Room) DisplayVotersStatus() []string

func (Room) FilterVoteData

func (room Room) FilterVoteData(voterId uuid.UUID) *Room

hide votes if the vote is not closed

func (Room) NbVotesReceived

func (room Room) NbVotesReceived() int

func (*Room) OpenVote

func (room *Room) OpenVote()

prepare room for new vote

func (Room) TurnFinishedCommands

func (room Room) TurnFinishedCommands() map[string]string

func (Room) TurnStartedCommands

func (room Room) TurnStartedCommands() map[string]string

func (*Room) UpdateFromHub

func (room *Room) UpdateFromHub()

func (*Room) UpdateFromParticipant

func (room *Room) UpdateFromParticipant(voterReceived Participant)

func (Room) VoteCommands

func (room Room) VoteCommands() map[string]string

type RoomVoteStatus

type RoomVoteStatus int

Directories

Path Synopsis
logger shared between files of the package groom
logger shared between files of the package groom

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳