From 9234cc2edcc4364ba7e4c689fd61e6085d32615e Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:43:44 +0300 Subject: [PATCH] merge games into one package --- domain/domain.go | 11 +++++------ {games/minecraftgame => domain}/minecraftgame.go | 16 +++++++--------- {games/skirdagame => domain}/skirdagame.go | 2 +- {games/steamgame => domain}/steamgame.go | 16 ++++++---------- 4 files changed, 19 insertions(+), 26 deletions(-) rename {games/minecraftgame => domain}/minecraftgame.go (52%) rename {games/skirdagame => domain}/skirdagame.go (97%) rename {games/steamgame => domain}/steamgame.go (50%) diff --git a/domain/domain.go b/domain/domain.go index 995b6b5..a4ef745 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -3,17 +3,16 @@ package domain import ( "errors" - "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/skirdasession" ) type SkirdaDomain struct { DomainId string - skirdagame.SkirdaGames + SkirdaGames skirdasession.SkirdaSessions } -func (domain SkirdaDomain) BuildDomain(newGames []skirdagame.SkirdaGame, newSessions []skirdasession.SkirdaSession) { +func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []skirdasession.SkirdaSession) { domain.AddGames(newGames) domain.AddSessions(newSessions) } @@ -24,7 +23,7 @@ func (domains Domains) Set(newDomains []SkirdaDomain) { domains = append([]SkirdaDomain{}, newDomains...) } -func (domains Domains) FindGameByID(gameId string) (skirdagame.SkirdaGame, error) { +func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) { for _, domain := range domains { game, _ := domain.FindGameByID(gameId) if game.GetSkirdaGameId() == gameId { @@ -35,8 +34,8 @@ func (domains Domains) FindGameByID(gameId string) (skirdagame.SkirdaGame, error return nil, errors.New("") } -func (domains Domains) GetGames() skirdagame.SkirdaGames { - allGames := skirdagame.SkirdaGames{} +func (domains Domains) GetGames() SkirdaGames { + allGames := SkirdaGames{} for _, domain := range domains { allGames = append(allGames, domain.SkirdaGames...) } diff --git a/games/minecraftgame/minecraftgame.go b/domain/minecraftgame.go similarity index 52% rename from games/minecraftgame/minecraftgame.go rename to domain/minecraftgame.go index 76af011..a03cd92 100644 --- a/games/minecraftgame/minecraftgame.go +++ b/domain/minecraftgame.go @@ -1,12 +1,10 @@ -package minecraftgame +package domain -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" - -const gameType = "minecraft" +// const gameType = "minecraft" type MinecraftGame struct { SkirdaGameId string - Assets skirdagame.GameUIAssets + Assets GameUIAssets Versions []string } @@ -14,7 +12,7 @@ func (game MinecraftGame) GetSkirdaGameId() string { return game.SkirdaGameId } -func (game MinecraftGame) GetUIAssets() skirdagame.GameUIAssets { +func (game MinecraftGame) GetUIAssets() GameUIAssets { return game.Assets } @@ -23,11 +21,11 @@ func (game MinecraftGame) GetLaunchArgs() []string { } func (game MinecraftGame) GetType() string { - return gameType + return "minecraft" } -func (game MinecraftGame) GetArguments() skirdagame.Arguments { - return skirdagame.Arguments{} +func (game MinecraftGame) GetArguments() Arguments { + return Arguments{} } func (game MinecraftGame) GetVersions() []string { diff --git a/games/skirdagame/skirdagame.go b/domain/skirdagame.go similarity index 97% rename from games/skirdagame/skirdagame.go rename to domain/skirdagame.go index 2192604..4a66705 100644 --- a/games/skirdagame/skirdagame.go +++ b/domain/skirdagame.go @@ -1,4 +1,4 @@ -package skirdagame +package domain import "errors" diff --git a/games/steamgame/steamgame.go b/domain/steamgame.go similarity index 50% rename from games/steamgame/steamgame.go rename to domain/steamgame.go index df12489..225eea8 100644 --- a/games/steamgame/steamgame.go +++ b/domain/steamgame.go @@ -1,14 +1,10 @@ -package steamgame - -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" - -const gameType = "steam" +package domain type SteamGame struct { SkirdaGameId string SteamId string - Assets skirdagame.GameUIAssets - Arguments skirdagame.Arguments + Assets GameUIAssets + Arguments Arguments // CurrentVersion string } @@ -16,7 +12,7 @@ func (game SteamGame) GetSkirdaGameId() string { return game.SkirdaGameId } -func (game SteamGame) GetUIAssets() skirdagame.GameUIAssets { +func (game SteamGame) GetUIAssets() GameUIAssets { return game.Assets } @@ -25,9 +21,9 @@ func (game SteamGame) GetLaunchArgs() []string { } func (game SteamGame) GetType() string { - return gameType + return "steam" } -func (game SteamGame) GetArguments() skirdagame.Arguments { +func (game SteamGame) GetArguments() Arguments { return game.Arguments }