Work on ceremony2
This commit is contained in:
@@ -76,6 +76,12 @@ public void enter(MdgaState state) {
|
||||
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
|
||||
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("Gesamt", 1, 2, 3, 4, 5, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,13 +75,33 @@ private void handleGame(Notification notification) {
|
||||
// Handle AcquireCardNotification
|
||||
} else if (notification instanceof ActivePlayerNotification n) {
|
||||
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
||||
} else if (notification instanceof CeremonyNotification) {
|
||||
} else if (notification instanceof CeremonyNotification ceremonyNotification) {
|
||||
app.enter(MdgaState.CEREMONY);
|
||||
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
|
||||
int size = ceremonyNotification.getNames().size();
|
||||
|
||||
if (ceremonyNotification.getPiecesThrown().size() != size ||
|
||||
ceremonyNotification.getPiecesLost().size() != size ||
|
||||
ceremonyNotification.getBonusCardsPlayed().size() != size ||
|
||||
ceremonyNotification.getSixes().size() != size ||
|
||||
ceremonyNotification.getNodesMoved().size() != size ||
|
||||
ceremonyNotification.getBonusNodes().size() != size) {
|
||||
throw new IllegalArgumentException("All data lists in CeremonyNotification must have the same size.");
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
Color color = ceremonyNotification.getColors().get(i);
|
||||
String name = ceremonyNotification.getNames().get(i);
|
||||
int v1 = ceremonyNotification.getPiecesThrown().get(i);
|
||||
int v2 = ceremonyNotification.getPiecesLost().get(i);
|
||||
int v3 = ceremonyNotification.getBonusCardsPlayed().get(i);
|
||||
int v4 = ceremonyNotification.getSixes().get(i);
|
||||
int v5 = ceremonyNotification.getNodesMoved().get(i);
|
||||
int v6 = ceremonyNotification.getBonusNodes().get(i);
|
||||
|
||||
ceremonyView.addCeremonyParticipant(color, i, name);
|
||||
ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
} else if (notification instanceof DiceNowNotification) {
|
||||
// Handle DiceNowNotification
|
||||
} else if (notification instanceof DicingNotification) {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public abstract class AbstractButton {
|
||||
protected static final ColorRGBA BUTTON_NORMAL = ColorRGBA.fromRGBA255(169, 165, 104, 255);
|
||||
protected static final ColorRGBA BUTTON_PRESSED = ColorRGBA.fromRGBA255(105, 117, 89, 255);
|
||||
protected static final ColorRGBA TEXT_NORMAL = ColorRGBA.Black;
|
||||
protected static final ColorRGBA TEXT_PRESSED = ColorRGBA.fromRGBA255( 180, 195, 191, 255);
|
||||
public static final ColorRGBA BUTTON_NORMAL = ColorRGBA.fromRGBA255(169, 165, 104, 255);
|
||||
public static final ColorRGBA BUTTON_PRESSED = ColorRGBA.fromRGBA255(105, 117, 89, 255);
|
||||
public static final ColorRGBA TEXT_NORMAL = ColorRGBA.Black;
|
||||
public static final ColorRGBA TEXT_PRESSED = ColorRGBA.fromRGBA255( 180, 195, 191, 255);
|
||||
|
||||
public static final float HORIZONTAL = 16;
|
||||
public static final float VERTICAL = 9;
|
||||
|
||||
@@ -130,6 +130,8 @@ public void onUnHover() {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
release();
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ public abstract class ClickButton extends AbstractButton {
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
release();
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
@@ -59,7 +59,7 @@ public void hide() {
|
||||
protected abstract void onHover();
|
||||
protected abstract void onUnHover();
|
||||
|
||||
private void click() {
|
||||
protected void click() {
|
||||
instance.setColor(TEXT_PRESSED);
|
||||
instance.setHighlightColor(TEXT_PRESSED);
|
||||
|
||||
@@ -69,7 +69,7 @@ private void click() {
|
||||
onHover();
|
||||
};
|
||||
|
||||
private void release() {
|
||||
protected void release() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
|
||||
|
||||
@@ -7,12 +7,17 @@
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class LabelButton extends ClickButton{
|
||||
private ColorRGBA text = TEXT_NORMAL;
|
||||
private ColorRGBA button = BUTTON_NORMAL;
|
||||
|
||||
public LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos) {
|
||||
super(app, node, () -> {}, label, size, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
release();
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
@@ -28,23 +33,31 @@ public void hide() {
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
instance.setColor(text);
|
||||
instance.setHighlightColor(text);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(button);
|
||||
instance.setBackground(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
instance.setColor(text);
|
||||
instance.setHighlightColor(text);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(button);
|
||||
instance.setBackground(background);
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
instance.setText(text);
|
||||
}
|
||||
|
||||
public void setColor(ColorRGBA text, ColorRGBA button) {
|
||||
this.text = text;
|
||||
this.button = button;
|
||||
|
||||
hide();
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,8 @@ public void onUnHover() {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
release();
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.button.AbstractButton;
|
||||
import pp.mdga.client.button.InputButton;
|
||||
import pp.mdga.client.button.LabelButton;
|
||||
import pp.mdga.client.button.MenuButton;
|
||||
@@ -13,39 +15,33 @@
|
||||
public class CeremonyDialog extends Dialog {
|
||||
private ArrayList<ArrayList<LabelButton>> labels;
|
||||
|
||||
float offsetX = 0.5f;
|
||||
|
||||
public CeremonyDialog(MdgaApp app, Node node) {
|
||||
super(app, node);
|
||||
|
||||
labels = new ArrayList<>();
|
||||
labels.add(new ArrayList<>());
|
||||
labels.add(new ArrayList<>());
|
||||
labels.add(new ArrayList<>());
|
||||
labels.add(new ArrayList<>());
|
||||
labels.add(new ArrayList<>());
|
||||
labels.add(new ArrayList<>());
|
||||
|
||||
float offsetX = 0.5f;
|
||||
ArrayList<LabelButton> first = new ArrayList<>();
|
||||
Vector2f size = new Vector2f(4, 1.2f);
|
||||
first.add(new LabelButton(app, node, "", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Figuren geworfen", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Figuren verloren", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Verwendete Bonuskarten", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Gewürfelte 6en", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Gelaufene Felder", size, new Vector2f()));
|
||||
first.add(new LabelButton(app, node, "Bonusfeldern erreicht", size, new Vector2f()));
|
||||
|
||||
for (ArrayList<LabelButton> row : labels) {
|
||||
float offsetY = 0.5f;
|
||||
|
||||
float offsetY = 0.5f;
|
||||
|
||||
Vector2f size = new Vector2f(5, 1.2f);
|
||||
row.add(new LabelButton(app, node, "", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "Würfe", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "Figuren rausgeworfen", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "verwendete Bonuskarten", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "gewürfelte 6en", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "gelaufene Felder", size, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "auf Bonusfeldern gelandet", size, new Vector2f()));
|
||||
|
||||
for (LabelButton b : row) {
|
||||
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetY));
|
||||
offsetY += 0.8f;
|
||||
}
|
||||
|
||||
offsetX += 3;
|
||||
for (LabelButton b : first) {
|
||||
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetY));
|
||||
offsetY += 0.8f;
|
||||
}
|
||||
|
||||
offsetX += 2.3f;
|
||||
|
||||
labels.add(first);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,4 +61,41 @@ protected void onHide() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addStatisticsRow(String name, int v1, int v2, int v3, int v4, int v5, int v6) {
|
||||
float offsetYSmall = 0.5f;
|
||||
|
||||
ArrayList<LabelButton> row = new ArrayList<>();
|
||||
|
||||
Vector2f sizeSmall = new Vector2f(4, 1.2f);
|
||||
row.add(new LabelButton(app, node, name, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v1, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v2, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v3, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v4, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v5, sizeSmall, new Vector2f()));
|
||||
row.add(new LabelButton(app, node, "" + v6, sizeSmall, new Vector2f()));
|
||||
|
||||
ColorRGBA colorText = AbstractButton.TEXT_NORMAL.clone();
|
||||
colorText.a = 0.1f;
|
||||
|
||||
ColorRGBA colorButton = AbstractButton.BUTTON_NORMAL.clone();
|
||||
colorButton.a = 0.1f;
|
||||
|
||||
int j = 0;
|
||||
for (LabelButton b : row) {
|
||||
if(j > 0) {
|
||||
b.setColor(colorText, colorButton);
|
||||
}
|
||||
|
||||
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetYSmall));
|
||||
offsetYSmall += 0.8f;
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
offsetX += 2.3f;
|
||||
|
||||
labels.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ public void onLeave() {
|
||||
backButton.hide();
|
||||
continueButton.hide();
|
||||
|
||||
guiNode.detachChild(background);
|
||||
if(null != background) {
|
||||
guiNode.detachChild(background);
|
||||
}
|
||||
|
||||
ceremonyButtons.clear();
|
||||
|
||||
@@ -89,8 +91,8 @@ private void awardCeremony() {
|
||||
}
|
||||
|
||||
private void statistics() {
|
||||
background = createBackground("Images/b2.png");
|
||||
guiNode.attachChild(background);
|
||||
//background = createBackground("Images/b2.png");
|
||||
//guiNode.attachChild(background);
|
||||
|
||||
backButton.show();
|
||||
continueButton.show();
|
||||
@@ -152,4 +154,8 @@ public void addCeremonyParticipant(Color color, int pos, String name) {
|
||||
button.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void addStatisticsRow(String name, int v1, int v2, int v3, int v4, int v5, int v6) {
|
||||
ceremonyDialog.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,156 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Class CeremonyNotification
|
||||
* Represents a notification for a ceremony in the game.
|
||||
*
|
||||
* Index mapping:
|
||||
* index = 0 ==> winner
|
||||
* index = 1 ==> 2nd
|
||||
* index = 2 ==> third place
|
||||
* index = 3 ==> loser
|
||||
* index = 4 ==> total
|
||||
*/
|
||||
public class CeremonyNotification extends Notification{
|
||||
public class CeremonyNotification extends Notification {
|
||||
private ArrayList<Color> colors;
|
||||
private ArrayList<String> names;
|
||||
private ArrayList<Integer> piecesThrown;
|
||||
private ArrayList<Integer> piecesLost;
|
||||
private ArrayList<Integer> bonusCardsPlayed;
|
||||
private ArrayList<Integer> sixes;
|
||||
private ArrayList<Integer> nodesMoved;
|
||||
private ArrayList<Integer> bonusNodes;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Initializes all lists.
|
||||
*/
|
||||
CeremonyNotification() {
|
||||
public CeremonyNotification() {
|
||||
this.colors = new ArrayList<>();
|
||||
this.names = new ArrayList<>();
|
||||
this.piecesThrown = new ArrayList<>();
|
||||
this.piecesLost = new ArrayList<>();
|
||||
this.bonusCardsPlayed = new ArrayList<>();
|
||||
this.sixes = new ArrayList<>();
|
||||
this.nodesMoved = new ArrayList<>();
|
||||
this.bonusNodes = new ArrayList<>();
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
|
||||
/**
|
||||
* @return the list of colors
|
||||
*/
|
||||
public ArrayList<Color> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors the list of colors to set
|
||||
*/
|
||||
public void setColors(ArrayList<Color> colors) {
|
||||
this.colors = colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of player names
|
||||
*/
|
||||
public ArrayList<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param names the list of player names to set
|
||||
*/
|
||||
public void setNames(ArrayList<String> names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of pieces thrown
|
||||
*/
|
||||
public ArrayList<Integer> getPiecesThrown() {
|
||||
return piecesThrown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param piecesThrown the list of pieces thrown to set
|
||||
*/
|
||||
public void setPiecesThrown(ArrayList<Integer> piecesThrown) {
|
||||
this.piecesThrown = piecesThrown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of pieces lost
|
||||
*/
|
||||
public ArrayList<Integer> getPiecesLost() {
|
||||
return piecesLost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param piecesLost the list of pieces lost to set
|
||||
*/
|
||||
public void setPiecesLost(ArrayList<Integer> piecesLost) {
|
||||
this.piecesLost = piecesLost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of bonus cards played
|
||||
*/
|
||||
public ArrayList<Integer> getBonusCardsPlayed() {
|
||||
return bonusCardsPlayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bonusCardsPlayed the list of bonus cards played to set
|
||||
*/
|
||||
public void setBonusCardsPlayed(ArrayList<Integer> bonusCardsPlayed) {
|
||||
this.bonusCardsPlayed = bonusCardsPlayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of sixes rolled
|
||||
*/
|
||||
public ArrayList<Integer> getSixes() {
|
||||
return sixes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sixes the list of sixes rolled to set
|
||||
*/
|
||||
public void setSixes(ArrayList<Integer> sixes) {
|
||||
this.sixes = sixes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of nodes moved
|
||||
*/
|
||||
public ArrayList<Integer> getNodesMoved() {
|
||||
return nodesMoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodesMoved the list of nodes moved to set
|
||||
*/
|
||||
public void setNodesMoved(ArrayList<Integer> nodesMoved) {
|
||||
this.nodesMoved = nodesMoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of bonus nodes
|
||||
*/
|
||||
public ArrayList<Integer> getBonusNodes() {
|
||||
return bonusNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bonusNodes the list of bonus nodes to set
|
||||
*/
|
||||
public void setBonusNodes(ArrayList<Integer> bonusNodes) {
|
||||
this.bonusNodes = bonusNodes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user