process
This commit is contained in:
parent
57cf56234a
commit
d132e4a6be
28
fakeGames.go
Normal file
28
fakeGames.go
Normal file
@ -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}
|
79
utils.go
79
utils.go
@ -2,18 +2,30 @@ package skirdaGoUtils
|
||||
|
||||
type Game struct {
|
||||
GameId string
|
||||
Title string
|
||||
GameType 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",
|
||||
// },
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user