Rewrite gui
This commit is contained in:
@@ -62,7 +62,7 @@ private void setupInput() {
|
||||
@Override
|
||||
public void onAction(String name, boolean isPressed, float tpf) {
|
||||
if (name.equals("Settings") && isPressed) {
|
||||
app.getView().pressEscape();
|
||||
//app.getView().pressEscape();
|
||||
}
|
||||
if (name.equals("RotateRightMouse")) {
|
||||
rightMousePressed = isPressed;
|
||||
|
||||
@@ -22,21 +22,16 @@ public class MdgaApp extends SimpleApplication {
|
||||
private ModelSyncronizer modelSyncronizer;
|
||||
|
||||
MdgaView view = null;
|
||||
private MdgaState state = MdgaState.GAME;
|
||||
private MdgaState state = MdgaState.MAIN;
|
||||
|
||||
private static float resolutionFactor = 1.8f;
|
||||
private static float imageScale = 1.5f;
|
||||
|
||||
public static void main(String[] args) {
|
||||
AppSettings settings = new AppSettings(true);
|
||||
settings.setSamples(128);
|
||||
settings.setCenterWindow(true);
|
||||
|
||||
int width = (int)(1280 * resolutionFactor);
|
||||
int height = (int)(720 * resolutionFactor);
|
||||
|
||||
settings.setWidth(width);
|
||||
settings.setHeight(height);
|
||||
|
||||
settings.setWidth(1920);
|
||||
settings.setHeight(1080);
|
||||
settings.setVSync(false);
|
||||
|
||||
MdgaApp app = new MdgaApp();
|
||||
@@ -47,52 +42,24 @@ public static void main(String[] args) {
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
GuiGlobals.initialize(this);
|
||||
|
||||
inputManager.deleteMapping("SIMPLEAPP_Exit");
|
||||
|
||||
flyCam.setEnabled(false);
|
||||
|
||||
animationHandler = new AnimationHandler(this);
|
||||
acousticHandler = new AcousticHandler(this);
|
||||
notificationSynchronizer = new NotificationSynchronizer(this);
|
||||
inputSynchronizer = new InputSynchronizer(this);
|
||||
modelSyncronizer = new ModelSyncronizer(this);
|
||||
|
||||
inputManager.deleteMapping("SIMPLEAPP_Exit");
|
||||
inputManager.deleteMapping("FLYCAM_ZoomIn");
|
||||
inputManager.deleteMapping("FLYCAM_ZoomOut");
|
||||
inputManager.deleteMapping("FLYCAM_RotateDrag");
|
||||
flyCam.setEnabled(false);
|
||||
GuiGlobals.initialize(this);
|
||||
|
||||
enter(state);
|
||||
|
||||
List<UUID> test = new ArrayList<>();
|
||||
UUID player0 = UUID.randomUUID();
|
||||
test.add(player0);
|
||||
UUID player1 = UUID.randomUUID();
|
||||
test.add(player1);
|
||||
test.add(UUID.randomUUID());
|
||||
test.add(UUID.randomUUID());
|
||||
|
||||
List<UUID> test_1 = new ArrayList<>();
|
||||
UUID player0_1 = UUID.randomUUID();
|
||||
test_1.add(player0_1);
|
||||
UUID player1_1 = UUID.randomUUID();
|
||||
test_1.add(player1_1);
|
||||
test_1.add(UUID.randomUUID());
|
||||
test_1.add(UUID.randomUUID());
|
||||
|
||||
notificationSynchronizer.addTestNotification(new PlayerInGameNotification(Color.AIRFORCE, test, "Player 1"));
|
||||
notificationSynchronizer.addTestNotification(new PlayerInGameNotification(Color.NAVY, test_1, "Player 2"));
|
||||
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0, 0, true));
|
||||
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0_1, 20, true));
|
||||
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0_1, 20, 21));
|
||||
notificationSynchronizer.addTestNotification(new MovePieceNotification(player1, 0, true));
|
||||
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0, 0, 7));
|
||||
// notificationSynchronizer.addTestNotification(new SelectableMoveNotification(new ArrayList<>(List.of(player0, player1)), new ArrayList<>(List.of(7,3)), new ArrayList<>(List.of(false, false))));
|
||||
notificationSynchronizer.addTestNotification(new SwapPieceNotification(player0, player0_1));
|
||||
// notificationSynchronizer.addTestNotification(new SelectableSwapNotification(new ArrayList<>(List.of(player0, player1)), new ArrayList<>(List.of(player0_1))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
view.update();
|
||||
view.update(tpf);
|
||||
acousticHandler.update();
|
||||
notificationSynchronizer.update();
|
||||
}
|
||||
@@ -140,8 +107,8 @@ public AcousticHandler getAcousticHandler() {
|
||||
|
||||
public MdgaState getState() {return state; }
|
||||
|
||||
public float getResolutionFactor() {
|
||||
return resolutionFactor;
|
||||
public float getImageScale() {
|
||||
return imageScale;
|
||||
}
|
||||
|
||||
public MdgaView getView() {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class AcousticHandler {
|
||||
private GameMusic scheduled = null; // Scheduled track to play next
|
||||
private GameMusic old = null; // Old track being faded out
|
||||
|
||||
private float mainVolume = 1.0f;
|
||||
private float mainVolume = 0.0f;
|
||||
private float musicVolume = 1.0f;
|
||||
private float soundVolume = 1.0f;
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.font.BitmapFont;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
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 float HORIZONTAL = 16;
|
||||
public static final float VERTICAL = 9;
|
||||
|
||||
protected BitmapFont font;
|
||||
|
||||
protected final MdgaApp app;
|
||||
protected final Node node;
|
||||
|
||||
protected Vector2f pos;
|
||||
protected float fontSizeFactor = 1.0f;
|
||||
|
||||
protected float fontSize;
|
||||
protected float horizontalStep;
|
||||
protected float verticalStep;
|
||||
protected float heightStep;
|
||||
protected float widthStep;
|
||||
|
||||
protected boolean adjust = false;
|
||||
|
||||
public AbstractButton(MdgaApp app, Node node) {
|
||||
this.app = app;
|
||||
this.node = node;
|
||||
|
||||
font = app.getAssetManager().loadFont("Fonts/Gunplay.fnt");
|
||||
}
|
||||
|
||||
public abstract void show();
|
||||
public abstract void hide();
|
||||
|
||||
public void setPos(Vector2f pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
protected void calculateRelative() {
|
||||
fontSize = fontSizeFactor * 15 * (float)app.getCamera().getWidth() / 720;
|
||||
|
||||
horizontalStep = (float)app.getCamera().getWidth() / HORIZONTAL;
|
||||
verticalStep = (float)app.getCamera().getHeight() / VERTICAL;
|
||||
heightStep = verticalStep / 2;
|
||||
widthStep = horizontalStep / 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class ButtonLeft extends ClickButton {
|
||||
public ButtonLeft(MdgaApp app, Node node, Runnable action, String label, int narrowFactor) {
|
||||
super(app, node, action, label, new Vector2f( 5, 2), new Vector2f(0.5f * narrowFactor, 1.8f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class ButtonRight extends ClickButton {
|
||||
public ButtonRight(MdgaApp app, Node node, Runnable action, String label, int narrowFactor) {
|
||||
super(app, node, action, label, new Vector2f( 5, 2), new Vector2f(HORIZONTAL - 0.5f * narrowFactor, 1.8f));
|
||||
|
||||
adjust = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public abstract class ClickButton extends AbstractButton {
|
||||
protected final Runnable action;
|
||||
|
||||
protected String label;
|
||||
protected Vector2f size;
|
||||
|
||||
protected Button instance;
|
||||
|
||||
ClickButton(MdgaApp app, Node node, Runnable action, String label, Vector2f size, Vector2f pos) {
|
||||
super(app, node);
|
||||
|
||||
this.action = action;
|
||||
this.label = label;
|
||||
this.pos = pos;
|
||||
this.size = size;
|
||||
|
||||
instance = new Button(label);
|
||||
|
||||
instance.addClickCommands((_) -> action.run());
|
||||
instance.setTextHAlignment(HAlignment.Center);
|
||||
instance.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
instance.addCommands(Button.ButtonAction.HighlightOn, (_) -> click());
|
||||
instance.addCommands(Button.ButtonAction.HighlightOff, (_) -> release());
|
||||
|
||||
instance.setFont(font);
|
||||
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
node.attachChild(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
node.detachChild(instance);
|
||||
}
|
||||
|
||||
protected abstract void onHover();
|
||||
protected abstract void onUnHover();
|
||||
|
||||
private void click() {
|
||||
instance.setColor(TEXT_PRESSED);
|
||||
instance.setHighlightColor(TEXT_PRESSED);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_PRESSED);
|
||||
instance.setBackground(background);
|
||||
|
||||
onHover();
|
||||
};
|
||||
|
||||
private void release() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
instance.setBackground(background);
|
||||
|
||||
onUnHover();
|
||||
};
|
||||
|
||||
protected void setRelative() {
|
||||
instance.setFontSize(fontSize);
|
||||
|
||||
instance.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
|
||||
|
||||
float xAdjust = 0.0f;
|
||||
if(adjust) {
|
||||
xAdjust = instance.getPreferredSize().x;
|
||||
}
|
||||
|
||||
instance.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
|
||||
|
||||
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (instance.getPreferredSize().x / 2);
|
||||
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - instance.getPreferredSize().y / 2;
|
||||
|
||||
if(0 == pos.x) {
|
||||
instance.setLocalTranslation(horizontalMid, instance.getLocalTranslation().y, instance.getLocalTranslation().z);
|
||||
}
|
||||
|
||||
if(0 == pos.y) {
|
||||
instance.setLocalTranslation(instance.getLocalTranslation().x, verticalMid, instance.getLocalTranslation().z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class InputButton extends AbstractButton {
|
||||
private Label label;
|
||||
private TextField field;
|
||||
|
||||
private Container container = new Container();
|
||||
|
||||
private final int maxLenght;
|
||||
|
||||
protected Vector2f size;
|
||||
|
||||
public InputButton(MdgaApp app, Node node, String label, int maxLenght) {
|
||||
super(app, node);
|
||||
|
||||
this.label = new Label(label);
|
||||
this.maxLenght = maxLenght;
|
||||
|
||||
this.label.setColor(TEXT_NORMAL);
|
||||
|
||||
field = new TextField("");
|
||||
field.setColor(TEXT_NORMAL);
|
||||
field.setTextHAlignment(HAlignment.Left);
|
||||
field.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
field.setBackground(grayBackground);
|
||||
|
||||
this.label.setFont(font);
|
||||
field.setFont(font);
|
||||
|
||||
pos = new Vector2f( 0, 0);
|
||||
size = new Vector2f(5.5f, 1);
|
||||
|
||||
container.addChild(this.label);
|
||||
container.addChild(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
node.attachChild(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
node.detachChild(container);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
String text = field.getText();
|
||||
int length = text.length();
|
||||
|
||||
if (length > maxLenght) {
|
||||
field.setText(text.substring(0, maxLenght));
|
||||
}
|
||||
}
|
||||
|
||||
protected void setRelative() {
|
||||
this.label.setFontSize(fontSize);
|
||||
field.setFontSize(fontSize);
|
||||
|
||||
field.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
|
||||
|
||||
float xAdjust = 0.0f;
|
||||
if(adjust) {
|
||||
xAdjust = container.getPreferredSize().x;
|
||||
}
|
||||
|
||||
container.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
|
||||
|
||||
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (container.getPreferredSize().x / 2);
|
||||
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - container.getPreferredSize().y / 2;
|
||||
|
||||
if(0 == pos.x) {
|
||||
container.setLocalTranslation(horizontalMid, container.getLocalTranslation().y, -1);
|
||||
}
|
||||
|
||||
if(0 == pos.y) {
|
||||
container.setLocalTranslation(container.getLocalTranslation().x, verticalMid, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return field.getText();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
field.setText("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class LabelButton extends ClickButton{
|
||||
LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos) {
|
||||
super(app, node, () -> {}, label, size, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
instance.setFontSize(fontSize / 2);
|
||||
|
||||
node.attachChild(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
node.detachChild(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
instance.setBackground(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
instance.setColor(TEXT_NORMAL);
|
||||
instance.setHighlightColor(TEXT_NORMAL);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
|
||||
instance.setBackground(background);
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
instance.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.light.AmbientLight;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Quaternion;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.Asset;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
public class LobbyButton extends ClickButton {
|
||||
public enum Taken {
|
||||
NOT,
|
||||
SELF,
|
||||
OTHER,
|
||||
}
|
||||
|
||||
static final float WIDTH = 4.0f;
|
||||
|
||||
private final Node node3d;
|
||||
|
||||
private boolean rotate = false;
|
||||
private Spatial model;
|
||||
private float rot = 180;
|
||||
|
||||
private Taken taken = Taken.NOT;
|
||||
|
||||
private LabelButton label;
|
||||
|
||||
public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color tsk) {
|
||||
super(app, node, action, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
|
||||
|
||||
this.node3d = node3d;
|
||||
|
||||
label = new LabelButton(app, node, "- leer -", new Vector2f( WIDTH, 1), new Vector2f(0, 0));
|
||||
|
||||
final float mid = HORIZONTAL / 2;
|
||||
final float uiSpacing = 0.4f;
|
||||
final float figSpacing = 0.51f;
|
||||
|
||||
float uiX = mid;
|
||||
float figX = 0;
|
||||
Asset asset = null;
|
||||
|
||||
switch (tsk) {
|
||||
case CYBER:
|
||||
adjust = true;
|
||||
label.adjust = true;
|
||||
uiX -= 3 * uiSpacing;
|
||||
uiX -= WIDTH / 2;
|
||||
asset = Asset.cir;
|
||||
figX -= 3 * figSpacing;
|
||||
instance.setText("CIR");
|
||||
break;
|
||||
case AIRFORCE:
|
||||
adjust = true;
|
||||
label.adjust = true;
|
||||
uiX -= uiSpacing;
|
||||
asset = Asset.lw;
|
||||
figX -= figSpacing;
|
||||
instance.setText("Luftwaffe");
|
||||
break;
|
||||
case ARMY:
|
||||
uiX += uiSpacing;
|
||||
asset = Asset.heer;
|
||||
figX += figSpacing;
|
||||
instance.setText("Heer");
|
||||
break;
|
||||
case NAVY:
|
||||
uiX += 3 * uiSpacing;
|
||||
uiX += WIDTH / 2;
|
||||
asset = Asset.marine;
|
||||
figX += 3 * figSpacing;
|
||||
instance.setText("Marine");
|
||||
break;
|
||||
}
|
||||
|
||||
setPos(new Vector2f(uiX, 6));
|
||||
label.setPos(new Vector2f(uiX, 7));
|
||||
|
||||
createModel(asset, new Vector3f(figX, -0.55f, 6));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
/*switch (taken) {
|
||||
case NOT:
|
||||
break;
|
||||
case SELF:
|
||||
break;
|
||||
case OTHER:
|
||||
break;
|
||||
}*/
|
||||
|
||||
ColorRGBA buttonPressed = BUTTON_PRESSED.clone();
|
||||
buttonPressed.a = 0.3f;
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonPressed);
|
||||
instance.setBackground(background);
|
||||
|
||||
rotate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
/*switch (taken) {
|
||||
case NOT:
|
||||
break;
|
||||
case SELF:
|
||||
break;
|
||||
case OTHER:
|
||||
break;
|
||||
}*/
|
||||
|
||||
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
|
||||
buttonNormal.a = 0.1f;
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
|
||||
instance.setBackground(background);
|
||||
|
||||
rotate = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
calculateRelative();
|
||||
setRelative();
|
||||
|
||||
node.attachChild(instance);
|
||||
node3d.attachChild(model);
|
||||
|
||||
label.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
node.detachChild(instance);
|
||||
node3d.detachChild(model);
|
||||
|
||||
label.hide();
|
||||
}
|
||||
|
||||
public void update(float tpf) {
|
||||
if(rotate) {
|
||||
rot += 140.0f * tpf;
|
||||
rot %= 360;
|
||||
} else {
|
||||
rot = 180;
|
||||
}
|
||||
|
||||
model.setLocalRotation(new Quaternion().fromAngles((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180)));
|
||||
}
|
||||
|
||||
private void createModel(Asset asset, Vector3f pos) {
|
||||
String modelName = asset.getModelPath();
|
||||
String texName = asset.getDiffPath();
|
||||
|
||||
model = app.getAssetManager().loadModel(modelName);
|
||||
model.scale(asset.getSize() / 2);
|
||||
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
|
||||
model.setLocalTranslation(pos);
|
||||
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
||||
|
||||
model.setLocalTranslation(pos);
|
||||
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(texName));
|
||||
model.setMaterial(mat);
|
||||
}
|
||||
|
||||
public Taken getTaken() {
|
||||
return taken;
|
||||
}
|
||||
|
||||
public void setTaken(Taken taken, String name) {
|
||||
this.taken = taken;
|
||||
|
||||
if(taken == Taken.NOT) {
|
||||
label.setText("- leer -");
|
||||
} else {
|
||||
label.setText(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class MenuButton extends ClickButton {
|
||||
public MenuButton(MdgaApp app, Node node, Runnable action, String label) {
|
||||
super(app, node, action, label, new Vector2f( 5.5f, 2), new Vector2f(0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package pp.mdga.client.button;
|
||||
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.IconComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SettingsButton extends ClickButton {
|
||||
private IconComponent icon;
|
||||
|
||||
public SettingsButton(MdgaApp app, Node node, Runnable action) {
|
||||
super(app, node, action, "", new Vector2f(2, 2), new Vector2f(HORIZONTAL - 0.5f, VERTICAL - 0.5f));
|
||||
|
||||
adjust = true;
|
||||
|
||||
icon = new IconComponent("Images/zahnrad.png");
|
||||
icon.setIconScale(0.1f * app.getImageScale());
|
||||
icon.setHAlignment(HAlignment.Center);
|
||||
icon.setVAlignment(VAlignment.Center);
|
||||
instance.setIcon(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHover() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnHover() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class AudioSettingsDialog {
|
||||
}
|
||||
@@ -1,82 +1,32 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
import static com.jme3.math.FastMath.floor;
|
||||
|
||||
public abstract class Dialog {
|
||||
protected final ColorRGBA COLOR_DEFAULT = ColorRGBA.Gray;
|
||||
protected final ColorRGBA COLOR_HOVER = ColorRGBA.DarkGray;
|
||||
|
||||
protected Container container;
|
||||
|
||||
protected final MdgaApp app;
|
||||
private final Node node;
|
||||
protected final Node node = new Node();
|
||||
|
||||
protected final float vertical_step;
|
||||
protected final float horitontal_step;
|
||||
private final Node root;
|
||||
|
||||
protected float fontSize = 35;
|
||||
|
||||
public Dialog(MdgaApp app, Node node) {
|
||||
Dialog(MdgaApp app, Node node) {
|
||||
this.app = app;
|
||||
this.node = node;
|
||||
this.container = new Container();
|
||||
|
||||
this.horitontal_step = app.getCamera().getWidth() / 16;
|
||||
this.vertical_step = app.getCamera().getHeight() / 9;
|
||||
|
||||
int val = (int) (32 * Math.min(app.getResolutionFactor() * 0.9f, 1));
|
||||
fontSize = val;
|
||||
this.root = node;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
node.attachChild(container);
|
||||
root.attachChild(node);
|
||||
|
||||
onShow();
|
||||
}
|
||||
|
||||
public void hide () {
|
||||
node.detachChild(container);
|
||||
public void hide() {
|
||||
root.detachChild(node);
|
||||
|
||||
onHide();
|
||||
}
|
||||
|
||||
protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
container.addChild(button);
|
||||
}
|
||||
protected abstract void onShow();
|
||||
protected abstract void onHide ();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class GetPercentRunnable {
|
||||
private final Supplier<Float> action;
|
||||
|
||||
public GetPercentRunnable(Supplier<Float> action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public float get() {
|
||||
return action.get();
|
||||
}
|
||||
}
|
||||
@@ -1,143 +1,61 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.button.ButtonLeft;
|
||||
import pp.mdga.client.button.ButtonRight;
|
||||
import pp.mdga.client.button.InputButton;
|
||||
import pp.mdga.client.button.MenuButton;
|
||||
import pp.mdga.client.view.MainView;
|
||||
|
||||
public class HostDialog extends Dialog {
|
||||
private TextField portInput;
|
||||
public class HostDialog extends Dialog {
|
||||
private InputButton portInput;
|
||||
|
||||
public HostDialog(MdgaApp app, Node node, Runnable backAction) {
|
||||
private ButtonRight hostButton;
|
||||
private ButtonLeft backButton;
|
||||
|
||||
private final MainView view;
|
||||
|
||||
public HostDialog(MdgaApp app, Node node, MainView view) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
this.view = view;
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
|
||||
portInput = new InputButton(app, node, "Port: ", 5);
|
||||
|
||||
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
|
||||
hostButton = new ButtonRight(app, node, view::forward, "Spiel hosten", 10);
|
||||
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
||||
|
||||
Panel imagePanel = new Panel();
|
||||
imagePanel.setBackground(b);
|
||||
float offset = 3.0f;
|
||||
|
||||
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4 * app.getResolutionFactor(), texture.getImage().getHeight() / 4 * app.getResolutionFactor(), 0));
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createTextField();
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
Container sub = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
createButton(sub, "Abbrechen", backAction, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
|
||||
sub.addChild(new Panel(40 * app.getResolutionFactor(), 0 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createButton(sub, "Starten", () -> tryStart(), new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
|
||||
container.addChild(sub);
|
||||
}
|
||||
|
||||
void tryStart() {
|
||||
if (null == portInput.getText()) {
|
||||
portInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
int port = 0;
|
||||
|
||||
try {
|
||||
port = Integer.parseInt(portInput.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
portInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
if(port >= 1 && port <= 65535) {
|
||||
app.getModelSyncronizer().setHost(port);
|
||||
}
|
||||
|
||||
portInput.setText("");
|
||||
portInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
container.setLocalTranslation(
|
||||
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
|
||||
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
|
||||
0
|
||||
);
|
||||
protected void onShow() {
|
||||
portInput.show();
|
||||
hostButton.show();
|
||||
backButton.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
protected void onHide() {
|
||||
portInput.hide();
|
||||
hostButton.hide();
|
||||
backButton.hide();
|
||||
}
|
||||
|
||||
private void createTextField() {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Label nameLabel = new Label("Port:\t");
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
|
||||
portInput = new TextField("");
|
||||
|
||||
portInput.setColor(ColorRGBA.Black);
|
||||
portInput.setTextHAlignment(HAlignment.Left);
|
||||
portInput.setFontSize(fontSize);
|
||||
portInput.setSingleLine(true);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
portInput.setBackground(grayBackground);
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(portInput);
|
||||
|
||||
container.addChild(subContainer);
|
||||
public void update() {
|
||||
portInput.update();
|
||||
}
|
||||
|
||||
protected void createButton(Container c, String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
public String getPort() {
|
||||
return portInput.getString();
|
||||
}
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
c.addChild(button);
|
||||
public void resetPort() {
|
||||
portInput.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class InterruptDialog {
|
||||
}
|
||||
@@ -1,192 +1,77 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import pp.mdga.client.button.ButtonLeft;
|
||||
import pp.mdga.client.button.ButtonRight;
|
||||
import pp.mdga.client.button.InputButton;
|
||||
import pp.mdga.client.button.MenuButton;
|
||||
import pp.mdga.client.view.MainView;
|
||||
|
||||
public class JoinDialog extends Dialog {
|
||||
private TextField portInput;
|
||||
private TextField ipInput;
|
||||
private InputButton ipInput;
|
||||
private InputButton portInput;
|
||||
|
||||
public JoinDialog(MdgaApp app, Node node, Runnable backAction) {
|
||||
private ButtonRight joinButton;
|
||||
private ButtonLeft backButton;
|
||||
|
||||
private final MainView view;
|
||||
|
||||
public JoinDialog(MdgaApp app, Node node, MainView view) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
this.view = view;
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
|
||||
ipInput = new InputButton(app, node, "Ip: ", 15);
|
||||
portInput = new InputButton(app, node, "Port: ", 5);
|
||||
|
||||
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
|
||||
joinButton = new ButtonRight(app, node, view::forward, "Spiel beitreten", 10);
|
||||
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
||||
|
||||
Panel imagePanel = new Panel();
|
||||
imagePanel.setBackground(b);
|
||||
float offset = 3.0f;
|
||||
|
||||
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4 * app.getResolutionFactor(), texture.getImage().getHeight() / 4 * app.getResolutionFactor(), 0));
|
||||
ipInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.5f;
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createIpField();
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createPortField();
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
Container sub = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
createButton(sub, "Abbrechen", backAction, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
|
||||
sub.addChild(new Panel(40 * app.getResolutionFactor(), 0 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
|
||||
createButton(sub, "Beitreten", () -> tryJoin(), new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
|
||||
container.addChild(sub);
|
||||
}
|
||||
|
||||
void tryJoin() {
|
||||
if (null == portInput.getText()) {
|
||||
portInput.setText("");
|
||||
ipInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
int port = 0;
|
||||
|
||||
try {
|
||||
port = Integer.parseInt(portInput.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
portInput.setText("");
|
||||
ipInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(port >= 1 && port <= 65535)) {
|
||||
portInput.setText("");
|
||||
ipInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
if (null == ipInput.getText()) {
|
||||
portInput.setText("");
|
||||
ipInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
String ipv4Pattern = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
|
||||
|
||||
if(!Pattern.matches(ipv4Pattern, ipInput.getText())) {
|
||||
portInput.setText("");
|
||||
ipInput.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
app.getModelSyncronizer().setJoin(ipInput.getText(), port);
|
||||
portInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
container.setLocalTranslation(
|
||||
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
|
||||
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
|
||||
0
|
||||
);
|
||||
protected void onShow() {
|
||||
ipInput.show();
|
||||
portInput.show();
|
||||
joinButton.show();
|
||||
backButton.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
protected void onHide() {
|
||||
ipInput.hide();
|
||||
portInput.hide();
|
||||
joinButton.hide();
|
||||
backButton.hide();
|
||||
}
|
||||
|
||||
private void createPortField() {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Label nameLabel = new Label("Port:\t");
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
|
||||
portInput = new TextField("");
|
||||
|
||||
portInput.setColor(ColorRGBA.Black);
|
||||
portInput.setTextHAlignment(HAlignment.Left);
|
||||
portInput.setFontSize(fontSize);
|
||||
portInput.setSingleLine(true);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
portInput.setBackground(grayBackground);
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(portInput);
|
||||
|
||||
container.addChild(subContainer);
|
||||
public void update() {
|
||||
ipInput.update();
|
||||
portInput.update();
|
||||
}
|
||||
|
||||
private void createIpField() {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Label nameLabel = new Label("Ip:\t");
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
|
||||
ipInput = new TextField("");
|
||||
|
||||
ipInput.setColor(ColorRGBA.Black);
|
||||
ipInput.setTextHAlignment(HAlignment.Left);
|
||||
ipInput.setFontSize(fontSize);
|
||||
ipInput.setSingleLine(true);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
ipInput.setBackground(grayBackground);
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(ipInput);
|
||||
|
||||
container.addChild(subContainer);
|
||||
public String getIpt() {
|
||||
return ipInput.getString();
|
||||
}
|
||||
|
||||
protected void createButton(Container c, String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
public void resetIp() {
|
||||
ipInput.reset();
|
||||
}
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
public String getPort() {
|
||||
return portInput.getString();
|
||||
}
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
c.addChild(button);
|
||||
public void resetPort() {
|
||||
portInput.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Command;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
public class LobbyButtonDialog extends Dialog {
|
||||
private final int pos;
|
||||
|
||||
private Button button;
|
||||
|
||||
private Command<Button> clickCommand;
|
||||
|
||||
private boolean taken = false;
|
||||
|
||||
private final String label;
|
||||
|
||||
private int val;
|
||||
|
||||
public LobbyButtonDialog(MdgaApp app, Node node, String label, int pos) {
|
||||
super(app, node);
|
||||
|
||||
clickCommand = (Button source) -> {
|
||||
toggleButton();
|
||||
};
|
||||
|
||||
this.pos = pos;
|
||||
|
||||
this.label = label;
|
||||
this.button = new Button(label);
|
||||
this.button.setFontSize(fontSize);
|
||||
|
||||
val = pos;
|
||||
|
||||
createNotTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
float x = ((2 + (4 * pos)) * horitontal_step) - ((0.33333333f * pos) * container.getPreferredSize().x);
|
||||
float y = 6 * vertical_step;
|
||||
|
||||
container.setLocalTranslation(x, y, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
public void setTaken(boolean isTaken, boolean self, String name) {
|
||||
taken = isTaken;
|
||||
|
||||
if(isTaken) {
|
||||
createTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0), self);
|
||||
|
||||
button.setText(label + "\n\n" + name);
|
||||
} else {
|
||||
createNotTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0));
|
||||
|
||||
button.setText(label);
|
||||
}
|
||||
}
|
||||
|
||||
protected void createNotTakenButton(Vector3f size) {
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
if(button.getClickCommands() != null) {
|
||||
button.removeClickCommands(clickCommand);
|
||||
}
|
||||
|
||||
button.addClickCommands(clickCommand);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
container.addChild(button);
|
||||
}
|
||||
|
||||
private void toggleButton() {
|
||||
if(taken) {
|
||||
app.getModelSyncronizer().unselectTsk();
|
||||
}
|
||||
else {
|
||||
app.getModelSyncronizer().selectTsk(Color.values()[val]);
|
||||
}
|
||||
}
|
||||
|
||||
protected void createTakenButton(Vector3f size, boolean self) {
|
||||
ColorRGBA color_a;
|
||||
ColorRGBA color_b;
|
||||
|
||||
if(button.getClickCommands() != null) {
|
||||
button.removeClickCommands(clickCommand);
|
||||
}
|
||||
|
||||
if(!self) {
|
||||
color_a = ColorRGBA.Red;
|
||||
color_b = ColorRGBA.Red;
|
||||
} else {
|
||||
color_a = ColorRGBA.Green;
|
||||
color_b = ColorRGBA.Yellow;
|
||||
|
||||
button.addClickCommands(clickCommand);
|
||||
}
|
||||
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(color_a);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(color_b);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(color_a);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
container.addChild(button);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class PercentRunnable {
|
||||
private final Consumer<Float> action;
|
||||
|
||||
public PercentRunnable(Consumer<Float> action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void run(float percent) {
|
||||
action.accept(percent);
|
||||
}
|
||||
}
|
||||
@@ -1,112 +1,5 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import com.simsilica.lemur.event.CursorListener;
|
||||
import com.simsilica.lemur.event.CursorMotionEvent;
|
||||
import com.simsilica.lemur.event.MouseEventControl;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.style.*;
|
||||
public class SettingsDialog {
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SettingsDialog extends Dialog {
|
||||
private TextField nameInput;
|
||||
|
||||
private HashMap<Slider, PercentRunnable> map = new HashMap<Slider, PercentRunnable>();
|
||||
private HashMap<Slider, GetPercentRunnable> map2 = new HashMap<Slider, GetPercentRunnable>();
|
||||
|
||||
public SettingsDialog(MdgaApp app, Node node, String path) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture(path);
|
||||
|
||||
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
|
||||
|
||||
Panel imagePanel = new Panel();
|
||||
imagePanel.setBackground(b);
|
||||
|
||||
container.addChild(imagePanel).setPreferredSize(new Vector3f((texture.getImage().getWidth() / 2) * app.getResolutionFactor(), (texture.getImage().getHeight() / 2) * app.getResolutionFactor(), 0));
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(80 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
container.setLocalTranslation(
|
||||
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
|
||||
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
public void addButton(String label, Runnable action, Vector3f size) {
|
||||
createButton(label, action, size);
|
||||
}
|
||||
|
||||
public void addSlider(String label, PercentRunnable action, GetPercentRunnable action2, Vector3f size, int start) {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Slider slider = new Slider("slider");
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
slider.setBackground(background);
|
||||
|
||||
slider.setPreferredSize(size);
|
||||
slider.setModel(new DefaultRangedValueModel(0, 100, start));
|
||||
slider.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 30 * app.getResolutionFactor(), 0));
|
||||
slider.getDecrementButton().setText(" - ");
|
||||
slider.getIncrementButton().setText(" + ");
|
||||
slider.getDecrementButton().setFontSize(25 * app.getResolutionFactor());
|
||||
slider.getIncrementButton().setFontSize(25 * app.getResolutionFactor());
|
||||
|
||||
Label nameLabel = new Label(label);
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
nameLabel.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), 0));
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(slider);
|
||||
|
||||
container.addChild(subContainer);
|
||||
|
||||
map.put(slider, action);
|
||||
map2.put(slider, action2);
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(20 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
}
|
||||
|
||||
public void initVolume() {
|
||||
map2.forEach((slider, runnable) -> {
|
||||
double val = (double) runnable.get();
|
||||
slider.getModel().setPercent(val);
|
||||
});
|
||||
}
|
||||
|
||||
public void update() {
|
||||
map.forEach((slider, runnable) -> {
|
||||
float val = (float) slider.getModel().getPercent();
|
||||
runnable.run(val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SingleButtonLeftDialog extends Dialog {
|
||||
public SingleButtonLeftDialog(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
float x = 2 * horitontal_step;
|
||||
float y = 1.8f * vertical_step;
|
||||
|
||||
container.setLocalTranslation(x, y, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SingleButtonRightDialog extends Dialog {
|
||||
public SingleButtonRightDialog(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
float x = (14 * horitontal_step) - container.getPreferredSize().x;
|
||||
float y = 1.8f * vertical_step;
|
||||
|
||||
container.setLocalTranslation(x, y, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SingleButtonTopRight extends Dialog {
|
||||
public SingleButtonTopRight(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
|
||||
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
float x = (14 * horitontal_step) - container.getPreferredSize().x;
|
||||
float y = 8.5f * vertical_step;
|
||||
|
||||
container.setLocalTranslation(x, y, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
button.setFontSize(fontSize);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setPreferredSize(size);
|
||||
button.setTextHAlignment(HAlignment.Center);
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.Red);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(ColorRGBA.Yellow);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(ColorRGBA.Red);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
});
|
||||
|
||||
container.addChild(button);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +1,189 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.button.InputButton;
|
||||
import pp.mdga.client.button.MenuButton;
|
||||
import pp.mdga.client.view.MainView;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
public class StartDialog extends Dialog {
|
||||
private TextField nameInput;
|
||||
private InputButton nameInput;
|
||||
|
||||
public StartDialog(MdgaApp app, Node node) {
|
||||
private MenuButton hostButton;
|
||||
private MenuButton joinButton;
|
||||
private MenuButton endButton;
|
||||
|
||||
private final MainView view;
|
||||
|
||||
public StartDialog(MdgaApp app, Node node, MainView view) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
this.view = view;
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
|
||||
nameInput = new InputButton(app, node, "Name: ", 16);
|
||||
|
||||
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
|
||||
hostButton = new MenuButton(app, node, () -> view.forward(true), "Spiel hosten");
|
||||
joinButton = new MenuButton(app, node, () -> view.forward(false), "Spiel beitreten");
|
||||
endButton = new MenuButton(app, node, app::stop, "Spiel beenden");
|
||||
|
||||
Panel imagePanel = new Panel();
|
||||
imagePanel.setBackground(b);
|
||||
float offset = 2.0f;
|
||||
|
||||
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4, texture.getImage().getHeight() / 4, 0));
|
||||
nameInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.5f;
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
hostButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.25f;
|
||||
|
||||
createTextField();
|
||||
joinButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
|
||||
offset += 1.25f;
|
||||
|
||||
//abstandshalter
|
||||
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
endButton.setPos(new Vector2f(0, MenuButton.VERTICAL -offset));
|
||||
offset += 1.25f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
protected void onShow() {
|
||||
nameInput.show();
|
||||
|
||||
container.setLocalTranslation(
|
||||
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
|
||||
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
|
||||
0
|
||||
);
|
||||
hostButton.show();
|
||||
joinButton.show();
|
||||
endButton.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
protected void onHide ()
|
||||
{
|
||||
nameInput.hide();
|
||||
|
||||
hostButton.hide();
|
||||
joinButton.hide();
|
||||
endButton.hide();
|
||||
}
|
||||
|
||||
public void addButton(String label, Runnable action, Vector3f size) {
|
||||
createButton(label, action, size);
|
||||
}
|
||||
|
||||
private void createTextField() {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Label nameLabel = new Label("Name:\t");
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
|
||||
nameInput = new TextField("");
|
||||
|
||||
nameInput.setColor(ColorRGBA.Black);
|
||||
nameInput.setTextHAlignment(HAlignment.Left);
|
||||
nameInput.setFontSize(fontSize);
|
||||
nameInput.setSingleLine(true);
|
||||
|
||||
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
nameInput.setBackground(grayBackground);
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(nameInput);
|
||||
|
||||
container.addChild(subContainer);
|
||||
public void update() {
|
||||
nameInput.update();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return nameInput.getText();
|
||||
String name = nameInput.getString();
|
||||
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
String[] names = {
|
||||
"PixelPirat",
|
||||
"NoobJäger",
|
||||
"LagMeister",
|
||||
"KnopfDrücker",
|
||||
"SpawnCamper",
|
||||
"AFKHeld",
|
||||
"RageQuitter",
|
||||
"GameOverPro",
|
||||
"Checkpoint",
|
||||
"RespawnHeld",
|
||||
"Teebeutel",
|
||||
"GlitchHexer",
|
||||
"QuickScope",
|
||||
"LootSammler",
|
||||
"EpicLauch",
|
||||
"KartoffelPro",
|
||||
"StilleKlinge",
|
||||
"TastenHeld",
|
||||
"PixelKrieger",
|
||||
"HacknSlash",
|
||||
"JoystickJoe",
|
||||
"SpawnFalle",
|
||||
"OneHitWanda",
|
||||
"CamperKing",
|
||||
"GameGenie",
|
||||
"HighPing",
|
||||
"CheesePro",
|
||||
"Speedy",
|
||||
"GigaGamer",
|
||||
"LevelNoob",
|
||||
"SkillTobi",
|
||||
"HeadshotMax",
|
||||
"PentaPaul",
|
||||
"CritKarl",
|
||||
"ManaLeerer",
|
||||
"Nachlader",
|
||||
"ClutchKönig",
|
||||
"FriendlyFe",
|
||||
"ZonenHeld",
|
||||
"SchleichKatze",
|
||||
"ShotgunPro",
|
||||
"SniperUdo",
|
||||
"BossHunter",
|
||||
"HeldenNoob",
|
||||
"KillFranz",
|
||||
"FragKarl",
|
||||
"TeamNiete",
|
||||
"LootPaul",
|
||||
"UltraNoob",
|
||||
"ProfiScout",
|
||||
"PunkteKlaus",
|
||||
"KrüppelKill",
|
||||
"PixelNinja",
|
||||
"NoobCrusher",
|
||||
"LagBoss",
|
||||
"SpawnKing",
|
||||
"AFKSlayer",
|
||||
"RespawnPro",
|
||||
"Killjoy",
|
||||
"GameBreaker",
|
||||
"FastFingers",
|
||||
"LootKing",
|
||||
"QuickFlick",
|
||||
"SilentShot",
|
||||
"HackGod",
|
||||
"GlitchHero",
|
||||
"SpeedyBot",
|
||||
"AimWizard",
|
||||
"FragMaster",
|
||||
"OneTapPro",
|
||||
"KnifeLord",
|
||||
"MetaHunter",
|
||||
"PingWarrior",
|
||||
"KeyBash",
|
||||
"ClutchPro",
|
||||
"ScopeBot",
|
||||
"TrollMage",
|
||||
"PowerLooter",
|
||||
"TankHero",
|
||||
"CampLord",
|
||||
"SmurfSlayer",
|
||||
"SkillThief",
|
||||
"SniperGod",
|
||||
"LevelHack",
|
||||
"GhostAim",
|
||||
"BossTamer",
|
||||
"ShotgunJoe",
|
||||
"AimRider",
|
||||
"KillCount",
|
||||
"PixelManiac",
|
||||
"TrollOver",
|
||||
"SneakPro",
|
||||
"ReloadKing",
|
||||
"SpawnTrap",
|
||||
"LagLover",
|
||||
"MetaHater",
|
||||
"BoomMaker",
|
||||
"WipeLord",
|
||||
"CarryPro",
|
||||
"ProBaiter",
|
||||
"GameWarden",
|
||||
};
|
||||
|
||||
Random random = new Random();
|
||||
name = names[random.nextInt(names.length)];
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class VideoSettingsDialog {
|
||||
}
|
||||
@@ -1,45 +1,49 @@
|
||||
package pp.mdga.client.dialog;
|
||||
package pp.mdga.client.dialog2;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.HAlignment;
|
||||
import com.simsilica.lemur.Panel;
|
||||
import com.simsilica.lemur.VAlignment;
|
||||
import com.simsilica.lemur.component.IconComponent;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SettingsButtonDialog extends Dialog {
|
||||
private IconComponent icon;
|
||||
public abstract class Dialog {
|
||||
protected final ColorRGBA COLOR_DEFAULT = ColorRGBA.Gray;
|
||||
protected final ColorRGBA COLOR_HOVER = ColorRGBA.DarkGray;
|
||||
|
||||
public SettingsButtonDialog(MdgaApp app, Node node, String label, Runnable action) {
|
||||
super(app, node);
|
||||
protected Container container;
|
||||
|
||||
icon = new IconComponent("Images/zahnrad.png");
|
||||
icon.setIconScale(0.1f * app.getResolutionFactor());
|
||||
protected final MdgaApp app;
|
||||
private final Node node;
|
||||
|
||||
createButton(label, action, new Vector3f(60 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
|
||||
protected final float vertical_step;
|
||||
protected final float horitontal_step;
|
||||
|
||||
protected float fontSize = 35;
|
||||
|
||||
public Dialog(MdgaApp app, Node node) {
|
||||
this.app = app;
|
||||
this.node = node;
|
||||
this.container = new Container();
|
||||
|
||||
this.horitontal_step = app.getCamera().getWidth() / 16;
|
||||
this.vertical_step = app.getCamera().getHeight() / 9;
|
||||
|
||||
//int val = (int) (32 * Math.min(app.getResolutionFactor() * 0.9f, 1));
|
||||
//fontSize = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
float x = (15.5f * horitontal_step) - container.getPreferredSize().x;
|
||||
float y = 8.5f * vertical_step;
|
||||
|
||||
container.setLocalTranslation(x, y, 0);
|
||||
node.attachChild(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
public void hide () {
|
||||
node.detachChild(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
Button button = new Button(label);
|
||||
button.addClickCommands(source -> action.run());
|
||||
@@ -51,28 +55,26 @@ protected void createButton(String label, Runnable action, Vector3f size) {
|
||||
button.setTextVAlignment(VAlignment.Center);
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
//background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
button.setBackground(background);
|
||||
button.setIcon(icon);
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
|
||||
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
|
||||
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
// hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(hoverBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setIcon(icon);
|
||||
});
|
||||
|
||||
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
|
||||
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
|
||||
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
// normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
|
||||
source.setBackground(normalBackground);
|
||||
button.setHighlightColor(ColorRGBA.White);
|
||||
button.setColor(ColorRGBA.Black);
|
||||
button.setIcon(icon);
|
||||
});
|
||||
|
||||
container.addChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package pp.mdga.client.dialog2;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.*;
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SettingsDialog extends Dialog {
|
||||
private TextField nameInput;
|
||||
|
||||
//private HashMap<Slider, PercentRunnable> map = new HashMap<Slider, PercentRunnable>();
|
||||
//private HashMap<Slider, GetPercentRunnable> map2 = new HashMap<Slider, GetPercentRunnable>();
|
||||
|
||||
public SettingsDialog(MdgaApp app, Node node, String path) {
|
||||
super(app, node);
|
||||
|
||||
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
|
||||
//quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
|
||||
container.setBackground(quad1);
|
||||
|
||||
Texture texture = app.getAssetManager().loadTexture(path);
|
||||
|
||||
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
|
||||
|
||||
Panel imagePanel = new Panel();
|
||||
imagePanel.setBackground(b);
|
||||
|
||||
// container.addChild(imagePanel).setPreferredSize(new Vector3f((texture.getImage().getWidth() / 2) * app.getResolutionFactor(), (texture.getImage().getHeight() / 2) * app.getResolutionFactor(), 0));
|
||||
|
||||
//abstandshalter
|
||||
// container.addChild(new Panel(80 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
|
||||
container.setLocalTranslation(
|
||||
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
|
||||
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
}
|
||||
|
||||
public void addButton(String label, Runnable action, Vector3f size) {
|
||||
createButton(label, action, size);
|
||||
}
|
||||
|
||||
/*public void addSlider(String label, PercentRunnable action, GetPercentRunnable action2, Vector3f size, int start) {
|
||||
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
|
||||
|
||||
Slider slider = new Slider("slider");
|
||||
|
||||
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.DarkGray);
|
||||
slider.setBackground(background);
|
||||
|
||||
slider.setPreferredSize(size);
|
||||
slider.setModel(new DefaultRangedValueModel(0, 100, start));
|
||||
//slider.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 30 * app.getResolutionFactor(), 0));
|
||||
slider.getDecrementButton().setText(" - ");
|
||||
slider.getIncrementButton().setText(" + ");
|
||||
// slider.getDecrementButton().setFontSize(25 * app.getResolutionFactor());
|
||||
// slider.getIncrementButton().setFontSize(25 * app.getResolutionFactor());
|
||||
|
||||
Label nameLabel = new Label(label);
|
||||
nameLabel.setFontSize(fontSize);
|
||||
nameLabel.setColor(ColorRGBA.Black);
|
||||
// nameLabel.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), 0));
|
||||
|
||||
subContainer.addChild(nameLabel);
|
||||
subContainer.addChild(slider);
|
||||
|
||||
container.addChild(subContainer);
|
||||
|
||||
map.put(slider, action);
|
||||
map2.put(slider, action2);
|
||||
|
||||
//abstandshalter
|
||||
// container.addChild(new Panel(20 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), ColorRGBA.Gray));
|
||||
}
|
||||
|
||||
public void initVolume() {
|
||||
map2.forEach((slider, runnable) -> {
|
||||
double val = (double) runnable.get();
|
||||
slider.getModel().setPercent(val);
|
||||
});
|
||||
}
|
||||
|
||||
public void update() {
|
||||
map.forEach((slider, runnable) -> {
|
||||
float val = (float) slider.getModel().getPercent();
|
||||
runnable.run(val);
|
||||
});
|
||||
}*/
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
|
||||
public class CeremonyView extends MdgaView {
|
||||
|
||||
private enum SubState {
|
||||
AWARD_CEREMONY,
|
||||
STATISTICS,
|
||||
@@ -15,16 +12,10 @@ private enum SubState {
|
||||
|
||||
private SubState state;
|
||||
|
||||
private SingleButtonRightDialog continueButton;
|
||||
private SingleButtonLeftDialog backButton;
|
||||
|
||||
private Geometry background;
|
||||
|
||||
public CeremonyView(MdgaApp app) {
|
||||
super(app);
|
||||
|
||||
continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> forward());
|
||||
backButton = new SingleButtonLeftDialog(app, node, "Zurück", () -> back());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,36 +25,33 @@ public void onEnter() {
|
||||
|
||||
@Override
|
||||
public void onLeave() {
|
||||
continueButton.hide();
|
||||
backButton.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnterOverlay(Overlay overlay) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLeaveOverlay(Overlay overlay) {
|
||||
}
|
||||
|
||||
private void awardCeremony() {
|
||||
background = createBackground("Images/b1.png");
|
||||
node.attachChild(background);
|
||||
|
||||
continueButton.show();
|
||||
backButton.hide();
|
||||
guiNode.attachChild(background);
|
||||
}
|
||||
|
||||
private void statistics() {
|
||||
background = createBackground("Images/b2.png");
|
||||
node.attachChild(background);
|
||||
|
||||
continueButton.show();
|
||||
backButton.show();
|
||||
guiNode.attachChild(background);
|
||||
}
|
||||
|
||||
private void enterSub(SubState state) {
|
||||
this.state = state;
|
||||
|
||||
if(null != background) {
|
||||
node.detachChild(background);
|
||||
guiNode.detachChild(background);
|
||||
}
|
||||
|
||||
backButton.hide();
|
||||
continueButton.hide();
|
||||
|
||||
switch (state) {
|
||||
case AWARD_CEREMONY:
|
||||
awardCeremony();
|
||||
|
||||
@@ -1,43 +1,27 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.input.KeyInput;
|
||||
import com.jme3.input.MouseInput;
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
import com.jme3.input.controls.KeyTrigger;
|
||||
import com.jme3.input.controls.MouseButtonTrigger;
|
||||
import com.jme3.post.FilterPostProcessor;
|
||||
import com.jme3.post.filters.ComposeFilter;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image;
|
||||
import com.jme3.texture.Texture2D;
|
||||
import pp.mdga.client.board.BoardHandler;
|
||||
import pp.mdga.client.board.CameraHandler;
|
||||
import pp.mdga.client.dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
import pp.mdga.client.gui.GuiHandler;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GameView extends MdgaView {
|
||||
private BoardHandler boardHandler;
|
||||
private CameraHandler camera;
|
||||
private GuiHandler guiHandler;
|
||||
|
||||
private SingleButtonLeftDialog leaveButton;
|
||||
private SingleButtonRightDialog continueButton;
|
||||
|
||||
public GameView(MdgaApp app) {
|
||||
super(app);
|
||||
|
||||
//Filter für Outline: Reihenfolge CameraHandler(dlsf) -> BoardHandler -> viewPort.addProcessor einhalten!
|
||||
FilterPostProcessor fpp = new FilterPostProcessor(app.getAssetManager());
|
||||
this.camera = new CameraHandler(app, fpp);
|
||||
this.boardHandler = new BoardHandler(app, fpp);
|
||||
|
||||
//TODO sollte das onLeave nicht vlt rückgänging gemacht werden??
|
||||
app.getViewPort().addProcessor(fpp);
|
||||
|
||||
FrameBuffer backFrameBuffer = new FrameBuffer(app.getCamera().getWidth(), app.getCamera().getHeight(), 1);
|
||||
@@ -47,10 +31,7 @@ public GameView(MdgaApp app) {
|
||||
app.getViewPort().setOutputFrameBuffer(backFrameBuffer);
|
||||
|
||||
this.guiHandler = new GuiHandler(app, backTexture);
|
||||
|
||||
leaveButton = new SingleButtonLeftDialog(app, settingsNode, "Verlassen", () -> leaveGame());
|
||||
|
||||
continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY));
|
||||
//TODO ---------------------------------------------------------
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,51 +39,32 @@ public void onEnter() {
|
||||
camera.init();
|
||||
boardHandler.init();
|
||||
guiHandler.init();
|
||||
continueButton.show();
|
||||
|
||||
|
||||
|
||||
// boardHandler.addPlayer(Color.AIRFORCE, test);
|
||||
// boardHandler.movePieceStart(player0, 0);
|
||||
// boardHandler.enableHover(player0);
|
||||
// boardHandler.enableHover(player1);
|
||||
// boardHandler.highlight(player0, true);
|
||||
|
||||
|
||||
|
||||
// boardHandler.outline(player0, true);
|
||||
|
||||
// boardHandler.outline(10);
|
||||
|
||||
guiHandler.test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeave() {
|
||||
continueButton.hide();
|
||||
|
||||
camera.shutdown();
|
||||
boardHandler.shutdown();
|
||||
guiHandler.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
public void onUpdate(float tpf) {
|
||||
camera.update(app.getInputSyncronizer().getScroll(), app.getInputSyncronizer().getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enterExtendedSettings() {
|
||||
leaveButton.show();
|
||||
protected void onEnterOverlay(Overlay overlay) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leaveExtendedSettings() {
|
||||
leaveButton.hide();
|
||||
protected void onLeaveOverlay(Overlay overlay)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void leaveGame() {
|
||||
leaveSettings(false);
|
||||
|
||||
app.getModelSyncronizer().leave();
|
||||
|
||||
app.afteGameCleanup();
|
||||
|
||||
@@ -1,59 +1,175 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.asset.TextureKey;
|
||||
import com.jme3.light.AmbientLight;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.dialog.LobbyButtonDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonLeftDialog;
|
||||
import pp.mdga.client.dialog.SingleButtonRightDialog;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
import pp.mdga.client.button.ButtonLeft;
|
||||
import pp.mdga.client.button.ButtonRight;
|
||||
import pp.mdga.client.button.LobbyButton;
|
||||
import pp.mdga.client.button.SettingsButton;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LobbyView extends MdgaView {
|
||||
private Geometry background;
|
||||
|
||||
private SingleButtonRightDialog readyButton;
|
||||
private SingleButtonLeftDialog leaveButton;
|
||||
private SettingsButton settingsButton;
|
||||
|
||||
private ArrayList<LobbyButtonDialog> lobbyButtons = new ArrayList<>();
|
||||
private ButtonLeft leaveButton;
|
||||
private ButtonRight readyButton;
|
||||
|
||||
private LobbyButton cyberButton;
|
||||
private LobbyButton airforceButton;
|
||||
private LobbyButton armyButton;
|
||||
private LobbyButton navyButton;
|
||||
|
||||
private AmbientLight ambient = new AmbientLight();;
|
||||
|
||||
public LobbyView(MdgaApp app) {
|
||||
super(app);
|
||||
|
||||
background = createBackground("Images/lobby.png");
|
||||
node.attachChild(background);
|
||||
TextureKey key = new TextureKey("Images/map3.png", false);
|
||||
Texture skyTexture = app.getAssetManager().loadTexture(key);
|
||||
Spatial sky = SkyFactory.createSky(app.getAssetManager(), skyTexture, SkyFactory.EnvMapType.SphereMap);
|
||||
rootNode.attachChild(sky);
|
||||
|
||||
readyButton = new SingleButtonRightDialog(app, node, "Fertig", () -> app.getModelSyncronizer().setReady());
|
||||
leaveButton = new SingleButtonLeftDialog(app, node, "Verlassen", () -> app.getModelSyncronizer().leave());
|
||||
settingsButton = new SettingsButton(app, guiNode, this::clickSettings);
|
||||
|
||||
lobbyButtons.add(new LobbyButtonDialog(app, node, "HEER", 0));
|
||||
lobbyButtons.add(new LobbyButtonDialog(app, node, "MARINE", 1));
|
||||
lobbyButtons.add(new LobbyButtonDialog(app, node, "CIR", 2));
|
||||
lobbyButtons.add(new LobbyButtonDialog(app, node, "LUFTWAFFE", 3));
|
||||
leaveButton = new ButtonLeft(app, guiNode, this::leaveLobby, "Verlassen", 1);
|
||||
readyButton = new ButtonRight(app, guiNode, this::ready, "Bereit", 1);
|
||||
|
||||
cyberButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.CYBER), Color.CYBER);
|
||||
airforceButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.AIRFORCE), Color.AIRFORCE);
|
||||
armyButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.ARMY), Color.ARMY);
|
||||
navyButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.NAVY), Color.NAVY);
|
||||
|
||||
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnter() {
|
||||
readyButton.show();
|
||||
leaveButton.show();
|
||||
settingsButton.show();
|
||||
|
||||
for (LobbyButtonDialog b : lobbyButtons) {
|
||||
b.show();
|
||||
}
|
||||
leaveButton.show();
|
||||
readyButton.show();
|
||||
|
||||
cyberButton.show();
|
||||
airforceButton.show();
|
||||
armyButton.show();
|
||||
navyButton.show();
|
||||
|
||||
rootNode.addLight(ambient);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeave() {
|
||||
for (LobbyButtonDialog b : lobbyButtons) {
|
||||
b.hide();
|
||||
}
|
||||
settingsButton.hide();
|
||||
|
||||
readyButton.hide();
|
||||
leaveButton.hide();
|
||||
readyButton.hide();
|
||||
|
||||
airforceButton.hide();
|
||||
armyButton.hide();
|
||||
navyButton.hide();
|
||||
cyberButton.hide();
|
||||
|
||||
rootNode.removeLight(ambient);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUpdate(float tpf) {
|
||||
airforceButton.update(tpf);
|
||||
armyButton.update(tpf);
|
||||
navyButton.update(tpf);
|
||||
cyberButton.update(tpf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnterOverlay(Overlay overlay) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLeaveOverlay(Overlay overlay)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setTaken(Color color, boolean isTaken, boolean isSelf, String name) {
|
||||
lobbyButtons.get(color.ordinal()).setTaken(isTaken, isSelf, name);
|
||||
LobbyButton.Taken taken;
|
||||
|
||||
if(isTaken) {
|
||||
if(isSelf) {
|
||||
taken = LobbyButton.Taken.SELF;
|
||||
} else {
|
||||
taken = LobbyButton.Taken.OTHER;
|
||||
}
|
||||
} else {
|
||||
taken = LobbyButton.Taken.NOT;
|
||||
}
|
||||
|
||||
switch (color) {
|
||||
case CYBER:
|
||||
cyberButton.setTaken(taken, name);
|
||||
break;
|
||||
case AIRFORCE:
|
||||
airforceButton.setTaken(taken, name);
|
||||
break;
|
||||
case ARMY:
|
||||
armyButton.setTaken(taken, name);
|
||||
break;
|
||||
case NAVY:
|
||||
navyButton.setTaken(taken, name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleTsk(Color color) {
|
||||
LobbyButton.Taken taken = LobbyButton.Taken.NOT;
|
||||
|
||||
switch (color) {
|
||||
case CYBER:
|
||||
taken = cyberButton.getTaken();
|
||||
break;
|
||||
case AIRFORCE:
|
||||
taken = airforceButton.getTaken();
|
||||
break;
|
||||
case ARMY:
|
||||
taken = armyButton.getTaken();
|
||||
break;
|
||||
case NAVY:
|
||||
taken = navyButton.getTaken();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (taken) {
|
||||
case NOT:
|
||||
app.getModelSyncronizer().selectTsk(color);
|
||||
break;
|
||||
case SELF:
|
||||
app.getModelSyncronizer().unselectTsk();
|
||||
break;
|
||||
case OTHER:
|
||||
//nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ready() {
|
||||
app.getModelSyncronizer().setReady();
|
||||
//TODO: playSound
|
||||
}
|
||||
|
||||
private void leaveLobby() {
|
||||
app.getModelSyncronizer().leave();
|
||||
//TODO: playSound
|
||||
}
|
||||
|
||||
private void clickSettings() {
|
||||
//TODO: playSound
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,201 @@
|
||||
package pp.mdga.client.view;
|
||||
|
||||
import com.jme3.scene.Geometry;
|
||||
import pp.mdga.client.dialog.Dialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.MdgaState;
|
||||
import pp.mdga.client.button.ButtonRight;
|
||||
import pp.mdga.client.button.MenuButton;
|
||||
import pp.mdga.client.button.SettingsButton;
|
||||
import pp.mdga.client.dialog.HostDialog;
|
||||
import pp.mdga.client.dialog.JoinDialog;
|
||||
import pp.mdga.client.dialog.StartDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
import com.jme3.math.Vector3f;
|
||||
|
||||
public class MainView extends MdgaView {
|
||||
private enum SubState {
|
||||
HOST,
|
||||
JOIN,
|
||||
MAIN,
|
||||
}
|
||||
|
||||
private SubState state;
|
||||
|
||||
private Geometry background;
|
||||
|
||||
private StartDialog dialog;
|
||||
private Dialog subDialog;
|
||||
private SettingsButton settingsButton;
|
||||
|
||||
private StartDialog startDialog;
|
||||
private JoinDialog joinDialog;
|
||||
private HostDialog hostDialog;
|
||||
|
||||
public MainView(MdgaApp app) {
|
||||
super(app);
|
||||
|
||||
background = createBackground("Images/powercards.png");
|
||||
node.attachChild(background);
|
||||
settingsButton = new SettingsButton(app, guiNode, this::clickSettings);
|
||||
|
||||
Vector3f size = new Vector3f(280, 60, 0);
|
||||
dialog = new StartDialog(app, node);
|
||||
dialog.addButton("Spiel beitreten", () -> enterJoin(), size);
|
||||
dialog.addButton("Spiel hosten", () -> enterHost(), size);
|
||||
dialog.addButton("Einstellungen", () -> enterSettings(false), size);
|
||||
dialog.addButton("Spiel beenden", () -> app.stop(), size);
|
||||
startDialog = new StartDialog(app, guiNode, this);
|
||||
joinDialog = new JoinDialog(app, guiNode, this);
|
||||
hostDialog = new HostDialog(app, guiNode, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnter() {
|
||||
dialog.show();
|
||||
background = createBackground("Images/main.png");
|
||||
guiNode.attachChild(background);
|
||||
|
||||
settingsButton.show();
|
||||
|
||||
enterSub(SubState.MAIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeave() {
|
||||
dialog.hide();
|
||||
startDialog.hide();
|
||||
joinDialog.hide();
|
||||
hostDialog.hide();
|
||||
|
||||
if(subDialog != null) {
|
||||
subDialog.hide();
|
||||
subDialog = null;
|
||||
settingsButton.hide();
|
||||
|
||||
guiNode.detachChild(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(float tpf) {
|
||||
startDialog.update();
|
||||
joinDialog.update();
|
||||
hostDialog.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnterOverlay(Overlay overlay) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLeaveOverlay(Overlay overlay)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void joinMenu() {
|
||||
startDialog.hide();
|
||||
hostDialog.hide();
|
||||
|
||||
joinDialog.show();
|
||||
}
|
||||
|
||||
private void hostMenu() {
|
||||
startDialog.hide();
|
||||
joinDialog.hide();
|
||||
|
||||
hostDialog.show();
|
||||
}
|
||||
|
||||
private void mainMenu() {
|
||||
joinDialog.hide();
|
||||
hostDialog.hide();
|
||||
|
||||
startDialog.show();
|
||||
}
|
||||
|
||||
private void tryHost() {
|
||||
int port = 0;
|
||||
String text = hostDialog.getPort();
|
||||
|
||||
try {
|
||||
port = Integer.parseInt(text);
|
||||
|
||||
if(port >= 1 && port <= 65535) {
|
||||
app.getModelSyncronizer().setHost(port);
|
||||
//TODO: playSound
|
||||
return;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
//nothing
|
||||
}
|
||||
|
||||
hostDialog.resetPort();
|
||||
//TODO: playSound
|
||||
}
|
||||
|
||||
private void tryJoin() {
|
||||
app.getModelSyncronizer().setJoin("127.0.0.1", 1);
|
||||
}
|
||||
|
||||
private void enterSub(SubState state) {
|
||||
this.state = state;
|
||||
|
||||
if(null != background) {
|
||||
rootNode.detachChild(background);
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case HOST:
|
||||
hostMenu();
|
||||
break;
|
||||
case JOIN:
|
||||
joinMenu();
|
||||
break;
|
||||
case MAIN:
|
||||
mainMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void enterJoin() {
|
||||
app.getModelSyncronizer().setName(dialog.getName());
|
||||
|
||||
subDialog = new JoinDialog(app, node, () -> leaveJoin());
|
||||
|
||||
dialog.hide();
|
||||
subDialog.show();
|
||||
public void forward() {
|
||||
switch (state) {
|
||||
case HOST:
|
||||
app.getModelSyncronizer().setName(startDialog.getName());
|
||||
tryHost();
|
||||
break;
|
||||
case JOIN:
|
||||
app.getModelSyncronizer().setName(startDialog.getName());
|
||||
tryJoin();
|
||||
break;
|
||||
case MAIN:
|
||||
throw new RuntimeException("call forward(boolean host) insted of forward()");
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveJoin() {
|
||||
subDialog.hide();
|
||||
dialog.show();
|
||||
|
||||
subDialog = null;
|
||||
public void forward(boolean host) {
|
||||
switch (state) {
|
||||
case HOST:
|
||||
app.getModelSyncronizer().setName(startDialog.getName());
|
||||
tryHost();
|
||||
break;
|
||||
case JOIN:
|
||||
app.getModelSyncronizer().setName(startDialog.getName());
|
||||
tryJoin();
|
||||
break;
|
||||
case MAIN:
|
||||
if(host) {
|
||||
enterSub(SubState.HOST);
|
||||
//TODO: playSound
|
||||
} else {
|
||||
enterSub(SubState.JOIN);
|
||||
//TODO: playSound
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void enterHost() {
|
||||
app.getModelSyncronizer().setName(dialog.getName());
|
||||
|
||||
subDialog = new HostDialog(app, node, () -> leaveHost());
|
||||
|
||||
dialog.hide();
|
||||
subDialog.show();
|
||||
public void back() {
|
||||
switch (state) {
|
||||
case HOST:
|
||||
enterSub(SubState.MAIN);
|
||||
//TODO: playSound
|
||||
break;
|
||||
case JOIN:
|
||||
enterSub(SubState.MAIN);
|
||||
//TODO: playSound
|
||||
break;
|
||||
case MAIN:
|
||||
//nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void leaveHost() {
|
||||
subDialog.hide();
|
||||
dialog.show();
|
||||
|
||||
subDialog = null;
|
||||
public void clickSettings() {
|
||||
//TODO: playSound
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,207 +2,85 @@
|
||||
|
||||
import com.jme3.asset.TextureKey;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
import com.jme3.texture.Texture;
|
||||
import pp.mdga.client.dialog.GetPercentRunnable;
|
||||
import pp.mdga.client.dialog.PercentRunnable;
|
||||
import pp.mdga.client.dialog.SettingsButtonDialog;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
import pp.mdga.client.dialog.SettingsDialog;
|
||||
import pp.mdga.client.button.*;
|
||||
|
||||
public abstract class MdgaView {
|
||||
public enum Overlay {
|
||||
INTERRUPT,
|
||||
SETTINGS,
|
||||
}
|
||||
|
||||
protected MdgaApp app;
|
||||
protected Node node;
|
||||
|
||||
protected int depth = 0;
|
||||
private boolean isVideo = false;
|
||||
private boolean isAudio = false;
|
||||
|
||||
protected Node settingsNode;
|
||||
protected Node audioSettingsNode;
|
||||
protected Node videoSettingsNode;
|
||||
|
||||
private SettingsButtonDialog settingsButton;
|
||||
|
||||
private Geometry settingsBackground;
|
||||
private Geometry audioBackground;
|
||||
private Geometry videoBackground;
|
||||
|
||||
private SettingsDialog settings;
|
||||
private SettingsDialog audio;
|
||||
private SettingsDialog video;
|
||||
|
||||
private static final String IMAGE_ROOT = "Images/";
|
||||
protected Node rootNode = new Node();
|
||||
protected Node guiNode = new Node();
|
||||
|
||||
public MdgaView(MdgaApp app) {
|
||||
this.app = app;
|
||||
this.node = new Node();
|
||||
|
||||
this.settingsNode = new Node();
|
||||
this.audioSettingsNode = new Node();
|
||||
this.videoSettingsNode = new Node();
|
||||
|
||||
this.settingsButton = new SettingsButtonDialog(app, node, "", () -> enterSettings(false));
|
||||
|
||||
this.settingsBackground = createBackground(IMAGE_ROOT + "background/zahnräder.png");
|
||||
settingsNode.attachChild(settingsBackground);
|
||||
|
||||
this.audioBackground = createBackground(IMAGE_ROOT + "background/lautsprecher.png");
|
||||
audioSettingsNode.attachChild(audioBackground);
|
||||
|
||||
this.videoBackground = createBackground(IMAGE_ROOT + "background/monitors.png");
|
||||
videoSettingsNode.attachChild(videoBackground);
|
||||
|
||||
Vector3f size = new Vector3f(280, 60, 0);
|
||||
|
||||
this.settings = new SettingsDialog(app, settingsNode, IMAGE_ROOT + "zahnrad.png");
|
||||
this.settings.addButton("Video", () -> enterVideo(), size);
|
||||
this.settings.addButton("Audio", () -> enterAudio(), size);
|
||||
this.settings.addButton("Zurück", () -> leaveSettings(false), size);
|
||||
|
||||
this.audio = new SettingsDialog(app, audioSettingsNode, IMAGE_ROOT + "audio_icon.png");
|
||||
this.audio.addSlider("Lautstärke", new PercentRunnable(app.getAcousticHandler()::setMainVolume), new GetPercentRunnable(app.getAcousticHandler()::getMainVolume), size, (int) app.getAcousticHandler().getMainVolume() * 100);
|
||||
this.audio.addSlider("Musik", new PercentRunnable(app.getAcousticHandler()::setMusicVolume), new GetPercentRunnable(app.getAcousticHandler()::getMusicVolume), size, (int) app.getAcousticHandler().getMusicVolume() * 100);
|
||||
this.audio.addSlider("Sound", new PercentRunnable(app.getAcousticHandler()::setSoundVolume), new GetPercentRunnable(app.getAcousticHandler()::getSoundVolume), size, (int) app.getAcousticHandler().getSoundVolume() * 100);
|
||||
this.audio.addButton("Zurück", () -> leaveAudio(), size);
|
||||
|
||||
this.video = new SettingsDialog(app, videoSettingsNode, IMAGE_ROOT + "monitor.png");
|
||||
this.video.addButton("A", () -> System.out.println("A"), size);
|
||||
this.video.addButton("B", () -> System.out.println("B"), size);
|
||||
this.video.addButton("Zurück", () -> leaveVideo(), size);
|
||||
}
|
||||
|
||||
public void enter() {
|
||||
app.getGuiNode().attachChild(node);
|
||||
|
||||
audio.initVolume();
|
||||
|
||||
settingsButton.show();
|
||||
app.getRootNode().attachChild(rootNode);
|
||||
app.getGuiNode().attachChild(guiNode);
|
||||
|
||||
onEnter();
|
||||
}
|
||||
|
||||
public void leave() {
|
||||
app.getRootNode().detachChild(rootNode);
|
||||
app.getGuiNode().detachChild(guiNode);
|
||||
|
||||
onLeave();
|
||||
|
||||
settingsButton.hide();
|
||||
|
||||
app.getGuiNode().detachChild(node);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
audio.update();
|
||||
onUpdate();
|
||||
public void enterOverlay(Overlay overlay) {
|
||||
app.getGuiNode().detachChild(guiNode);
|
||||
|
||||
onEnterOverlay(overlay);
|
||||
}
|
||||
|
||||
public void leaveOverlay(Overlay overlay) {
|
||||
app.getGuiNode().attachChild(guiNode);
|
||||
|
||||
onLeaveOverlay(overlay);
|
||||
}
|
||||
|
||||
public void update(float tpf) {
|
||||
//TODO is not necessary but will show misuse of nodes
|
||||
app.getRootNode().detachAllChildren();
|
||||
app.getGuiNode().detachAllChildren();
|
||||
app.getRootNode().attachChild(rootNode);
|
||||
app.getGuiNode().attachChild(guiNode);
|
||||
//TODO ----------------------------------------------
|
||||
|
||||
onUpdate(tpf);
|
||||
}
|
||||
|
||||
protected abstract void onEnter();
|
||||
protected abstract void onLeave();
|
||||
protected void onUpdate() {}
|
||||
protected void onUpdate(float tpf) {}
|
||||
|
||||
protected abstract void onEnterOverlay(Overlay overlay);
|
||||
protected abstract void onLeaveOverlay(Overlay overlay);
|
||||
|
||||
protected Geometry createBackground(String texturePath) {
|
||||
TextureKey key = new TextureKey(texturePath, true);
|
||||
Texture backgroundTexture = app.getAssetManager().loadTexture(key);
|
||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||
Geometry background = new Geometry("Background", quad);
|
||||
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
mat.setTexture("ColorMap", backgroundTexture);
|
||||
|
||||
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
|
||||
|
||||
Geometry background = new Geometry("Background", quad);
|
||||
background.setMaterial(mat);
|
||||
background.setLocalTranslation(0, 0, -1);
|
||||
|
||||
return background;
|
||||
}
|
||||
|
||||
protected void enterExtendedSettings() {}
|
||||
protected void leaveExtendedSettings() {}
|
||||
|
||||
protected void enterSettings(boolean soft) {
|
||||
leave();
|
||||
|
||||
app.getGuiNode().attachChild(settingsNode);
|
||||
|
||||
if(!soft) {
|
||||
depth++;
|
||||
|
||||
enterExtendedSettings();
|
||||
}
|
||||
|
||||
settings.show();
|
||||
}
|
||||
|
||||
protected void leaveSettings(boolean soft) {
|
||||
settings.hide();
|
||||
|
||||
app.getGuiNode().detachChild(settingsNode);
|
||||
|
||||
if(!soft) {
|
||||
leaveExtendedSettings();
|
||||
enter();
|
||||
depth--;
|
||||
}
|
||||
}
|
||||
|
||||
protected void enterAudio() {
|
||||
leaveSettings(true);
|
||||
|
||||
depth++;
|
||||
isAudio = true;
|
||||
|
||||
app.getGuiNode().attachChild(audioSettingsNode);
|
||||
|
||||
audio.show();
|
||||
}
|
||||
|
||||
protected void leaveAudio() {
|
||||
audio.hide();
|
||||
|
||||
app.getGuiNode().detachChild(audioSettingsNode);
|
||||
|
||||
isAudio = false;
|
||||
depth--;
|
||||
|
||||
enterSettings(true);
|
||||
}
|
||||
|
||||
protected void enterVideo() {
|
||||
leaveSettings(true);
|
||||
|
||||
app.getGuiNode().attachChild(videoSettingsNode);
|
||||
|
||||
depth++;
|
||||
|
||||
isVideo = true;
|
||||
|
||||
video.show();
|
||||
}
|
||||
|
||||
protected void leaveVideo() {
|
||||
video.hide();
|
||||
|
||||
app.getGuiNode().detachChild(videoSettingsNode);
|
||||
|
||||
depth--;
|
||||
isVideo = false;
|
||||
|
||||
enterSettings(true);
|
||||
}
|
||||
|
||||
public void pressEscape() {
|
||||
if(depth == 0) {
|
||||
enterSettings(false);
|
||||
} else if(depth == 1) {
|
||||
leaveSettings(false);
|
||||
}
|
||||
else if (depth == 2){
|
||||
if(isVideo) {
|
||||
leaveVideo();
|
||||
}
|
||||
if(isAudio) {
|
||||
leaveAudio();
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
BIN
Projekte/mdga/client/src/main/resources/Images/map3.png
Normal file
BIN
Projekte/mdga/client/src/main/resources/Images/map3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
Reference in New Issue
Block a user