1
0
forked from 0ad/0ad

Updated the MP screen, connecting and chatting now work. Starting a game doesn't work, due to startGame() somehow being non-functional in MP mode.

This was SVN commit r1876.
This commit is contained in:
Fire Giant 2005-01-30 14:40:25 +00:00
parent 462369a244
commit 3760b15b51
4 changed files with 444 additions and 424 deletions

View File

@ -115,10 +115,12 @@
<!-- PLAYER NAME controls -->
<object type="text" name="pregame_mp_ip_playername_txt" absolute="false" size="45 80 200 100" textcolor="0 0 0">
Player Name (temporary):
<action on="Load"><![CDATA[
getGUIObjectByName("pregame_mp_ip_playername_txt").caption = "Player Name (temporary):";
]]></action>
</object>
<object type="input" name="pregame_mp_ip_playername" sprite="only_black" absolute="false" size="220 80 350 100" textcolor="255 255 255">
<object type="input" name="pregame_mp_ip_playername" sprite="only_black_border" absolute="false" size="220 80 350 100" textcolor="0 0 0">
Player
</object>
<!-- END PLAYER NAME controls -->
@ -131,10 +133,12 @@
</object>
<object type="text" name="pregame_mp_ip_mapname_txt" absolute="false" size="45 130 200 150" textcolor="0 0 0">
Map Name:
<action on="Load"><![CDATA[
getGUIObjectByName("pregame_mp_ip_mapname_txt").caption = "Map Name:";
]]></action>
</object>
<object type="input" name="pregame_mp_ip_host_mapname" sprite="only_black" absolute="false" size="50 150 200 170" textcolor="255 255 255">
<object type="input" name="pregame_mp_ip_host_mapname" sprite="only_black_border" absolute="false" size="50 150 200 170" textcolor="0 0 0">
test01.pmp
</object>
@ -157,10 +161,12 @@
</object>
<object type="text" name="pregame_mp_ip_joinip_txt" absolute="false" size="45 190 200 210" textcolor="0 0 0">
IP address:
<action on="Load"><![CDATA[
getGUIObjectByName("pregame_mp_ip_joinip_txt").caption = "IP Address:";
]]></action>
</object>
<object type="input" name="pregame_mp_ip_joinip" sprite="only_black" absolute="false" size="50 210 200 230" textcolor="255 255 255">
<object type="input" name="pregame_mp_ip_joinip" sprite="only_black_border" absolute="false" size="50 210 200 230" textcolor="0 0 0">
127.0.0.1
</object>
@ -177,7 +183,11 @@
</object>
<!-- SINGLEPLAYER TEMPORARY MAP SELECTION DIALOG -->
<!--
===============================================
- SINGLEPLAYER TEMPORARY MAP SELECTION DIALOG -
===============================================
-->
<object type="button" name="pregame_sp_mapsel" sprite="0ad_window" z="106" hidden="true" size="50%-150 50%-90 50%+150 50%+90">
<!-- The placement of this titlebar object is VERY hackish (see y-placement), but it doesn't work any other way so far, and this dialog will be temporary anyway -->
@ -193,7 +203,7 @@
Map Name:
</object>
<object type="input" name="pregame_sp_mapname" sprite="only_black" absolute="false" size="130 90 290 110" textcolor="255 255 255">
<object type="input" name="pregame_sp_mapname" sprite="only_black_border" absolute="false" size="130 90 290 110" textcolor="0 0 0">
ph2
</object>

View File

@ -27,7 +27,10 @@ function loadSession()
// Failed to start the game; go back to the main menu. TODO: display an error message.
GUIObjectHide("loading_screen");
GUIObjectUnhide("PREGAME_GUI");
return;
// Show an error message
btCaptions = new Array("OK");
btCode = new Array("");
messageBox(400, 200, "The game could not be started with the given parameters. You probably have entered an invalid map name.", "Error", 0, btCaptions, btCode);
}
// Create resource pools for each player, etc.

View File

@ -25,6 +25,9 @@ function initMPSessionHost(playerName, mapName)
{
var server = createServer();
// Set the map to use
g_GameAttributes.mapFile = mapName;
// Set basic server options, such as:
// server.port = 20595; // Default is 20595 - you can also explicitly set to -1 for default port
server.serverPlayerName=playerName;
@ -38,14 +41,18 @@ function initMPSessionHost(playerName, mapName)
messageBox(400, 200, "Failed to start server. Please review the logfile for more information on the problem.", "Problem", 2, new Array(), new Array());
}
server.onChat=function (event) {
messageBox(400, 200, event.message, "Chat Message", 2, new Array(), new Array());
};
GUIObjectHide("pregame_mp_ip");
GUIObjectHide("pregame_subwindow_bkg");
// Need "waiting for more players to join and start game" code here
/*btCaptions = new Array("OK");
btCode = new Array("");
messageBox(400, 200, "Data: " + playerName + ";" + mapName + ";", "Test", 0, btCaptions, btCode);*/
btCaptions = new Array("OK");
btCode = new Array("startGame();");
messageBox(400, 200, "Waiting for clients to join - Click OK to start the game.", "Ready", 0, btCaptions, btCode);
}
// ====================================================================