Merge dev/client_koppe2
This commit is contained in:
@@ -1,18 +1,11 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
import com.jme3.app.SimpleApplication;
|
import com.jme3.app.SimpleApplication;
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.simsilica.lemur.GuiGlobals;
|
import com.simsilica.lemur.GuiGlobals;
|
||||||
import pp.mdga.client.acoustic.AcousticHandler;
|
import pp.mdga.client.acoustic.AcousticHandler;
|
||||||
import pp.mdga.client.animation.AnimationHandler;
|
import pp.mdga.client.animation.AnimationHandler;
|
||||||
import com.jme3.system.AppSettings;
|
import com.jme3.system.AppSettings;
|
||||||
import pp.mdga.client.view.*;
|
import pp.mdga.client.view.*;
|
||||||
import pp.mdga.game.Color;
|
|
||||||
import pp.mdga.notification.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class MdgaApp extends SimpleApplication {
|
public class MdgaApp extends SimpleApplication {
|
||||||
private AnimationHandler animationHandler;
|
private AnimationHandler animationHandler;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import pp.mdga.client.MdgaState;
|
import pp.mdga.client.MdgaState;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class AcousticHandler {
|
public class AcousticHandler {
|
||||||
private MdgaApp app;
|
private MdgaApp app;
|
||||||
@@ -29,8 +30,14 @@ public class AcousticHandler {
|
|||||||
|
|
||||||
private ArrayList<GameSound> sounds = new ArrayList<>();
|
private ArrayList<GameSound> sounds = new ArrayList<>();
|
||||||
|
|
||||||
|
private Preferences prefs = Preferences.userNodeForPackage(AcousticHandler.class);
|
||||||
|
|
||||||
public AcousticHandler(MdgaApp app) {
|
public AcousticHandler(MdgaApp app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
|
mainVolume = prefs.getFloat("mainVolume", 1.0f);
|
||||||
|
musicVolume = prefs.getFloat("musicVolume", 1.0f);
|
||||||
|
soundVolume = prefs.getFloat("soundVolume", 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +74,19 @@ public void playSound(MdgaSound sound) {
|
|||||||
assets.add(new SoundAssetDelayVolume(SoundAsset.LOST, 1.0f, 0.0f));
|
assets.add(new SoundAssetDelayVolume(SoundAsset.LOST, 1.0f, 0.0f));
|
||||||
break;
|
break;
|
||||||
case VICTORY:
|
case VICTORY:
|
||||||
assets.add(new SoundAssetDelayVolume(SoundAsset.VICTORY, 1.0f, 2.0f));
|
assets.add(new SoundAssetDelayVolume(SoundAsset.VICTORY, 1.0f, 0.0f));
|
||||||
|
break;
|
||||||
|
case BUTTON_PRESSED:
|
||||||
|
assets.add(new SoundAssetDelayVolume(SoundAsset.BUTTON_PRESS, 0.7f, 0.0f));
|
||||||
|
break;
|
||||||
|
case WRONG_INPUT:
|
||||||
|
assets.add(new SoundAssetDelayVolume(SoundAsset.ERROR, 1.0f, 0.0f));
|
||||||
|
break;
|
||||||
|
case UI_CLICK:
|
||||||
|
assets.add(new SoundAssetDelayVolume(SoundAsset.UI_CLICK, 0.8f, 0.0f));
|
||||||
|
break;
|
||||||
|
case START:
|
||||||
|
assets.add(new SoundAssetDelayVolume(SoundAsset.START, 0.8f, 0.2f));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@@ -362,6 +381,7 @@ public float getSoundVolume() {
|
|||||||
*/
|
*/
|
||||||
public void setMainVolume(float mainVolume) {
|
public void setMainVolume(float mainVolume) {
|
||||||
this.mainVolume = mainVolume;
|
this.mainVolume = mainVolume;
|
||||||
|
prefs.putFloat("mainVolume", mainVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -371,6 +391,7 @@ public void setMainVolume(float mainVolume) {
|
|||||||
*/
|
*/
|
||||||
public void setMusicVolume(float musicVolume) {
|
public void setMusicVolume(float musicVolume) {
|
||||||
this.musicVolume = musicVolume;
|
this.musicVolume = musicVolume;
|
||||||
|
prefs.putFloat("musicVolume", musicVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -380,6 +401,7 @@ public void setMusicVolume(float musicVolume) {
|
|||||||
*/
|
*/
|
||||||
public void setSoundVolume(float soundVolume) {
|
public void setSoundVolume(float soundVolume) {
|
||||||
this.soundVolume = soundVolume;
|
this.soundVolume = soundVolume;
|
||||||
|
prefs.putFloat("soundVolume", soundVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,5 +19,9 @@ public enum MdgaSound {
|
|||||||
DESELECT,
|
DESELECT,
|
||||||
HURRY,
|
HURRY,
|
||||||
VICTORY,
|
VICTORY,
|
||||||
LOST
|
LOST,
|
||||||
|
BUTTON_PRESSED,
|
||||||
|
WRONG_INPUT,
|
||||||
|
UI_CLICK,
|
||||||
|
START,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ enum SoundAsset {
|
|||||||
DESELECT(""),
|
DESELECT(""),
|
||||||
HURRY(""),
|
HURRY(""),
|
||||||
VICTORY("LevelUp2.wav"),
|
VICTORY("LevelUp2.wav"),
|
||||||
LOST("GameOver.wav");
|
LOST("GameOver.wav"),
|
||||||
|
BUTTON_PRESS("menu_button.ogg"),
|
||||||
|
ERROR("error_sound.ogg"),
|
||||||
|
UI_CLICK("uiclick.ogg"),
|
||||||
|
START("gamestart.ogg");
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import com.simsilica.lemur.VAlignment;
|
import com.simsilica.lemur.VAlignment;
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
|
|
||||||
public abstract class ClickButton extends AbstractButton {
|
public abstract class ClickButton extends AbstractButton {
|
||||||
protected final Runnable action;
|
protected final Runnable action;
|
||||||
@@ -27,7 +28,7 @@ public abstract class ClickButton extends AbstractButton {
|
|||||||
|
|
||||||
instance = new Button(label);
|
instance = new Button(label);
|
||||||
|
|
||||||
instance.addClickCommands((button) -> action.run());
|
instance.addClickCommands((button) -> { app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED); action.run(); });
|
||||||
instance.setTextHAlignment(HAlignment.Center);
|
instance.setTextHAlignment(HAlignment.Center);
|
||||||
instance.setTextVAlignment(VAlignment.Center);
|
instance.setTextVAlignment(VAlignment.Center);
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@ protected void click() {
|
|||||||
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_PRESSED);
|
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_PRESSED);
|
||||||
instance.setBackground(background);
|
instance.setBackground(background);
|
||||||
|
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.UI_CLICK);
|
||||||
|
|
||||||
onHover();
|
onHover();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public AudioSettingsDialog(MdgaApp app, Node node, MdgaView view) {
|
|||||||
this.view = view;
|
this.view = view;
|
||||||
|
|
||||||
mainVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
mainVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
||||||
musicVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
musicVolume = new SliderButton(app, node, "Musik Lautstärke");
|
||||||
soundVolume = new SliderButton(app, node, "Gesamt Lautstärke");
|
soundVolume = new SliderButton(app, node, "Effekt Lautstärke");
|
||||||
|
|
||||||
backButton = new MenuButton(app, node, view::leaveAudioSettings, "Zurück");
|
backButton = new MenuButton(app, node, view::leaveAudioSettings, "Zurück");
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MainView;
|
import pp.mdga.client.view.MainView;
|
||||||
|
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class HostDialog extends Dialog {
|
public class HostDialog extends Dialog {
|
||||||
private InputButton portInput;
|
private InputButton portInput;
|
||||||
|
|
||||||
@@ -17,13 +19,15 @@ public class HostDialog extends Dialog {
|
|||||||
|
|
||||||
private final MainView view;
|
private final MainView view;
|
||||||
|
|
||||||
|
private Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
|
||||||
|
|
||||||
public HostDialog(MdgaApp app, Node node, MainView view) {
|
public HostDialog(MdgaApp app, Node node, MainView view) {
|
||||||
super(app, node);
|
super(app, node);
|
||||||
|
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
|
||||||
portInput = new InputButton(app, node, "Port: ", 5);
|
portInput = new InputButton(app, node, "Port: ", 5);
|
||||||
portInput.setString("11111");
|
portInput.setString(prefs.get("hostPort", "11111"));
|
||||||
|
|
||||||
hostButton = new ButtonRight(app, node, view::forward, "Spiel hosten", 10);
|
hostButton = new ButtonRight(app, node, view::forward, "Spiel hosten", 10);
|
||||||
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
||||||
@@ -53,10 +57,12 @@ public void update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPort() {
|
public String getPort() {
|
||||||
|
prefs.put("hostPort", portInput.getString());
|
||||||
return portInput.getString();
|
return portInput.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetPort() {
|
public void resetPort() {
|
||||||
portInput.reset();
|
portInput.reset();
|
||||||
|
prefs.put("hostPort", "11111");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
import pp.mdga.client.acoustic.AcousticHandler;
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.InputButton;
|
import pp.mdga.client.button.InputButton;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MainView;
|
import pp.mdga.client.view.MainView;
|
||||||
|
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class JoinDialog extends Dialog {
|
public class JoinDialog extends Dialog {
|
||||||
private InputButton ipInput;
|
private InputButton ipInput;
|
||||||
private InputButton portInput;
|
private InputButton portInput;
|
||||||
@@ -18,6 +21,8 @@ public class JoinDialog extends Dialog {
|
|||||||
|
|
||||||
private final MainView view;
|
private final MainView view;
|
||||||
|
|
||||||
|
private Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
|
||||||
|
|
||||||
public JoinDialog(MdgaApp app, Node node, MainView view) {
|
public JoinDialog(MdgaApp app, Node node, MainView view) {
|
||||||
super(app, node);
|
super(app, node);
|
||||||
|
|
||||||
@@ -25,7 +30,8 @@ public JoinDialog(MdgaApp app, Node node, MainView view) {
|
|||||||
|
|
||||||
ipInput = new InputButton(app, node, "Ip: ", 15);
|
ipInput = new InputButton(app, node, "Ip: ", 15);
|
||||||
portInput = new InputButton(app, node, "Port: ", 5);
|
portInput = new InputButton(app, node, "Port: ", 5);
|
||||||
portInput.setString("11111");
|
portInput.setString(prefs.get("joinPort", "11111"));
|
||||||
|
ipInput.setString(prefs.get("jostIp", ""));
|
||||||
|
|
||||||
joinButton = new ButtonRight(app, node, view::forward, "Spiel beitreten", 10);
|
joinButton = new ButtonRight(app, node, view::forward, "Spiel beitreten", 10);
|
||||||
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
|
||||||
@@ -61,18 +67,22 @@ public void update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getIpt() {
|
public String getIpt() {
|
||||||
|
prefs.put("joinIp", ipInput.getString());
|
||||||
return ipInput.getString();
|
return ipInput.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetIp() {
|
public void resetIp() {
|
||||||
ipInput.reset();
|
ipInput.reset();
|
||||||
|
prefs.put("joinIp", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPort() {
|
public String getPort() {
|
||||||
|
prefs.put("joinPort", portInput.getString());
|
||||||
return portInput.getString();
|
return portInput.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetPort() {
|
public void resetPort() {
|
||||||
portInput.reset();
|
portInput.reset();
|
||||||
|
prefs.put("joinPort", "11111");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.MdgaState;
|
import pp.mdga.client.MdgaState;
|
||||||
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.CeremonyButton;
|
import pp.mdga.client.button.CeremonyButton;
|
||||||
@@ -50,6 +51,8 @@ public void onEnter() {
|
|||||||
enterSub(SubState.AWARD_CEREMONY);
|
enterSub(SubState.AWARD_CEREMONY);
|
||||||
|
|
||||||
rootNode.addLight(ambient);
|
rootNode.addLight(ambient);
|
||||||
|
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.VICTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
import pp.mdga.client.MdgaState;
|
import pp.mdga.client.MdgaState;
|
||||||
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.board.BoardHandler;
|
import pp.mdga.client.board.BoardHandler;
|
||||||
import pp.mdga.client.board.CameraHandler;
|
import pp.mdga.client.board.CameraHandler;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
@@ -54,6 +55,8 @@ public void onEnter() {
|
|||||||
cheatButton.show();
|
cheatButton.show();
|
||||||
|
|
||||||
app.getViewPort().addProcessor(fpp);
|
app.getViewPort().addProcessor(fpp);
|
||||||
|
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.START);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.light.AmbientLight;
|
import com.jme3.light.AmbientLight;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
@@ -49,11 +50,10 @@ public LobbyView(MdgaApp app) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnter() {
|
public void onEnter() {
|
||||||
//cam = new Camera(app.getCamera().getWidth(), app.getCamera().getHeight());
|
app.getCamera().setParallelProjection(true);
|
||||||
//cam.setParallelProjection(true);
|
float aspect = (float) app.getCamera().getWidth() / app.getCamera().getHeight();
|
||||||
//float aspect = (float) app.getCamera().getWidth() / app.getCamera().getHeight();
|
float size = 1.65f;
|
||||||
//float size = 1.65f;
|
app.getCamera().setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
|
||||||
//cam.setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
|
|
||||||
|
|
||||||
leaveButton.show();
|
leaveButton.show();
|
||||||
readyButton.show();
|
readyButton.show();
|
||||||
@@ -77,6 +77,18 @@ public void onLeave() {
|
|||||||
cyberButton.hide();
|
cyberButton.hide();
|
||||||
|
|
||||||
rootNode.removeLight(ambient);
|
rootNode.removeLight(ambient);
|
||||||
|
|
||||||
|
app.getCamera().setParallelProjection(false);
|
||||||
|
|
||||||
|
app.getCamera().setFrustumPerspective(
|
||||||
|
45.0f,
|
||||||
|
(float) app.getCamera().getWidth() / app.getCamera().getHeight(),
|
||||||
|
0.1f,
|
||||||
|
1000.0f
|
||||||
|
);
|
||||||
|
|
||||||
|
app.getCamera().setLocation(new Vector3f(0, 0, 10));
|
||||||
|
app.getCamera().lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.MdgaState;
|
import pp.mdga.client.MdgaState;
|
||||||
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.button.SettingsButton;
|
import pp.mdga.client.button.SettingsButton;
|
||||||
@@ -99,7 +100,7 @@ private void tryHost() {
|
|||||||
if(port >= 1 && port <= 65535) {
|
if(port >= 1 && port <= 65535) {
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
app.getModelSyncronizer().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setHost(port);
|
app.getModelSyncronizer().setHost(port);
|
||||||
//TODO: playSound
|
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -107,13 +108,44 @@ private void tryHost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hostDialog.resetPort();
|
hostDialog.resetPort();
|
||||||
//TODO: playSound
|
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryJoin() {
|
private void tryJoin() {
|
||||||
//TODO
|
int port = 0;
|
||||||
|
String ip = joinDialog.getIpt();
|
||||||
|
String portText = hostDialog.getPort();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Validate the port
|
||||||
|
port = Integer.parseInt(portText);
|
||||||
|
if (port < 1 || port > 65535) {
|
||||||
|
throw new IllegalArgumentException("Invalid port");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the IP address
|
||||||
|
if (isValidIpAddress(ip)) {
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
app.getModelSyncronizer().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setJoin("127.0.0.1", 1);
|
app.getModelSyncronizer().setJoin(ip, port);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// Invalid input, fall through to reset
|
||||||
|
}
|
||||||
|
|
||||||
|
hostDialog.resetPort();
|
||||||
|
joinDialog.resetIp();
|
||||||
|
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidIpAddress(String ip) {
|
||||||
|
String ipRegex =
|
||||||
|
"^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
|
||||||
|
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
|
||||||
|
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
|
||||||
|
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$";
|
||||||
|
|
||||||
|
return ip != null && ip.matches(ipRegex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterSub(SubState state) {
|
private void enterSub(SubState state) {
|
||||||
@@ -160,7 +192,7 @@ public void forward(boolean host) {
|
|||||||
case MAIN:
|
case MAIN:
|
||||||
if(host) {
|
if(host) {
|
||||||
enterSub(SubState.HOST);
|
enterSub(SubState.HOST);
|
||||||
//TODO: playSound
|
//TODO playSound
|
||||||
} else {
|
} else {
|
||||||
enterSub(SubState.JOIN);
|
enterSub(SubState.JOIN);
|
||||||
//TODO: playSound
|
//TODO: playSound
|
||||||
|
|||||||
BIN
Projekte/mdga/client/src/main/resources/Sounds/error_sound.ogg
Normal file
BIN
Projekte/mdga/client/src/main/resources/Sounds/error_sound.ogg
Normal file
Binary file not shown.
BIN
Projekte/mdga/client/src/main/resources/Sounds/gamestart.ogg
Normal file
BIN
Projekte/mdga/client/src/main/resources/Sounds/gamestart.ogg
Normal file
Binary file not shown.
BIN
Projekte/mdga/client/src/main/resources/Sounds/menu_button.ogg
Normal file
BIN
Projekte/mdga/client/src/main/resources/Sounds/menu_button.ogg
Normal file
Binary file not shown.
BIN
Projekte/mdga/client/src/main/resources/Sounds/uiclick.ogg
Normal file
BIN
Projekte/mdga/client/src/main/resources/Sounds/uiclick.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user