28 lines
375 B
Go
28 lines
375 B
Go
package types
|
|
|
|
import "fmt"
|
|
|
|
type RoomStatus int
|
|
|
|
const (
|
|
RoomStatusWaiting RoomStatus = iota
|
|
RoomStatusPlaying
|
|
RoomStatusEnded
|
|
)
|
|
|
|
var (
|
|
RoomStatusStr = []string{"Waiting", "Playing", "Ended"}
|
|
)
|
|
|
|
type Room struct {
|
|
Creater string
|
|
Status RoomStatus
|
|
}
|
|
|
|
func (self Room) View() string {
|
|
return fmt.Sprintf("%10s [%s]",
|
|
self.Creater,
|
|
RoomStatusStr[self.Status],
|
|
)
|
|
}
|