Added:(Network) Totem Choice first implementation
This commit is contained in:
@@ -239,4 +239,17 @@ public class ClientController {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
public void totemChoice(String playerUsername,int pos) {
|
||||
if(!Objects.equals(playerUsername, miniModel.currentState.getCurrentPlayer().getUserName()))
|
||||
view.showError("It's not your turn!");
|
||||
else {
|
||||
try {
|
||||
client.totemChoice(playerUsername, String.valueOf(miniModel.availableTotems.get(pos)));
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package it.polimi.ingsw.gc14.Controller;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
|
||||
/**
|
||||
* Controller class that manages interactions between the client-side logic
|
||||
@@ -200,8 +201,16 @@ public class GameController {
|
||||
*/
|
||||
public boolean slotChoice(String playerUsername,int pos) {
|
||||
Player player= model.getPlayerByUsername(playerUsername);
|
||||
if(player==null)//playerIndex>=model.)
|
||||
if(player==null)
|
||||
return false;
|
||||
return model.SlotChoiceByIndex(model.getPlayerByUsername(playerUsername),pos);
|
||||
}
|
||||
|
||||
//TODO
|
||||
public boolean TotemChoice(String playerUsername,String totem) {
|
||||
Player player= model.getPlayerByUsername(playerUsername);
|
||||
if(player==null)
|
||||
return false;
|
||||
return model.TotemChoice(player, Totems.valueOf(totem));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user