From fff1b58ee288a434b6d5fd88767916d5ab3e25b2 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 27 Oct 2022 21:05:45 +0300 Subject: [PATCH] refactoring --- game/gameTypes.go | 26 ++++++++++++++++++++++++++ game/gameUtils.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 game/gameTypes.go create mode 100644 game/gameUtils.go diff --git a/game/gameTypes.go b/game/gameTypes.go new file mode 100644 index 0000000..4fdfe61 --- /dev/null +++ b/game/gameTypes.go @@ -0,0 +1,26 @@ +package game + +type SteamGame struct { + GameId string + SteamId string + Args []string + Assets GameInterfaceAssets + Platforms map[string]bool +} + +type GameInterfaceAssets struct { + Title string + Image string + Description string +} + +type Games struct { + SteamGames []SteamGame +} + +type JSGameInterface struct { + GameID string `json:"gameId"` + Title string `json:"title"` + Image string `json:"image"` + Description string `json:"description"` +} diff --git a/game/gameUtils.go b/game/gameUtils.go new file mode 100644 index 0000000..e50e182 --- /dev/null +++ b/game/gameUtils.go @@ -0,0 +1,33 @@ +package game + +// func findGameByID(id string) SteamGame { +// for _, game := range GamesList { +// if game.GameId == id { +// return game +// } +// } +// var temp SteamGame = SteamGame{} +// return temp +// } + +// func findSteamGameByID(id string) SteamGame { +// for _, game := range localGames.St { +// if game.GameId == id { +// return game +// } +// } +// var game SteamGame = SteamGame{} +// return game +// } + +func FindGameByID() {} + +func GetJSGameInterface(game SteamGame) JSGameInterface { + newInterface := JSGameInterface{ + GameID: game.GameId, + Title: game.Assets.Title, + Image: game.Assets.Image, + Description: game.Assets.Description, + } + return newInterface +}