game

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsteroidGreetData

func AsteroidGreetData() (result asteroid.Greet)

func CalculateRoundScore

func CalculateRoundScore(round int)

CalculateRoundScore will calculate the score of the given round.

func CheckDown

func CheckDown(c *gin.Context) (int, interface{})

CheckDown is the gamebox check down handler for bots.

func CleanGameBoxStatus

func CleanGameBoxStatus()

func DeleteChallenge

func DeleteChallenge(c *gin.Context) (int, interface{})

DeleteChallenge is delete challenge handler for manager.

func DeleteGameBox

func DeleteGameBox(c *gin.Context) (int, interface{})

DeleteGameBox deletes the game box for manager.

func EditChallenge

func EditChallenge(c *gin.Context) (int, interface{})

EditChallenge is edit challenge handler for manager.

func EditGameBox

func EditGameBox(c *gin.Context) (int, interface{})

EditGameBox is edit gamebox handler for manager.

func ExportFlag

func ExportFlag(c *gin.Context) (int, interface{})

ExportFlag exports the flags of a challenge.

func GenerateFlag

func GenerateFlag(c *gin.Context) (int, interface{})

GenerateFlag is the generate flag handler for manager.

func GetAllChallenges

func GetAllChallenges(c *gin.Context) (int, interface{})

GetAllChallenges get all challenges from the database.

func GetFlags

func GetFlags(c *gin.Context) (int, interface{})

GetFlags get flags from the database for backstage manager.

func GetGameBoxes

func GetGameBoxes(c *gin.Context) (int, interface{})

GetGameBoxes returns the gameboxes for manager.

func GetLatestScoreRound

func GetLatestScoreRound() int

func GetOthersGameBox

func GetOthersGameBox(c *gin.Context) (int, interface{})

GetOthersGameBox returns the other teams' gameboxes if the config is set to true.

func GetRankListTitle

func GetRankListTitle() []string

GetRankListTitle returns the ranking list table header from the cache.

func GetSelfGameBoxes

func GetSelfGameBoxes(c *gin.Context) (int, interface{})

GetSelfGameBoxes returns the gameboxes which belong to the team.

func NewChallenge

func NewChallenge(c *gin.Context) (int, interface{})

NewChallenge is new challenge handler for manager.

func NewGameBoxes

func NewGameBoxes(c *gin.Context) (int, interface{})

NewGameBoxes is add a new gamebox handler for manager.

func RefreshFlag

func RefreshFlag()

RefreshFlag refreshes all the flags in current round.

func ResetAllGameBoxes

func ResetAllGameBoxes(c *gin.Context) (int, interface{})

func SetRankList

func SetRankList()

SetRankList will calculate the ranking list.

func SetRankListTitle

func SetRankListTitle()

SetRankListTitle will save the visible challenges' headers into cache.

func SetVisible

func SetVisible(c *gin.Context) (int, interface{})

SetVisible is setting challenge visible status handler. When a challenge's visible status changed, all the teams' challenge scores and their total scores will be calculated immediately. The ranking list will also be updated.

func SubmitFlag

func SubmitFlag(c *gin.Context) (int, interface{})

SubmitFlag is submit flag handler for teams.

func TestAllSSH

func TestAllSSH(c *gin.Context) (int, interface{})

func TestSSH

func TestSSH(c *gin.Context) (int, interface{})

Types

type GameBoxInfo

type GameBoxInfo struct {
	Score      float64
	IsAttacked bool
	IsDown     bool
}

GameBoxInfo contains the gamebox info which for manager. Manager can get the gamebox's score.

type GameBoxStatus

type GameBoxStatus struct {
	IsAttacked bool
	IsDown     bool
}

GameBoxStatus contains the gamebox info which for team.

type RankItem

type RankItem struct {
	TeamID        uint
	TeamName      string
	Score         float64
	GameBoxStatus interface{} // Ordered by challenge ID.
}

RankItem is used to create the ranking list.

func GetManagerRankList

func GetManagerRankList() []*RankItem

GetManagerRankList returns the ranking list data for manager from the cache.

func GetRankList

func GetRankList() []*RankItem

GetRankList returns the ranking list data for team from the cache.

Jump to

Keyboard shortcuts

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