quizconfig

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QoS = 1

	BrokerUrl = "mqtt://broker.hivemq.com:1883"

	QuestionTopic = topicBase + "/sWnLDrZuuEQMrRYRrEJH09p9JVWoI4LM"
	ClientTopic   = topicBase + "/hTrun1EOZXxcVZpfPsvVU0FI11iqCAZE"

	MaxDatagramSize  = 8192
	MultiCastAddress = "239.192.0.10:1555"

	WaitTime = 3 * time.Second
)

Variables

This section is empty.

Functions

func GetMetaObject

func GetMetaObject[T any](fsm *fsm.FSM, key string) *T

Types

type Action_t

type Action_t uint8
const (
	ActionUndefined Action_t = iota
	ActionHello
	ActionReHello
	ActionStart
	ActionQuestion
	ActionAnswer
	ActionAnswered
	ActionDone
	ActionNoop
)

func (Action_t) String

func (a Action_t) String() string

type Answer_t

type Answer_t uint8
const (
	AnswerUndefined Answer_t = iota
	AnswerCorrect
	AnswerWrong
	AnswerTooLate
)

type ClientData_t

type ClientData_t struct {
	Action                              Action_t
	Question                            *testparts.GormQuestion
	QuestionTime                        time.Duration
	QuestionNum, Name, UUID, AvatarName string
	Scores                              []*Client_t
	Color                               color.RGBA
	QuestionID                          uint
	Correct                             bool
}

type Client_t

type Client_t struct {
	Name, UUID, AvatarName string
	Score                  uint
	Color                  color.RGBA
}

type Gui_t

type Gui_t struct {
	MyApp                     fyne.App
	MyWindow                  fyne.Window
	HeaderLeft                *fyne.Container
	QuestionCountdown         *widget.ProgressBar
	Scores                    *fyne.Container
	FullWindow, CenterContent *fyne.Container
	Text                      map[string]*canvas.Text
	HeaderRight               *canvas.Text
	StatusModel               *progressmodel.ProgressModel
	AnswerButton              *widget.Button
	ExitButton                *widget.Button
	Avatar                    *canvas.Image
	ClockTicker               *testparts.Ticker
}

func (*Gui_t) AddText

func (gui *Gui_t) AddText(name string, size float32, clr color.Color,
	align fyne.TextAlign)

type Logger

type Logger struct {
	Prefix string
}

logger implements the paho.Logger interface

func (Logger) Printf

func (l Logger) Printf(format string, v ...interface{})

Printf is the library provided NOOPLogger's implementation of the required interface function(){}

func (Logger) Println

func (l Logger) Println(v ...interface{})

Println is the library provided NOOPLogger's implementation of the required interface function()

type QuizTheme

type QuizTheme struct{}

func (QuizTheme) AddColor added in v0.1.21

func (m QuizTheme) AddColor(name fyne.ThemeColorName, color color.Color)

func (QuizTheme) AddSize added in v0.1.21

func (m QuizTheme) AddSize(name fyne.ThemeSizeName, size float32)

func (QuizTheme) Color

func (m QuizTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color

func (QuizTheme) Font

func (m QuizTheme) Font(style fyne.TextStyle) fyne.Resource

func (QuizTheme) Icon

func (m QuizTheme) Icon(name fyne.ThemeIconName) fyne.Resource

func (QuizTheme) Size

func (m QuizTheme) Size(name fyne.ThemeSizeName) float32

type Result_t

type Result_t struct {
	Text, Feedback string
	Icon           *canvas.Image
}

type State_t

type State_t struct {
	Transport              Transport_t
	Class                  *testparts.GormClass
	ClientWait             *sync.WaitGroup
	ClientList             *linkedhashmap.Map[string, *Client_t]
	RecvChan, ActionChan   chan *ClientData_t
	QuestionChan           chan *testparts.GormQuestion
	Name, UUID, AvatarName string
	Color                  color.Color
	Result                 map[Answer_t]*Result_t
	Player                 *oto.Player
	AiModel                aiclient.AiModel
	Flags                  map[string]bool
}

type TransportMQTT_t

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

func NewMQTT

func NewMQTT(topicHandler func(*paho.Publish)) (*TransportMQTT_t, error)

func (*TransportMQTT_t) Send

func (m *TransportMQTT_t) Send(data *ClientData_t, topic string) error

func (*TransportMQTT_t) SendNoop

func (m *TransportMQTT_t) SendNoop() error

func (*TransportMQTT_t) ShutDown

func (m *TransportMQTT_t) ShutDown()

type TransportMulticast_t

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

func NewMultiCast

func NewMultiCast(recvChan chan<- *ClientData_t) (*TransportMulticast_t, error)

func (*TransportMulticast_t) Send

func (m *TransportMulticast_t) Send(data *ClientData_t, topic string) error

func (*TransportMulticast_t) SendNoop

func (m *TransportMulticast_t) SendNoop() error

func (*TransportMulticast_t) ShutDown

func (m *TransportMulticast_t) ShutDown()

type Transport_t

type Transport_t interface {
	Send(data *ClientData_t, topic string) error
	SendNoop() error
	ShutDown()
}

Jump to

Keyboard shortcuts

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