网络游戏初步接入
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user