mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-29 08:59:44 +01:00
added correct colors in LobbyMenu
This commit is contained in:
parent
156e76fe0a
commit
c8b69efca2
@ -25,6 +25,7 @@ import com.simsilica.lemur.style.ElementId;
|
|||||||
|
|
||||||
import pp.dialog.Dialog;
|
import pp.dialog.Dialog;
|
||||||
import pp.monopoly.client.MonopolyApp;
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
import pp.monopoly.game.server.PlayerColor;
|
||||||
import pp.monopoly.message.client.PlayerReady;
|
import pp.monopoly.message.client.PlayerReady;
|
||||||
import pp.monopoly.notification.Sound;
|
import pp.monopoly.notification.Sound;
|
||||||
|
|
||||||
@ -171,7 +172,7 @@ public class LobbyMenu extends Dialog {
|
|||||||
app.getGuiNode().attachChild(lowerRightMenu);
|
app.getGuiNode().attachChild(lowerRightMenu);
|
||||||
|
|
||||||
// Add a colored circle between the input field and the dropdown menu
|
// Add a colored circle between the input field and the dropdown menu
|
||||||
circle = createCircle( ColorRGBA.Red); // 50 is the diameter, Red is the color
|
circle = createCircle(); // 50 is the diameter, Red is the color
|
||||||
circle.setLocalTranslation(new Vector3f(
|
circle.setLocalTranslation(new Vector3f(
|
||||||
(app.getCamera().getWidth()) / 2, // Center horizontally
|
(app.getCamera().getWidth()) / 2, // Center horizontally
|
||||||
(app.getCamera().getHeight() / 2) - 90, // Adjust Y position
|
(app.getCamera().getHeight() / 2) - 90, // Adjust Y position
|
||||||
@ -205,19 +206,33 @@ public class LobbyMenu extends Dialog {
|
|||||||
app.getGuiNode().attachChild(background);
|
app.getGuiNode().attachChild(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Geometry createCircle(ColorRGBA color) {
|
private Geometry createCircle() {
|
||||||
|
|
||||||
Sphere sphere = new Sphere(90,90,60.0f);
|
Sphere sphere = new Sphere(90,90,60.0f);
|
||||||
Geometry circleGeometry = new Geometry("Circle", sphere);
|
Geometry circleGeometry = new Geometry("Circle", sphere);
|
||||||
|
|
||||||
// Create a material with a solid color
|
// Create a material with a solid color
|
||||||
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
material.setColor("Color", color); // Set the desired color
|
material.setColor("Color", idToColor()); // Set the desired color
|
||||||
circleGeometry.setMaterial(material);
|
circleGeometry.setMaterial(material);
|
||||||
|
|
||||||
return circleGeometry;
|
return circleGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ColorRGBA idToColor() {
|
||||||
|
switch (app.getId()+1) {
|
||||||
|
case 1: return PlayerColor.CYAN.getColor();
|
||||||
|
case 2: return PlayerColor.YELLOW.getColor();
|
||||||
|
case 3: return PlayerColor.RED.getColor();
|
||||||
|
case 4: return PlayerColor.PINK.getColor();
|
||||||
|
case 5: return PlayerColor.GREEN.getColor();
|
||||||
|
case 6: return PlayerColor.PURPLE.getColor();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schaltet den "Bereit"-Status um.
|
* Schaltet den "Bereit"-Status um.
|
||||||
*/
|
*/
|
||||||
|
@ -79,12 +79,12 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
|
|
||||||
public PlayerColor getColor() {
|
public PlayerColor getColor() {
|
||||||
switch ((id%6)+1) {
|
switch ((id%6)+1) {
|
||||||
case 1: return PlayerColor.BLUE;
|
case 1: return PlayerColor.CYAN;
|
||||||
case 2: return PlayerColor.GREEN_DARK;
|
case 2: return PlayerColor.YELLOW;
|
||||||
case 3: return PlayerColor.GREEN_LIGHT;
|
case 3: return PlayerColor.RED;
|
||||||
case 4: return PlayerColor.PINK;
|
case 4: return PlayerColor.PINK;
|
||||||
case 5: return PlayerColor.RED;
|
case 5: return PlayerColor.GREEN;
|
||||||
case 6: return PlayerColor.YELLOW;
|
case 6: return PlayerColor.PURPLE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
@ -6,12 +6,12 @@ import com.jme3.math.ColorRGBA;
|
|||||||
* Enum representing six distinct colors for players in the game.
|
* Enum representing six distinct colors for players in the game.
|
||||||
*/
|
*/
|
||||||
public enum PlayerColor {
|
public enum PlayerColor {
|
||||||
GREEN_LIGHT(new ColorRGBA(0 / 255f, 204 / 255f, 0 / 255f, 1)), // Hex: 00cc00
|
CYAN(new ColorRGBA(1 / 255f, 190 / 255f, 254 / 255f, 1)),
|
||||||
RED(new ColorRGBA(255 / 255f, 0 / 255f, 0 / 255f, 1)), // Hex: ff0000
|
YELLOW(new ColorRGBA(255 / 255f, 255 / 255f, 0 / 255f, 1)),
|
||||||
BLUE(new ColorRGBA(0 / 255f, 0 / 255f, 204 / 255f, 1)), // Hex: 0000cc
|
RED(new ColorRGBA(255 / 255f, 0 / 255f, 0 / 255f, 1)),
|
||||||
PINK(new ColorRGBA(255 / 255f, 77 / 255f, 166 / 255f, 1)), // Hex: ff4da6
|
PINK(new ColorRGBA(255 / 255f, 77 / 255f, 166 / 255f, 1)),
|
||||||
GREEN_DARK(new ColorRGBA(0 / 255f, 102 / 255f, 0 / 255f, 1)), // Hex: 006600
|
GREEN(new ColorRGBA(0 / 255f, 204 / 255f, 0 / 255f, 1)),
|
||||||
YELLOW(new ColorRGBA(255 / 255f, 255 / 255f, 0 / 255f, 1)); // Hex: ffff00
|
PURPLE(new ColorRGBA(143 / 255f, 0 / 255f, 255 / 255f, 1));
|
||||||
|
|
||||||
private final ColorRGBA color;
|
private final ColorRGBA color;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user