Commit 8b1217e0 authored by 刘家荣's avatar 刘家荣 💬
Browse files

联机记录

parent 38c51add
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -29,7 +29,11 @@ public class Searcher {
    }
    
    private Searcher() {
        search();
        instanceSearch();
    }
    
    public static void search(){
        instance.instanceSearch();
    }
    
    /**
@@ -41,7 +45,7 @@ public class Searcher {
     * }
     * </pre>
     */
    public void search() {
    public void instanceSearch() {
        this.currentId = UUID.randomUUID().toString();
        JSONObject data = new JSONObject();
        data.put("type", "Searching");
@@ -98,7 +102,7 @@ public class Searcher {
            int playerPort = recvData.getIntValue("playerPort");
            int watcherPort = recvData.getIntValue("watcherPort");
            Account host = recvData.getObject("host", Account.class);
            RoomFrame.instance.addRoom(new Room(ip, playerPort, watcherPort, host));
            RoomFrame.instance.addRoom(new Room(ip, playerPort, watcherPort, host, false, 666));
        } catch (JSONException ignored){}
    }
    
+4 −1
Original line number Diff line number Diff line
@@ -64,8 +64,11 @@ public class RoomFrame extends JFrame {
        button.setFont(new Font("Rockwell", Font.BOLD, 20));
    
        button.addActionListener(e -> {
            for (JButton b: roomList) {
                this.remove(b);
            }
            roomList.removeAll(roomList);
            Searcher.instance.search();
            Searcher.search();
        });
        setPane.add(button);
    }