Added: Totem CHoice first implementation
This commit is contained in:
@@ -6,6 +6,7 @@ package it.polimi.ingsw.gc14.Network;
|
||||
*/
|
||||
public enum EventType {
|
||||
ADD_PLAYER,
|
||||
TOTEM_CHOICE,
|
||||
SLOT_CHOICE,
|
||||
DRAW_UPPER_TRIBE,
|
||||
DRAW_LOWER_TRIBE,
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package it.polimi.ingsw.gc14.Network.NetworkEvents;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* NetworkEvent to select a slot where to place the player totem.
|
||||
*/
|
||||
public class TotemChoice extends NetworkEvent implements Serializable {
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
private List<Object>availableTotems;
|
||||
public void setAvailableTotems(List<Object> availableTotems) {
|
||||
this.availableTotems = availableTotems;
|
||||
}
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param pos the index of the card to draw
|
||||
*/
|
||||
public TotemChoice(String username, int pos) {
|
||||
super(username, EventType.TOTEM_CHOICE, false);
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could draw the card, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController) {
|
||||
return gameController.slotChoice(username, pos);
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
if(isError)
|
||||
return false;
|
||||
miniModel.setPlayer(player);
|
||||
miniModel.setOrderLogicCard(orderLogicCard);
|
||||
miniModel.setCurrentState(currentState);
|
||||
miniModel.setSlotPlayerMap(slotPlayerMap);
|
||||
miniModel.setAvailableTotems(availableTotems);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user