From d132e4a6bee16b35a467e0265a6f30202933a2d1 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Tue, 25 Oct 2022 23:07:25 +0300 Subject: [PATCH] process --- fakeGames.go | 28 ++++++++++++++++++ go.mod | 3 -- utils.go | 81 ++++++++++++++++++++++++++-------------------------- 3 files changed, 69 insertions(+), 43 deletions(-) create mode 100644 fakeGames.go delete mode 100644 go.mod diff --git a/fakeGames.go b/fakeGames.go new file mode 100644 index 0000000..dc28e24 --- /dev/null +++ b/fakeGames.go @@ -0,0 +1,28 @@ +package skirdaGoUtils + +var garrysmodGame = Game{ + GameId: "garrysmod", + SteamId: "", + Executable: "", + Args: []string{"steam://rungameid/4000"}, + Platforms: map[string]bool{"linux": true}, + Assets: GameInterfaceAssets{ + Title: "Garry's Mod", + Image: "gmod.png", + Description: "", + }, +} + +var openarena = Game{ + GameId: "openarena", + SteamId: "", + Executable: "/usr/games/openarena", + Args: []string{}, + Assets: GameInterfaceAssets{ + Title: "Open Arena", + Image: "openarena.jpg", + Description: "asdadasd", + }, +} + +var FakeGamesList = []Game{garrysmodGame, openarena} diff --git a/go.mod b/go.mod deleted file mode 100644 index 50791df..0000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module git.gregbrzezinski.com/Skirda/skirdaGoUtils - -go 1.18 diff --git a/utils.go b/utils.go index 3080ee9..1d3bf62 100644 --- a/utils.go +++ b/utils.go @@ -1,19 +1,31 @@ package skirdaGoUtils type Game struct { - GameId string - Title string - GameType string + GameId string + SteamId string + //GameType string Executable string Args []string Assets GameInterfaceAssets + Platforms map[string]bool } type GameInterfaceAssets struct { + Title string Image string Description string } +type JSGameInterface struct { + Id int `json:"id"` + GameID string `json:"gameId"` + Title string `json:"title"` + Image string `json:"image"` + Description string `json:"description"` +} + +var GamesList = []Game{garrysmodGame, openarena} + func GetGamesListInterface() []JSGameInterface { var gamesInterfacesList = []JSGameInterface{} for _, Game := range GamesList { @@ -24,38 +36,11 @@ func GetGamesListInterface() []JSGameInterface { return gamesInterfacesList } -var GamesList = []Game{garrysmodGame, openarena} - -var garrysmodGame = Game{ - Id: 0, - GameId: "garrysmod", - GameType: "steam", - Title: "Garry's Mod", - Executable: "steam", - Args: []string{"steam://rungameid/4000"}, - Assets: GameInterfaceAssets{ - Image: "gmod.png", - Description: "", - }, -} - -var openarena = Game{ - GameId: "openarena", - GameType: "file", - Title: "Open Arena", - Executable: "/usr/games/openarena", - Args: []string{}, - Assets: GameInterfaceAssets{ - Image: "openarena.jpg", - Description: "asdadasd", - }, -} - func GetJSGameInterface(game Game) JSGameInterface { newInterface := JSGameInterface{ - Id: game.Id, + //Id: game.Id, GameID: game.GameId, - Title: game.Title, + Title: game.Assets.Title, Image: game.Assets.Image, Description: game.Assets.Description, } @@ -63,14 +48,6 @@ func GetJSGameInterface(game Game) JSGameInterface { return newInterface } -type JSGameInterface struct { - Id int `json:"id"` - GameID string `json:"gameId"` - Title string `json:"title"` - Image string `json:"image"` - Description string `json:"description"` -} - func findGameByID(id string) Game { for _, game := range GamesList { if game.GameId == id { @@ -80,3 +57,27 @@ func findGameByID(id string) Game { var temp Game = Game{} return temp } + +// var garrysmodGame = Game{ +// GameId: "garrysmod", +// GameType: "steam", +// Title: "Garry's Mod", +// Executable: "steam", +// Args: []string{"steam://rungameid/4000"}, +// Assets: GameInterfaceAssets{ +// Image: "gmod.png", +// Description: "", +// }, +// } + +// var openarena = Game{ +// GameId: "openarena", +// GameType: "file", +// Title: "Open Arena", +// Executable: "/usr/games/openarena", +// Args: []string{}, +// Assets: GameInterfaceAssets{ +// Image: "openarena.jpg", +// Description: "asdadasd", +// }, +// }