mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
Removed google guave dependency. Added a new GlobalEventBus. Refined the EventPublisher. Moving events to own file.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package org.toop;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.toop.backend.ServerManager;
|
||||
@@ -16,7 +15,6 @@ import org.toop.eventbus.GlobalEventBus;
|
||||
import org.toop.eventbus.events.NetworkEvents;
|
||||
import org.toop.frontend.UI.LocalServerSelector;
|
||||
import org.toop.frontend.networking.NetworkingClientManager;
|
||||
import org.toop.frontend.networking.NetworkingGameClientHandler;
|
||||
|
||||
public class Main {
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
@@ -38,49 +36,20 @@ public class Main {
|
||||
new Events.ServerEvents.StartServerRequest(5001, "tictactoe", serverIdFuture));
|
||||
var serverId = serverIdFuture.get();
|
||||
|
||||
new MainTest();
|
||||
|
||||
|
||||
// CompletableFuture<String> conIdFuture = new CompletableFuture<>();
|
||||
// GlobalEventBus.post(
|
||||
// new NetworkEvents.StartClientRequest(NetworkingGameClientHandler::new,
|
||||
// "127.0.0.1", 5001, conIdFuture));
|
||||
// var conId = conIdFuture.get();
|
||||
|
||||
|
||||
// GlobalEventBus.post(new NetworkEvents.SendCommand(conId, "move", "5"));
|
||||
// GlobalEventBus.post(new NetworkEvents.ForceCloseAllClients());
|
||||
// GlobalEventBus.post(new NetworkEvents.StartClient(
|
||||
// NetworkingGameClientHandler::new, "127.0.0.1", 5001, serverId
|
||||
// ));
|
||||
|
||||
// JFrame frame = new JFrame("Server Settings");
|
||||
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
// frame.setSize(800, 600);
|
||||
// frame.setLocationRelativeTo(null);
|
||||
// frame.setVisible(true);
|
||||
var a = new MainTest();
|
||||
|
||||
javax.swing.SwingUtilities.invokeLater(LocalServerSelector::new);
|
||||
|
||||
// new Thread(() -> {
|
||||
// LocalServerSelector window = new LocalServerSelector();
|
||||
// }).start();
|
||||
}
|
||||
|
||||
private static void initSystems() {
|
||||
new ServerManager();
|
||||
new NetworkingClientManager();
|
||||
}
|
||||
|
||||
private static void registerEvents() {
|
||||
GlobalEventBus.subscribeAndRegister(
|
||||
Events.WindowEvents.OnQuitRequested.class,
|
||||
event -> {
|
||||
quit();
|
||||
});
|
||||
|
||||
GlobalEventBus.subscribeAndRegister(Events.WindowEvents.OnMouseMove.class, event -> {});
|
||||
}
|
||||
|
||||
public static void initSystems() {
|
||||
new ServerManager();
|
||||
new NetworkingClientManager();
|
||||
new EventPublisher<>(Events.WindowEvents.OnQuitRequested.class, _ -> quit());
|
||||
new EventPublisher<>(Events.WindowEvents.OnMouseMove.class, _ -> {});
|
||||
}
|
||||
|
||||
private static void quit() {
|
||||
|
||||
Reference in New Issue
Block a user