Skip to content

Commit

Permalink
Switch to MUGS::UI::Game::Lobby role for common lobby methods
Browse files Browse the repository at this point in the history
  • Loading branch information
japhb committed Feb 15, 2024
1 parent 9831146 commit 78368f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
12 changes: 0 additions & 12 deletions lib/MUGS/UI/CLI.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,6 @@ class Game is MUGS::UI::Game {
}
}

method filter-games(@games, Bool :$all) {
$all ?? @games !! @games.grep: { MUGS::UI.ui-exists($.ui-type, .<game-type>) }
}

method available-game-types(::?CLASS:D: Bool :$all) {
self.filter-games($.client.available-game-types, :$all)
}

method active-games(::?CLASS:D: Bool :$all) {
self.filter-games($.client.active-games, :$all)
}

method switch-to-game($game-id) {
if $game-id && $.client.session.games{$game-id} {
if $game-id eq $.client.game-id {
Expand Down
5 changes: 4 additions & 1 deletion lib/MUGS/UI/CLI/Game/Lobby.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use MUGS::Core;
use MUGS::Client::Game::Lobby;
use MUGS::UI::Game::Lobby;
use MUGS::UI::CLI;

enum State < SelectType >;
Expand All @@ -11,7 +12,9 @@ my %prompts =


#| CLI UI for game selection lobby
class MUGS::UI::CLI::Game::Lobby is MUGS::UI::CLI::Game {
class MUGS::UI::CLI::Game::Lobby
is MUGS::UI::CLI::Game
does MUGS::UI::Game::Lobby {
has State $.state = State(0);

method game-type() { 'lobby' }
Expand Down

0 comments on commit 78368f7

Please sign in to comment.