mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Add ability to set netplay server
This commit is contained in:
parent
e3f71cd017
commit
dfdbe55590
3
a.html
3
a.html
@ -19,8 +19,9 @@
|
||||
volume: true,
|
||||
}*/
|
||||
EJS_volume = 1;
|
||||
//EJS_startOnLoaded = true;
|
||||
EJS_startOnLoaded = true;
|
||||
//EJS_loadStateURL = "mega_mountain.state";
|
||||
EJS_netplayServer = "http://127.0.0.1:3000";
|
||||
</script>
|
||||
<script src='data/loader.js'></script>
|
||||
</body>
|
||||
|
||||
@ -198,6 +198,9 @@
|
||||
box-shadow: 0 0 0 5px rgba(var(--ejs-primary-color),0.5);
|
||||
outline: 0;
|
||||
}
|
||||
.ejs_context_menu li:hover a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1247,6 +1250,7 @@
|
||||
height: 2rem;
|
||||
display: block;
|
||||
font-family: Arial;
|
||||
border: 0px;
|
||||
}
|
||||
.ejs_netplay_name_heading {
|
||||
margin-top: 0!important;
|
||||
|
||||
@ -2803,7 +2803,7 @@ class EmulatorJS {
|
||||
createNetplayMenu() {
|
||||
const body = this.createPopup("Netplay", {
|
||||
"Create a Room": () => {
|
||||
console.log("aaaaaaaaaaaa");
|
||||
this.netplay.openRoom();
|
||||
},
|
||||
"Close": () => {
|
||||
this.netplayMenu.style.display = "none";
|
||||
@ -2887,9 +2887,9 @@ class EmulatorJS {
|
||||
}
|
||||
}
|
||||
defineNetplayFunctions() {
|
||||
this.netplay.url = this.config.netplayUrl;
|
||||
this.netplay.getOpenRooms = async () => {
|
||||
//async because it will need to pull from server. This is for testing
|
||||
return [{name:"Room 1", players:1, max:2},{name:"Room 2", players:2, max:2}];
|
||||
return JSON.parse(await (await fetch(this.netplay.url+"/list?domain="+window.location.host+"&game_id=1")).text());
|
||||
}
|
||||
this.netplay.updateTableList = async () => {
|
||||
const addToTable = (name, current, max) => {
|
||||
@ -2920,9 +2920,14 @@ class EmulatorJS {
|
||||
}
|
||||
this.netplay.table.innerHTML = "";
|
||||
const open = await this.netplay.getOpenRooms();
|
||||
console.log(open);
|
||||
for (let i=0; i<open.length; i++) {
|
||||
addToTable(open[i].name, open[i].players, open[i].max);
|
||||
}
|
||||
}
|
||||
this.netplay.openRoom = () => {
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.netplay.updateList = {
|
||||
|
||||
@ -63,6 +63,7 @@
|
||||
config.defaultOptions = window.EJS_defaultOptions;
|
||||
config.gamePatchUrl = window.EJS_gamePatchUrl;
|
||||
config.gameParentUrl = window.EJS_gameParentUrl;
|
||||
config.netplayUrl = window.EJS_netplayServer;
|
||||
|
||||
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user