diff --git a/binaries/data/mods/public/gui/common/setup.xml b/binaries/data/mods/public/gui/common/setup.xml index ba9228ec6d..653a468b37 100644 --- a/binaries/data/mods/public/gui/common/setup.xml +++ b/binaries/data/mods/public/gui/common/setup.xml @@ -170,6 +170,8 @@ 191 191 2 159 98 24 + 0 0 0 0 + + + + + + + onTick(); + + + Match setup + + + + + + + + + initMapNameList(this); + selectMap(this.list[this.selected]); + + + + [Map name] + [Description] + + + + + + + + [Player name] + + + + + + + + Start game! + launchGame(); + + + + + diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js new file mode 100644 index 0000000000..fe88a00cef --- /dev/null +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js @@ -0,0 +1,69 @@ +var g_IsConnecting = false; +var g_GameType; // "server" or "client" + +function init() +{ +} + +function startConnectionStatus(type) +{ + g_GameType = type; + g_IsConnecting = true; + getGUIObjectByName("connectionStatus").caption = "Connecting to server..."; +} + +function onTick() +{ + if (!g_IsConnecting) + return; + + while (true) + { + var message = Engine.PollNetworkClient(); + if (!message) + break; + + warn("Net message: "+uneval(message)); + + switch (message.type) + { + case "netstatus": + switch (message.status) + { + case "connected": + getGUIObjectByName("connectionStatus").caption = "Registering with server..."; + break; + case "authenticated": + Engine.PopGuiPage(); + Engine.PushGuiPage("page_gamesetup.xml", { "type": g_GameType }); + return; // don't process any more messages + default: + error("Unrecognised netstatus type "+message.status); + break; + } + break; + default: + error("Unrecognised net message type "+message.type); + break; + } + } +} + +function switchSetupPage(oldpage, newpage) +{ + getGUIObjectByName(oldpage).hidden = true; + getGUIObjectByName(newpage).hidden = false; +} + +function startHost(playername, servername) +{ + Engine.StartNetworkHost(playername); + startConnectionStatus("server"); + // TODO: ought to do something(?) with servername +} + +function startJoin(playername, ip) +{ + Engine.StartNetworkJoin(playername, ip); + startConnectionStatus("client"); +} diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml new file mode 100644 index 0000000000..179ba2f494 --- /dev/null +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml @@ -0,0 +1,156 @@ + + + + +