Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AnswerView = common.ParseTmplWithFuncs("templates/views/answer-view.html")
View Source
var ChooseUsernameView = common.ParseTmplWithFuncs("templates/views/choose-username-view.html")
Views are the templates that are rendered for the different states of the lobby All of them require ViewData as the data to render
View Source
var LobbiesTmpl = tmplParseWithBase("templates/lobbies/lobbies.html")
View Source
var LobbyErrorAlertTmpl = LobbyTmpl.Lookup("error-alert")
View Source
var LobbySettingsTmpl = WaitingRoomView.Lookup("lobby-settings")
This template is used to render the lobby settings inside waitingRoomView
View Source
var LobbyTmpl = tmplParseWithBase("templates/lobbies/lobby.html")
View Source
var QuestionView = common.ParseTmplWithFuncs("templates/views/question-view.html")
View Source
var WaitingRoomView = common.ParseTmplWithFuncs("templates/views/waiting-room-view.html")
Functions ¶
func NewCancellableTimer ¶
func NewLobbiesRouter ¶
Returns a handler for routes starting with /lobbies
Types ¶
type ByScore ¶
type ByScore []*User
ByScore implements sort.Interface for []*user based on the Score field User for calculating leaderboard
type Lobby ¶
type Lobby struct { CreatedAt time.Time StartedAt time.Time FinishedAt time.Time Quiz models.Quiz Host *User Pin string TimePerQuestion time.Duration // Time for players to answer a question TimeForReading time.Duration // Time to read the question before answering is allowed Players map[ClientID]*User State LobbyState CurrentQuestionStartTime time.Time CurrentQuestionTimeout time.Time ReadingTimeout time.Time CurrentQuestionIdx int CurrentQuestion *models.Question PlayersAnswering int // Number of players who haven't submitted an answer Leaderboard []*User // Players sorted by score // contains filtered or unexported fields }
Lobby is a actively running game session
type LobbySettingsData ¶
type LobbySettingsData struct { Quizzes []models.QuizMetadata Lobby *Lobby }
type LobbyState ¶
type LobbyState int
const ( LsWaitingForPlayers LobbyState = iota LsQuestion LsAnswer )
func (LobbyState) View ¶
func (state LobbyState) View() *template.Template
View returns the view template for the given state
type OnFinishData ¶
Click to show internal directories.
Click to hide internal directories.