mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
- Ensures if there is a $pref::server::password set and you're creating a localConnection game, you can connect even if you don't have a client password set
- Changed ChooseLevelMenu layout to have a vertical list for levels with a static preview set, as well as a separate tab for server configs if trying to create a server - Added field to set password for connecting to passworded servers on the JoinServerMenu - Added sanity check so you can't try and activate a menuList that has no children(caused error spam)
This commit is contained in:
parent
150684a47d
commit
c809dbb4be
6 changed files with 446 additions and 98 deletions
|
|
@ -478,7 +478,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
|
||||||
setProtocolVersion(currentProtocol < CurrentProtocolVersion ? currentProtocol : CurrentProtocolVersion);
|
setProtocolVersion(currentProtocol < CurrentProtocolVersion ? currentProtocol : CurrentProtocolVersion);
|
||||||
|
|
||||||
const char *serverPassword = Con::getVariable("pref::Server::Password");
|
const char *serverPassword = Con::getVariable("pref::Server::Password");
|
||||||
if(serverPassword[0])
|
if(serverPassword[0] && !isLocalConnection())
|
||||||
{
|
{
|
||||||
if(String::compare(joinPassword, serverPassword))
|
if(String::compare(joinPassword, serverPassword))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
canSaveDynamicFields = "1";
|
canSaveDynamicFields = "1";
|
||||||
launchInEditor = "0";
|
launchInEditor = "0";
|
||||||
|
previewButtonSize = "445 120";
|
||||||
|
|
||||||
new GuiInputCtrl(ChooseLevelInputHandler) {
|
new GuiInputCtrl(ChooseLevelInputHandler) {
|
||||||
ignoreMouseEvents = "1";
|
ignoreMouseEvents = "1";
|
||||||
|
|
@ -21,7 +22,6 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
profile = "GuiInputCtrlProfile";
|
profile = "GuiInputCtrlProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
|
|
||||||
new GuiPanel(ChooseLevelTitlePanel) {
|
new GuiPanel(ChooseLevelTitlePanel) {
|
||||||
extent = "1281 60";
|
extent = "1281 60";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
|
|
@ -36,6 +36,275 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
new GuiStackControl(ChooseLevelMenuTabList) {
|
||||||
|
stackingType = "Horizontal";
|
||||||
|
padding = "10";
|
||||||
|
position = "485 61";
|
||||||
|
extent = "310 41";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Level";
|
||||||
|
groupNum = "1";
|
||||||
|
extent = "150 41";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "ChooseLevelMenu.openMenu(0);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "ChooseLevelMenuButton";
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Server Config";
|
||||||
|
groupNum = "1";
|
||||||
|
position = "160 0";
|
||||||
|
extent = "150 41";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "ChooseLevelMenu.openMenu(1);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "ChooseLevelMenuButton";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiControl(ChooseLevelMenuNavButtonOverlay) {
|
||||||
|
position = "0 61";
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(ChooseLevelMenuPrevNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Q_image";
|
||||||
|
position = "485 24";
|
||||||
|
extent = "40 40";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiBitmapCtrl(ChooseLevelMenuNextNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_E_image";
|
||||||
|
position = "595 24";
|
||||||
|
extent = "40 40";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer(LevelSelectContainer) {
|
||||||
|
position = "196 119";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiScrollCtrl(LevelPreviewScroll) {
|
||||||
|
hScrollBar = "alwaysOff";
|
||||||
|
vScrollBar = "dynamic";
|
||||||
|
extent = "445 562";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuScrollProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiStackControl(LevelPreviewArray) {
|
||||||
|
padding = "5";
|
||||||
|
position = "0 1";
|
||||||
|
extent = "445 120";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiBitmapCtrl(LevelPreviewBitmap) {
|
||||||
|
BitmapAsset = "testMaps:EmptyLevel_preview_image";
|
||||||
|
position = "448 0";
|
||||||
|
extent = "440 440";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextCtrl(LevelNameText) {
|
||||||
|
text = "EmptyLevel";
|
||||||
|
position = "448 445";
|
||||||
|
extent = "440 20";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "MenuSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "levelNameTxt";
|
||||||
|
};
|
||||||
|
new GuiMLTextCtrl(LevelDescriptionText) {
|
||||||
|
position = "448 473";
|
||||||
|
extent = "440 19";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "GuiMLTextProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "levelDescTxt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer(ServerConfigContainer) {
|
||||||
|
position = "196 119";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiScrollCtrl(ServerConfigScroll) {
|
||||||
|
hScrollBar = "alwaysOff";
|
||||||
|
vScrollBar = "dynamic";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuScrollProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiStackControl(ServerConfigList) {
|
||||||
|
padding = "5";
|
||||||
|
changeChildSizeToFit = "0";
|
||||||
|
position = "1 1";
|
||||||
|
extent = "900 170";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiContainer() {
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Host Player Name";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "140 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl() {
|
||||||
|
text = "Visitor";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$pref::Player::Name";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 35";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Name";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "101 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl() {
|
||||||
|
text = "Torque 3D Server";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Name";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 70";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Password";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "135 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl() {
|
||||||
|
text = "Torque 3D Server";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Password";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 105";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Description";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "147 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl() {
|
||||||
|
text = "This is a Torque 3D server.";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Info";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 140";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Max Players";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "94 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(JoinServerPlayerNameTxt) {
|
||||||
|
text = "64";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::MaxPlayers";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
new GuiPanel(ChooseLevelButtonPanel) {
|
new GuiPanel(ChooseLevelButtonPanel) {
|
||||||
position = "0 683";
|
position = "0 683";
|
||||||
extent = "1281 40";
|
extent = "1281 40";
|
||||||
|
|
@ -49,9 +318,9 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
sizeIconToButton = "1";
|
sizeIconToButton = "1";
|
||||||
makeIconSquare = "1";
|
makeIconSquare = "1";
|
||||||
textLocation = "Center";
|
textLocation = "Center";
|
||||||
text = "Start";
|
text = "Start Game";
|
||||||
position = "1115 0";
|
position = "1092 0";
|
||||||
extent = "140 40";
|
extent = "163 40";
|
||||||
horizSizing = "left";
|
horizSizing = "left";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
|
|
@ -72,25 +341,5 @@ $guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiScrollCtrl(LevelPreviewScroll) {
|
|
||||||
hScrollBar = "dynamic";
|
|
||||||
vScrollBar = "alwaysOff";
|
|
||||||
position = "0 118";
|
|
||||||
extent = "1283 500";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiMenuScrollProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
|
|
||||||
new GuiStackControl(LevelPreviewArray) {
|
|
||||||
position = "1 1";
|
|
||||||
extent = "1280 480";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiMenuDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
padding = "5";
|
|
||||||
stackingType = "Horizontal";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
//--- OBJECT WRITE END ---
|
//--- OBJECT WRITE END ---
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,13 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
function ChooseLevelMenu::onAdd( %this )
|
function ChooseLevelMenu::onAdd( %this )
|
||||||
{
|
{
|
||||||
if(!isObject(ChooseLevelAssetQuery))
|
if(!isObject(ChooseLevelAssetQuery))
|
||||||
new AssetQuery(ChooseLevelAssetQuery);
|
new AssetQuery(ChooseLevelAssetQuery);
|
||||||
|
|
||||||
|
%this.previewButtonSize = "445 120";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChooseLevelMenu::onWake(%this)
|
function ChooseLevelMenu::onWake(%this)
|
||||||
|
|
@ -42,7 +43,7 @@ function ChooseLevelMenu::onWake(%this)
|
||||||
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
|
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
|
||||||
"Canvas.popDialog(ChooseLevelMenu); if(isObject(ChooseLevelMenu.returnGui) && ChooseLevelMenu.returnGui.isMethod(\"onReturnTo\")) ChooseLevelMenu.returnGui.onReturnTo();");
|
"Canvas.popDialog(ChooseLevelMenu); if(isObject(ChooseLevelMenu.returnGui) && ChooseLevelMenu.returnGui.isMethod(\"onReturnTo\")) ChooseLevelMenu.returnGui.onReturnTo();");
|
||||||
|
|
||||||
ChooseLevelAssetQuery.delete();
|
ChooseLevelAssetQuery.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,47 +66,27 @@ function ChooseLevelMenu::onWake(%this)
|
||||||
if (!isFile(%levelPreviewImg))
|
if (!isFile(%levelPreviewImg))
|
||||||
%levelPreviewImg = "UI:no_preview_image";
|
%levelPreviewImg = "UI:no_preview_image";
|
||||||
|
|
||||||
%preview = new GuiContainer() {
|
%preview = new GuiIconButtonCtrl() {
|
||||||
extent = "480 480";
|
position = "0 0";
|
||||||
|
extent = %this.previewButtonSize;
|
||||||
|
buttonType = "PushButton";
|
||||||
|
profile = GuiMenuButtonLeftJustProfile;
|
||||||
|
horizSizing = "right";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
internalName = "button";
|
||||||
|
class = "LevelPreviewButton";
|
||||||
|
//command = "$selectedLevelAsset = " @ %assetId @ ";";
|
||||||
|
altCommand = "ChooseLevelBegin(1);"; //allow doubleclick to quick action it
|
||||||
|
text = %levelAsset.levelName;
|
||||||
|
bitmapAsset = %levelPreviewImg;
|
||||||
|
levelAsset = %levelAsset;
|
||||||
levelAssetId = %assetId;
|
levelAssetId = %assetId;
|
||||||
|
iconLocation = "left";
|
||||||
new GuiButtonCtrl() {
|
sizeIconToButton = true;
|
||||||
position = "0 0";
|
makeIconSquare = true;
|
||||||
extent = "480 480";
|
textLocation = "left";
|
||||||
buttonType = "ToggleButton";
|
textMargin = 120;
|
||||||
profile = GuiMenuButtonLeftJustProfile;
|
groupNum = 2;
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
internalName = "button";
|
|
||||||
class = "LevelPreviewButton";
|
|
||||||
command = "$selectedLevelAsset = " @ %assetId @ ";";
|
|
||||||
altCommand = "ChooseLevelBegin(1);"; //allow doubleclick to quick action it
|
|
||||||
};
|
|
||||||
|
|
||||||
new GuiBitmapCtrl() {
|
|
||||||
position = "20 0";
|
|
||||||
extent = "440 440";
|
|
||||||
BitmapAsset = %levelPreviewImg;
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = GuiNonModalDefaultProfile;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
position = "20 445";
|
|
||||||
extent = "440 15";
|
|
||||||
text = %levelAsset.levelName;
|
|
||||||
profile = MenuSubHeaderText;
|
|
||||||
internalName = "levelNameTxt";
|
|
||||||
};
|
|
||||||
|
|
||||||
new GuiMLTextCtrl() {
|
|
||||||
position = "20 465";
|
|
||||||
extent = "440 15";
|
|
||||||
text = %levelAsset.levelDescription;
|
|
||||||
profile = GuiMLTextProfile;
|
|
||||||
internalName = "levelDescTxt";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LevelPreviewArray.add(%preview);
|
LevelPreviewArray.add(%preview);
|
||||||
|
|
@ -118,49 +99,114 @@ function ChooseLevelMenu::onWake(%this)
|
||||||
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
|
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//LevelList.setSelected(0);
|
|
||||||
|
|
||||||
if(!$pref::HostMultiPlayer)
|
if(!$pref::HostMultiPlayer)
|
||||||
ChooseLevelTitleText.setText("SINGLE PLAYER");
|
ChooseLevelTitleText.setText("SINGLE PLAYER");
|
||||||
else
|
else
|
||||||
ChooseLevelTitleText.setText("CREATE SERVER");
|
ChooseLevelTitleText.setText("CREATE SERVER");
|
||||||
|
|
||||||
$MenuList = LevelPreviewArray;
|
%this.openMenu(0);
|
||||||
$MenuList.listPosition = 0;
|
|
||||||
$MenuList.syncGui();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isObject( ChooseLevelActionMap ) )
|
if(!isObject( ChooseLevelActionMap ) )
|
||||||
{
|
{
|
||||||
new ActionMap(ChooseLevelActionMap){};
|
new ActionMap(ChooseLevelActionMap){};
|
||||||
|
|
||||||
//Null the up/down nav so we can swap in left/right nav
|
ChooseLevelActionMap.bind( keyboard, q, ChooseLevelMenuPrevMenu);
|
||||||
ChooseLevelActionMap.bindCmd( keyboard, w, "" );
|
ChooseLevelActionMap.bind( gamepad, btn_l, ChooseLevelMenuPrevMenu);
|
||||||
ChooseLevelActionMap.bindCmd( keyboard, s, "" );
|
|
||||||
ChooseLevelActionMap.bindCmd( gamepad, yaxis, "" );
|
|
||||||
ChooseLevelActionMap.bindCmd( gamepad, upov, "" );
|
|
||||||
ChooseLevelActionMap.bindCmd( gamepad, dpov, "" );
|
|
||||||
|
|
||||||
ChooseLevelActionMap.bind( keyboard, a, BaseUINavigatePrev );
|
ChooseLevelActionMap.bind( keyboard, e, ChooseLevelMenuNextMenu);
|
||||||
ChooseLevelActionMap.bind( keyboard, d, BaseUINavigateNext );
|
ChooseLevelActionMap.bind( gamepad, btn_r, ChooseLevelMenuNextMenu);
|
||||||
ChooseLevelActionMap.bind( gamepad, xaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
|
|
||||||
ChooseLevelActionMap.bind( gamepad, lpov, BaseUINavigatePrev );
|
|
||||||
ChooseLevelActionMap.bind( gamepad, rpov, BaseUINavigateNext );
|
|
||||||
|
|
||||||
ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin );
|
ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin );
|
||||||
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
|
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenu::syncGUI(%this)
|
||||||
|
{
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
//Category handling
|
||||||
|
%btn = ChooseLevelMenuTabList.getObject(%this.currentMenuIdx);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
%buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x;
|
||||||
|
|
||||||
|
ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX;
|
||||||
|
ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
|
||||||
|
|
||||||
|
ChooseLevelBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
|
||||||
|
|
||||||
|
ChooseLevelStartBtn.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelBegin"));
|
||||||
|
|
||||||
|
ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu"));
|
||||||
|
ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu"));
|
||||||
|
|
||||||
|
ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
|
||||||
|
ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
function LevelPreviewArray::syncGUI(%this)
|
function LevelPreviewArray::syncGUI(%this)
|
||||||
{
|
{
|
||||||
%this.callOnChildren("setHighlighted", false);
|
|
||||||
|
|
||||||
%btn = %this.getObject(%this.listPosition);
|
%btn = %this.getObject(%this.listPosition);
|
||||||
%btn-->button.setHighlighted(true);
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
$selectedLevelAsset = %btn.levelAssetId;
|
$selectedLevelAsset = %btn.levelAssetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenuPrevMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
%currentIdx = ChooseLevelMenu.currentMenuIdx;
|
||||||
|
ChooseLevelMenu.currentMenuIdx -= 1;
|
||||||
|
|
||||||
|
ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1);
|
||||||
|
|
||||||
|
if(%currentIdx == ChooseLevelMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenuNextMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
%currentIdx = ChooseLevelMenu.currentMenuIdx;
|
||||||
|
ChooseLevelMenu.currentMenuIdx += 1;
|
||||||
|
|
||||||
|
ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1);
|
||||||
|
|
||||||
|
if(%currentIdx == ChooseLevelMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ChooseLevelMenu::openMenu(%this, %menuIdx)
|
||||||
|
{
|
||||||
|
LevelSelectContainer.setVisible(%menuIdx == 0);
|
||||||
|
ServerConfigContainer.setVisible(%menuIdx == 1);
|
||||||
|
|
||||||
|
if(%menuIdx == 0)
|
||||||
|
$MenuList = LevelPreviewArray;
|
||||||
|
else if(%menuIdx == 1)
|
||||||
|
$MenuList = ServerConfigList;
|
||||||
|
|
||||||
|
%this.currentMenuIdx = %menuIdx;
|
||||||
|
|
||||||
|
if($MenuList.isMethod("syncGui"))
|
||||||
|
$MenuList.syncGui();
|
||||||
|
|
||||||
|
%this.syncGui();
|
||||||
|
}
|
||||||
|
|
||||||
function ChooseLevelBegin(%val)
|
function ChooseLevelBegin(%val)
|
||||||
{
|
{
|
||||||
if(%val)
|
if(%val)
|
||||||
|
|
@ -179,6 +225,8 @@ function ChooseLevelBegin(%val)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$selectedLevelAsset = %entry.levelAssetId;
|
||||||
|
|
||||||
// Launch the chosen level with the editor open?
|
// Launch the chosen level with the editor open?
|
||||||
if ( ChooseLevelMenu.launchInEditor )
|
if ( ChooseLevelMenu.launchInEditor )
|
||||||
{
|
{
|
||||||
|
|
@ -198,14 +246,27 @@ function ChooseLevelMenu::onSleep( %this )
|
||||||
// This is set from the outside, only stays true for a single wake/sleep
|
// This is set from the outside, only stays true for a single wake/sleep
|
||||||
// cycle.
|
// cycle.
|
||||||
%this.launchInEditor = false;
|
%this.launchInEditor = false;
|
||||||
|
|
||||||
|
//Ensure any changes we made to our server configs is saved out
|
||||||
|
if($pref::HostMultiPlayer)
|
||||||
|
{
|
||||||
|
echo("Exporting server prefs");
|
||||||
|
%prefPath = getPrefpath();
|
||||||
|
export("$Pref::Server::*", %prefPath @ "/serverPrefs." @ $TorqueScriptFileExtension, false);
|
||||||
|
BanList::Export(%prefPath @ "/banlist." @ $TorqueScriptFileExtension);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function LevelPreviewButton::onHighlighted(%this, %highlighted)
|
function LevelPreviewButton::onHighlighted(%this, %highlighted)
|
||||||
{
|
{
|
||||||
%container = %this.getParent();
|
if(%highlighted)
|
||||||
|
{
|
||||||
|
$MenuList.listPosition = $MenuList.getObjectIndex(%this);
|
||||||
|
|
||||||
%container-->levelNameTxt.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
|
LevelPreviewBitmap.bitmapAsset = %this.bitmapAsset;
|
||||||
%container-->levelDescTxt.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile;
|
LevelNameText.text = %this.levelAsset.levelName;
|
||||||
|
LevelDescriptionText.setText(%this.levelAsset.levelDescription);
|
||||||
|
|
||||||
LevelPreviewScroll.scrollToObject(%this);
|
LevelPreviewScroll.scrollToObject(%this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
|
||||||
new GuiTextEditCtrl(JoinServerPlayerNameTxt) {
|
new GuiTextEditCtrl(JoinServerPlayerNameTxt) {
|
||||||
text = "Visitor";
|
text = "Visitor";
|
||||||
position = "606 7";
|
position = "606 7";
|
||||||
extent = "295 18";
|
extent = "295 22";
|
||||||
horizSizing = "left";
|
horizSizing = "left";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "MenuTextEditprofile";
|
profile = "MenuTextEditprofile";
|
||||||
|
|
@ -59,7 +59,33 @@ $guiContent = new GuiControl(JoinServerMenu) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer() {
|
new GuiContainer() {
|
||||||
position = "190 97";
|
position = "190 87";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Password";
|
||||||
|
position = "0 5";
|
||||||
|
extent = "78 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(JoinServerPasswordTxt) {
|
||||||
|
text = "Visitor";
|
||||||
|
position = "606 7";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Client::Password";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "190 121";
|
||||||
extent = "900 30";
|
extent = "900 30";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
profile = "GuiMenuPanelProfile";
|
profile = "GuiMenuPanelProfile";
|
||||||
|
|
@ -94,8 +120,8 @@ $guiContent = new GuiControl(JoinServerMenu) {
|
||||||
new GuiScrollCtrl() {
|
new GuiScrollCtrl() {
|
||||||
hScrollBar = "alwaysOff";
|
hScrollBar = "alwaysOff";
|
||||||
vScrollBar = "dynamic";
|
vScrollBar = "dynamic";
|
||||||
position = "190 127";
|
position = "190 151";
|
||||||
extent = "900 551";
|
extent = "900 532";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,20 @@
|
||||||
function JoinServerMenu::onWake(%this)
|
function JoinServerMenu::onWake(%this)
|
||||||
{
|
{
|
||||||
$MenuList = JoinServerList;
|
$MenuList = JoinServerList;
|
||||||
|
$MenuList.clear();
|
||||||
|
$Client::Password = "";
|
||||||
JoinServerList.listPosition = 0;
|
JoinServerList.listPosition = 0;
|
||||||
|
|
||||||
JoinServerList.syncGui();
|
JoinServerList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function JoinServerMenu::onSleep(%this)
|
||||||
|
{
|
||||||
|
echo("Exporting client prefs");
|
||||||
|
%prefPath = getPrefpath();
|
||||||
|
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
|
||||||
|
}
|
||||||
|
|
||||||
if(!isObject( JoinServerActionMap ) )
|
if(!isObject( JoinServerActionMap ) )
|
||||||
{
|
{
|
||||||
new ActionMap(JoinServerActionMap){};
|
new ActionMap(JoinServerActionMap){};
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,9 @@ function MainMenuButton::onHighlighted(%this, %highlighted)
|
||||||
|
|
||||||
function BaseUIActivateSelected()
|
function BaseUIActivateSelected()
|
||||||
{
|
{
|
||||||
|
if($MenuList.getCount() == 0 || $MenuList.listPosition >= $MenuList.getCount() || $MenuList.listPosition < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
%btn = $MenuList.getObject($MenuList.listPosition);
|
%btn = $MenuList.getObject($MenuList.listPosition);
|
||||||
|
|
||||||
if(%btn.isMethod("performClick"))
|
if(%btn.isMethod("performClick"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue