Work on ceremony2

This commit is contained in:
Felix Koppe
2024-11-29 09:45:36 +01:00
parent 7b689d6bf6
commit c25c12d0d6
10 changed files with 275 additions and 49 deletions

View File

@@ -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);
}
}
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -130,6 +130,8 @@ public void onUnHover() {
@Override
public void show() {
release();
calculateRelative();
setRelative();

View File

@@ -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);

View File

@@ -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();
}
}

View File

@@ -129,6 +129,8 @@ public void onUnHover() {
@Override
public void show() {
release();
calculateRelative();
setRelative();

View File

@@ -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);
}
}

View File

@@ -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);
}
}