mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-28 16:41:01 +00:00
Ensured that guiGameListMenuCtrl adjusts values for rows marked as sliders via the left and right gamepad actions Corrected the button maps for look and move on the gamepad for the ExampleModule's default movement binds Fixed ExampleModule's default keybinds so alt+enter correctly toggles fullscreen Fixed joinServerMenu so it has a guiInputCtrl that can catch keybind events and pass them to the menuInputButtons Removed erroneous input consumption on OptionsMenuList Removed unneeded check against Graphics API list Flipped order of Anti Aliasing option to match ordering of the others Removed old, unneeded legacy option menu script files Added logic for message boxes to automatically return active MenuInputButton control to the holder before it was pushed Added fill color for the UI list gui profile so the sliders render more legibly
165 lines
4.7 KiB
C#
165 lines
4.7 KiB
C#
|
|
function JoinServerMenu::onWake()
|
|
{
|
|
// Double check the status. Tried setting this the control
|
|
// inactive to start with, but that didn't seem to work.
|
|
JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0);
|
|
|
|
JoinServerButtonHolder.setActive();
|
|
|
|
JoinServerMenuInputHandler.setFirstResponder();
|
|
}
|
|
|
|
function JoinServerButtonHolder::onWake(%this)
|
|
{
|
|
%this-->joinButton.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
|
|
%this-->backButton.set("btn_b", "Escape", "Back", "JoinServerMenu.backOut();");
|
|
%this-->refreshButton.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
|
|
%this-->queryLANButton.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
|
|
%this-->queryInternetButton.set("btn_x", "E", "Query Internet", "JoinServerMenu.query();");
|
|
}
|
|
|
|
function JoinServerMenuInputHandler::onInputEvent(%this, %device, %action, %state)
|
|
{
|
|
if(%state)
|
|
$activeMenuButtonContainer.processInputs(%device, %action);
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::query(%this)
|
|
{
|
|
queryMasterServer(
|
|
0, // Query flags
|
|
$Client::GameTypeQuery, // gameTypes
|
|
$Client::MissionTypeQuery, // missionType
|
|
0, // minPlayers
|
|
100, // maxPlayers
|
|
0, // maxBots
|
|
2, // regionMask
|
|
0, // maxPing
|
|
100, // minCPU
|
|
0 // filterFlags
|
|
);
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::queryLan(%this)
|
|
{
|
|
queryLANServers(
|
|
$pref::Net::Port, // lanPort for local queries
|
|
0, // Query flags
|
|
$Client::GameTypeQuery, // gameTypes
|
|
$Client::MissionTypeQuery, // missionType
|
|
0, // minPlayers
|
|
100, // maxPlayers
|
|
0, // maxBots
|
|
2, // regionMask
|
|
0, // maxPing
|
|
100, // minCPU
|
|
0 // filterFlags
|
|
);
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::cancel(%this)
|
|
{
|
|
cancelServerQuery();
|
|
JS_queryStatus.setVisible(false);
|
|
}
|
|
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::join(%this)
|
|
{
|
|
cancelServerQuery();
|
|
%index = JS_serverList.getSelectedId();
|
|
|
|
JoinGame(%index);
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::refresh(%this)
|
|
{
|
|
cancelServerQuery();
|
|
%index= JS_serverList.getSelectedId();
|
|
|
|
// The server info index is stored in the row along with the
|
|
// rest of displayed info.
|
|
if( setServerInfo( %index ) )
|
|
querySingleServer( $ServerInfo::Address, 0 );
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::refreshSelectedServer( %this )
|
|
{
|
|
querySingleServer( $JoinGameAddress, 0 );
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::backOut(%this)
|
|
{
|
|
cancelServerQuery();
|
|
|
|
Canvas.popDialog(JoinServerMenu);
|
|
if(isObject(JoinServerMenu.returnGui) && JoinServerMenu.returnGui.isMethod("onReturnTo"))
|
|
JoinServerMenu.returnGui.onReturnTo();
|
|
}
|
|
|
|
//----------------------------------------
|
|
function JoinServerMenu::update(%this)
|
|
{
|
|
// Copy the servers into the server list.
|
|
JS_queryStatus.setVisible(false);
|
|
JS_serverList.clear();
|
|
%sc = getServerCount();
|
|
for( %i = 0; %i < %sc; %i ++ ) {
|
|
setServerInfo(%i);
|
|
JS_serverList.addRow( %i,
|
|
$ServerInfo::Name TAB
|
|
$ServerInfo::Ping TAB
|
|
$ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB
|
|
$ServerInfo::Version TAB
|
|
$ServerInfo::MissionName
|
|
);
|
|
}
|
|
JS_serverList.sort(0);
|
|
JS_serverList.setSelectedRow(0);
|
|
JS_serverList.scrollVisible(0);
|
|
|
|
JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0);
|
|
}
|
|
|
|
//----------------------------------------
|
|
function onServerQueryStatus(%status, %msg, %value)
|
|
{
|
|
echo("ServerQuery: " SPC %status SPC %msg SPC %value);
|
|
// Update query status
|
|
// States: start, update, ping, query, done
|
|
// value = % (0-1) done for ping and query states
|
|
if (!JS_queryStatus.isVisible())
|
|
JS_queryStatus.setVisible(true);
|
|
|
|
switch$ (%status) {
|
|
case "start":
|
|
JoinServerJoinBtn.setActive(false);
|
|
JoinServerQryInternetBtn.setActive(false);
|
|
JS_statusText.setText(%msg);
|
|
JS_statusBar.setValue(0);
|
|
JS_serverList.clear();
|
|
|
|
case "ping":
|
|
JS_statusText.setText("Ping Servers");
|
|
JS_statusBar.setValue(%value);
|
|
|
|
case "query":
|
|
JS_statusText.setText("Query Servers");
|
|
JS_statusBar.setValue(%value);
|
|
|
|
case "done":
|
|
JoinServerQryInternetBtn.setActive(true);
|
|
JS_queryStatus.setVisible(false);
|
|
JS_status.setText(%msg);
|
|
JoinServerMenu.update();
|
|
}
|
|
}
|