package com.elgassia.bridge.view.tui.scenes;

import com.elgassia.bridge.view.tui.Commands;
import com.elgassia.bridge.view.tui.Scene;
import com.elgassia.bridge.view.tui.View;
import com.elgassia.bridge.view.tui.commands.*;

public class TeamScene extends Scene {
    @Override
    protected void prepareCommands(Commands commands, View view) {
        super.prepareCommands(commands, view);
        switch (view.getAdapter().getTeamAdapter().getState()) {
            case LOBBY:
                commands.add("next", new NextPlayer(view.getAdapter().getTeamAdapter()));
                commands.add("set_name", new SetName(view.getAdapter().getTeamAdapter().getLobbyAdapter()));
                commands.add("start", new StartGame(view.getAdapter().getTeamAdapter().getLobbyAdapter()));
                commands.add("random_teams", new SetRandomTeams(view.getAdapter().getTeamAdapter().getLobbyAdapter()));
                commands.add("set_team", new SetTeam(view.getAdapter().getTeamAdapter().getLobbyAdapter()));
                System.out.println("Player: " + view.getAdapter().getTeamAdapter().getName());
                break;
            default:
                assert false;
        }
    }
}

@@ -223,46 +223,321 @@
 *;%0A%0A
-public class TeamScene extends Scene %7B
+import java.util.Observable;%0Aimport java.util.Observer;%0A%0Apublic class TeamScene extends Scene implements Observer %7B%0A    private Commands commands;%0A    private View view;%0A%0A    @Override%0A    public void init(View view) %7B%0A        super.init(view);%0A        view.getAdapter().getTeamAdapter().addObserver(this);%0A    %7D%0A
 %0A   
@@ -606,32 +606,93 @@
 s, View view) %7B%0A
+        this.commands = commands;%0A        this.view = view;%0A%0A
         super.pr
@@ -1531,11 +1531,131 @@
  %7D%0A    %7D
+%0A%0A    @Override%0A    public void update(Observable observable, Object o) %7B%0A        prepareCommands(commands, view);%0A    %7D
 %0A%7D%0A

update team scene