43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
|
package main
|
||
|
|
||
|
type GameView struct {
|
||
|
Board *Board `json:"board"`
|
||
|
Player *Player `json:"player"`
|
||
|
Deck *Deck `json:"deck"`
|
||
|
EnemyDeckSize int `json:"enemy_deck_size"`
|
||
|
EnemyHandSize int `json:"enemy_hand_size"`
|
||
|
CurrentTurn int `json:"current_turn"`
|
||
|
CanDraw bool `json:"can_draw"`
|
||
|
HasDrawn bool `json:"has_drawn"`
|
||
|
Status GameStatus `json:"game_status"`
|
||
|
}
|
||
|
|
||
|
func NewView(id int, g *Game) *GameView {
|
||
|
if id == SentinalID {
|
||
|
return &GameView{
|
||
|
Board: g.GameBoard,
|
||
|
Player: g.SentinalPlayer,
|
||
|
Deck: g.SentinalDeck,
|
||
|
EnemyDeckSize: g.ScourgeDeck.Size(),
|
||
|
EnemyHandSize: len(g.ScourgePlayer.Hand),
|
||
|
CurrentTurn: g.CurrentTurn,
|
||
|
CanDraw: g.CanDraw,
|
||
|
HasDrawn: g.HasDrawn,
|
||
|
Status: g.Status,
|
||
|
}
|
||
|
} else {
|
||
|
return &GameView{
|
||
|
Board: g.GameBoard,
|
||
|
Player: g.ScourgePlayer,
|
||
|
Deck: g.ScourgeDeck,
|
||
|
EnemyDeckSize: g.SentinalDeck.Size(),
|
||
|
EnemyHandSize: len(g.SentinalPlayer.Hand),
|
||
|
CurrentTurn: g.CurrentTurn,
|
||
|
CanDraw: g.CanDraw,
|
||
|
HasDrawn: g.HasDrawn,
|
||
|
Status: g.Status,
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|