- Complied the SystemMenu buttons to the groupNum highlighting implementation as they're simple buttons

- Fixed issue of Query Server on-screen button tripping a join action
- Added playername textEdit field to Join Server menu
- Fixed issue of messageBox on-screen buttons not making the input events properly after adding the make/break check from prior commit
- Added MenuTextEditProfile for editable text fields in menu
- Fixed issue of not getting the correct shift key bitmap if the button name was l/rshift
This commit is contained in:
Areloch 2024-01-01 14:11:43 -06:00
parent e71880b898
commit 150684a47d
6 changed files with 87 additions and 23 deletions

View file

@ -22,6 +22,8 @@ $guiContent = new GuiControl(SystemMenu) {
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
command = "Canvas.popDialog(GameMenu);"; command = "Canvas.popDialog(GameMenu);";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
groupNum = "1";
class = "SystemMenuButton";
}; };
new GuiButtonCtrl() { new GuiButtonCtrl() {
text = "Options"; text = "Options";
@ -30,6 +32,8 @@ $guiContent = new GuiControl(SystemMenu) {
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
command = "Canvas.pushDialog(OptionsMenu);"; command = "Canvas.pushDialog(OptionsMenu);";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
groupNum = "1";
class = "SystemMenuButton";
}; };
new GuiButtonCtrl() { new GuiButtonCtrl() {
text = "Exit to Menu"; text = "Exit to Menu";
@ -38,6 +42,8 @@ $guiContent = new GuiControl(SystemMenu) {
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
command = "systemMenuExitToMenu();"; command = "systemMenuExitToMenu();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
groupNum = "1";
class = "SystemMenuButton";
}; };
new GuiButtonCtrl() { new GuiButtonCtrl() {
text = "Exit to Desktop"; text = "Exit to Desktop";
@ -46,6 +52,8 @@ $guiContent = new GuiControl(SystemMenu) {
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
command = "systemMenuExitToDesktop();"; command = "systemMenuExitToDesktop();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
groupNum = "1";
class = "SystemMenuButton";
}; };
}; };
}; };

View file

@ -2,6 +2,8 @@ function SystemMenu::onWake(%this)
{ {
$MenuList = SystemMenuButtonList; $MenuList = SystemMenuButtonList;
$MenuList.listPosition = 0; $MenuList.listPosition = 0;
$MenuList.syncGui();
} }
function SystemMenu::onSleep(%this) function SystemMenu::onSleep(%this)
@ -19,10 +21,14 @@ function systemMenuExitToDesktop()
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", ""); MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
} }
function SystemMenuButton::onHighlighted(%this, %highlighted)
{
if(%highlighted)
$MenuList.listPosition = $MenuList.getObjectIndex(%this);
}
function SystemMenuButtonList::syncGUI(%this) function SystemMenuButtonList::syncGUI(%this)
{ {
%this.callOnChildren("setHighlighted", false);
%btn = %this.getObject(%this.listPosition); %btn = %this.getObject(%this.listPosition);
%btn.setHighlighted(true); %btn.setHighlighted(true);

View file

@ -7,7 +7,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
isContainer = "1"; isContainer = "1";
canSaveDynamicFields = "1"; canSaveDynamicFields = "1";
new GuiInputCtrl(JoinServerInputHandler) { new GuiInputCtrl(JoinServerInputHandler) {
ignoreMouseEvents = "1"; ignoreMouseEvents = "1";
ActionMap = "JoinServerActionMap"; ActionMap = "JoinServerActionMap";
@ -18,7 +18,6 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "GuiInputCtrlProfile"; profile = "GuiInputCtrlProfile";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiPanel(JoinServerTitlePanel) { new GuiPanel(JoinServerTitlePanel) {
extent = "1281 60"; extent = "1281 60";
horizSizing = "width"; horizSizing = "width";
@ -34,23 +33,45 @@ $guiContent = new GuiControl(JoinServerMenu) {
}; };
}; };
new GuiContainer() { new GuiContainer() {
position = "203 61"; position = "190 61";
extent = "900 30"; extent = "900 30";
profile = GuiMenuPanelProfile;
tooltipProfile = "GuiToolTipProfile";
horizSizing = "center"; horizSizing = "center";
vertSizing = "bottom"; profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiTextCtrl() {
text = "Player Name";
position = "0 5";
extent = "98 23";
vertSizing = "center";
profile = "MenuMLSubHeaderText";
tooltipProfile = "GuiToolTipProfile";
};
new GuiTextEditCtrl(JoinServerPlayerNameTxt) {
text = "Visitor";
position = "606 7";
extent = "295 18";
horizSizing = "left";
vertSizing = "center";
profile = "MenuTextEditprofile";
variable = "$pref::Player::Name";
tooltipProfile = "GuiToolTipProfile";
};
};
new GuiContainer() {
position = "190 97";
extent = "900 30";
horizSizing = "center";
profile = "GuiMenuPanelProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiTextCtrl() { new GuiTextCtrl() {
text = "Server Details"; text = "Server Details";
position = "0 0";
extent = "700 30"; extent = "700 30";
horizSizing = "right";
vertSizing = "center"; vertSizing = "center";
profile = "MenuSubHeaderText"; profile = "MenuSubHeaderText";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiTextCtrl() { new GuiTextCtrl() {
text = "Ping"; text = "Ping";
position = "700 0"; position = "700 0";
@ -60,7 +81,6 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "MenuSubHeaderCenteredText"; profile = "MenuSubHeaderCenteredText";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiTextCtrl() { new GuiTextCtrl() {
text = "Player Count"; text = "Player Count";
position = "770 0"; position = "770 0";
@ -70,12 +90,12 @@ $guiContent = new GuiControl(JoinServerMenu) {
profile = "MenuSubHeaderCenteredText"; profile = "MenuSubHeaderCenteredText";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
}; };
new GuiScrollCtrl() { new GuiScrollCtrl() {
hScrollBar = "alwaysOff"; hScrollBar = "alwaysOff";
vScrollBar = "dynamic"; vScrollBar = "dynamic";
position = "203 91"; position = "190 127";
extent = "900 621"; extent = "900 551";
minExtent = "8 8"; minExtent = "8 8";
horizSizing = "center"; horizSizing = "center";
vertSizing = "height"; vertSizing = "height";
@ -102,7 +122,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
new GuiIconButtonCtrl(JoinServerJoinBtn) { new GuiIconButtonCtrl(JoinServerJoinBtn) {
BitmapAsset = "UI:Keyboard_Black_Return_image"; BitmapAsset = "UI:Keyboard_Black_Space_image";
sizeIconToButton = "1"; sizeIconToButton = "1";
makeIconSquare = "1"; makeIconSquare = "1";
textLocation = "Center"; textLocation = "Center";
@ -112,11 +132,12 @@ $guiContent = new GuiControl(JoinServerMenu) {
horizSizing = "left"; horizSizing = "left";
vertSizing = "center"; vertSizing = "center";
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
active = "0";
command = "JoinServerMenu.join();"; command = "JoinServerMenu.join();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiIconButtonCtrl(JoinServerQLanBtn) { new GuiIconButtonCtrl(JoinServerQLanBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image"; BitmapAsset = "UI:Keyboard_Black_E_image";
sizeIconToButton = "1"; sizeIconToButton = "1";
makeIconSquare = "1"; makeIconSquare = "1";
textLocation = "Center"; textLocation = "Center";
@ -130,7 +151,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiIconButtonCtrl(JoinServerQServerBtn) { new GuiIconButtonCtrl(JoinServerQServerBtn) {
BitmapAsset = "UI:Keyboard_Black_Escape_image"; BitmapAsset = "UI:Keyboard_Black_Q_image";
sizeIconToButton = "1"; sizeIconToButton = "1";
makeIconSquare = "1"; makeIconSquare = "1";
textLocation = "Center"; textLocation = "Center";
@ -140,7 +161,7 @@ $guiContent = new GuiControl(JoinServerMenu) {
horizSizing = "left"; horizSizing = "left";
vertSizing = "center"; vertSizing = "center";
profile = "GuiMenuButtonProfile"; profile = "GuiMenuButtonProfile";
command = "JoinServerMenu.join();"; command = "JoinServerMenu.query();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
}; };
new GuiIconButtonCtrl(JoinServerBackBtn) { new GuiIconButtonCtrl(JoinServerBackBtn) {

View file

@ -157,7 +157,7 @@ function MessageBoxOK(%title, %message, %callback)
Canvas.pushDialog(MessageBoxDlg); Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title; MessageBoxTitleText.text = %title;
%okButton = MessageBoxCtrl.createButton("OK", "messageBoxYesClicked();"); %okButton = MessageBoxCtrl.createButton("OK", "messageBoxYesClicked(1);");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked"); %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
%okButton.setBitmap(%bitmapAssetId); %okButton.setBitmap(%bitmapAssetId);
@ -182,11 +182,11 @@ function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLab
else else
%cancelLabel = %cancelLabelOverride; %cancelLabel = %cancelLabelOverride;
%okButton = MessageBoxCtrl.createButton(%okLabel, "messageBoxYesClicked();"); %okButton = MessageBoxCtrl.createButton(%okLabel, "messageBoxYesClicked(1);");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked"); %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
%okButton.setBitmap(%bitmapAssetId); %okButton.setBitmap(%bitmapAssetId);
%cancelButton = MessageBoxCtrl.createButton(%cancelLabel, "messageBoxNoClicked();"); %cancelButton = MessageBoxCtrl.createButton(%cancelLabel, "messageBoxNoClicked(1);");
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxNoClicked"); %bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxNoClicked");
%cancelButton.setBitmap(%bitmapAssetId); %cancelButton.setBitmap(%bitmapAssetId);

View file

@ -200,4 +200,30 @@ singleton GuiControlProfile(GuiMenuScrollProfile)
bitmapAsset = "UI:scrollBar_image"; bitmapAsset = "UI:scrollBar_image";
hasBitmapArray = true; hasBitmapArray = true;
category = "BaseUI"; category = "BaseUI";
}; };
new GuiControlProfile(MenuTextEditprofile)
{
opaque = true;
fillColor = "10 10 10 255";
fillColorHL = "10 10 10 255";
fontColor = "240 240 240";
fontColorHL = "10 10 10 255";
fontColorSEL = "255 255 255 255";
fontColorNA = "200 200 200";
textOffset = "4 2";
autoSizeWidth = false;
autoSizeHeight = true;
justify = "left";
tab = true;
canKeyFocus = true;
category = "BaseUI";
borderColorSEL = "0 0 0 0";
fontColors[0] = "240 240 240 255";
fontColors[1] = "10 10 10 255";
fontColors[2] = "200 200 200 255";
fontColors[3] = "255 255 255 255";
fillColorSEL = "10 10 10 255";
fontSize = "18";
cursorColor = "255 255 255 255";
};

View file

@ -113,6 +113,9 @@ function getButtonBitmap(%device, %button)
} }
else if(%device $= "Keyboard" || %device $= "Mouse") else if(%device $= "Keyboard" || %device $= "Mouse")
{ {
if(%button $= "lshift" || %button $= "rshift")
%button = "shift";
%assetId = "UI:Keyboard_Black_" @ %button @ "_image"; %assetId = "UI:Keyboard_Black_" @ %button @ "_image";
} }
else if(%device !$= "") else if(%device !$= "")