34 lines
496 B
Go
34 lines
496 B
Go
package global
|
|
|
|
import "sync"
|
|
|
|
type RunGameInfo struct {
|
|
Uuid string
|
|
Type TyGameType
|
|
Obj any
|
|
}
|
|
|
|
var RunGames = make(map[string]*RunGameInfo)
|
|
var lock = sync.Mutex{}
|
|
|
|
func GetGameInfo(uuid string) *RunGameInfo {
|
|
return RunGames[uuid]
|
|
}
|
|
func CreateGame(game *RunGameInfo) {
|
|
lock.Lock()
|
|
defer lock.Unlock()
|
|
RunGames[game.Uuid] = game
|
|
}
|
|
|
|
func DeleteGame(uuid string) {
|
|
lock.Lock()
|
|
defer lock.Unlock()
|
|
delete(RunGames, uuid)
|
|
}
|
|
|
|
type TyGameType = int
|
|
|
|
const (
|
|
GameType1 TyGameType = iota
|
|
)
|