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}
|
81
utils.go
81
utils.go
@ -1,19 +1,31 @@
|
|||||||
package skirdaGoUtils
|
package skirdaGoUtils
|
||||||
|
|
||||||
type Game struct {
|
type Game struct {
|
||||||
GameId string
|
GameId string
|
||||||
Title string
|
SteamId string
|
||||||
GameType string
|
//GameType string
|
||||||
Executable string
|
Executable string
|
||||||
Args []string
|
Args []string
|
||||||
Assets GameInterfaceAssets
|
Assets GameInterfaceAssets
|
||||||
|
Platforms map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type GameInterfaceAssets struct {
|
type GameInterfaceAssets struct {
|
||||||
|
Title string
|
||||||
Image string
|
Image string
|
||||||
Description 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 {
|
func GetGamesListInterface() []JSGameInterface {
|
||||||
var gamesInterfacesList = []JSGameInterface{}
|
var gamesInterfacesList = []JSGameInterface{}
|
||||||
for _, Game := range GamesList {
|
for _, Game := range GamesList {
|
||||||
@ -24,38 +36,11 @@ func GetGamesListInterface() []JSGameInterface {
|
|||||||
return gamesInterfacesList
|
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 {
|
func GetJSGameInterface(game Game) JSGameInterface {
|
||||||
newInterface := JSGameInterface{
|
newInterface := JSGameInterface{
|
||||||
Id: game.Id,
|
//Id: game.Id,
|
||||||
GameID: game.GameId,
|
GameID: game.GameId,
|
||||||
Title: game.Title,
|
Title: game.Assets.Title,
|
||||||
Image: game.Assets.Image,
|
Image: game.Assets.Image,
|
||||||
Description: game.Assets.Description,
|
Description: game.Assets.Description,
|
||||||
}
|
}
|
||||||
@ -63,14 +48,6 @@ func GetJSGameInterface(game Game) JSGameInterface {
|
|||||||
return newInterface
|
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 {
|
func findGameByID(id string) Game {
|
||||||
for _, game := range GamesList {
|
for _, game := range GamesList {
|
||||||
if game.GameId == id {
|
if game.GameId == id {
|
||||||
@ -80,3 +57,27 @@ func findGameByID(id string) Game {
|
|||||||
var temp Game = Game{}
|
var temp Game = Game{}
|
||||||
return temp
|
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