Ongoing wipwork of the BaseUI update. Some bugfixes pending

This commit is contained in:
Areloch 2023-12-16 23:18:33 -06:00
parent 616d974212
commit ce4c8dabc9
53 changed files with 2033 additions and 3892 deletions

View file

@ -1,50 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
function GuiTreeViewCtrl::onDefineIcons( %this )
{
%icons = "core/art/gui/images/treeview/default:" @
"core/art/gui/images/treeview/simgroup:" @
"core/art/gui/images/treeview/simgroup_closed:" @
"core/art/gui/images/treeview/simgroup_selected:" @
"core/art/gui/images/treeview/simgroup_selected_closed:" @
"core/art/gui/images/treeview/hidden:" @
"core/art/gui/images/treeview/shll_icon_passworded_hi:" @
"core/art/gui/images/treeview/shll_icon_passworded:" @
"core/art/gui/images/treeview/default";
%this.buildIconTable(%icons);
}
function GuiTreeViewCtrl::handleRenameObject( %this, %name, %obj )
{
%inspector = GuiInspector::findByObject( %obj );
if( isObject( %inspector ) )
{
%field = ( %this.renameInternal ) ? "internalName" : "name";
%inspector.setObjectField( %field, %name );
return true;
}
return false;
}

View file

@ -1,90 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
function HelpDlg::onWake(%this)
{
HelpFileList.entryCount = 0;
HelpFileList.clear();
for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl"))
{
HelpFileList.fileName[HelpFileList.entryCount] = %file;
HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file));
HelpFileList.entryCount++;
}
HelpFileList.sortNumerical(0);
for(%i = 0; %i < HelpFileList.entryCount; %i++)
{
%rowId = HelpFileList.getRowId(%i);
%text = HelpFileList.getRowTextById(%rowId);
%text = %i + 1 @ ". " @ restWords(%text);
HelpFileList.setRowById(%rowId, %text);
}
HelpFileList.setSelectedRow(0);
}
function HelpFileList::onSelect(%this, %row)
{
%fo = new FileObject();
%fo.openForRead(%this.fileName[%row]);
%text = "";
while(!%fo.isEOF())
%text = %text @ %fo.readLine() @ "\n";
%fo.delete();
HelpText.setText(%text);
}
function getHelp(%helpName)
{
Canvas.pushDialog(HelpDlg);
if(%helpName !$= "")
{
%index = HelpFileList.findTextIndex(%helpName);
HelpFileList.setSelectedRow(%index);
}
}
function contextHelp()
{
for(%i = 0; %i < Canvas.getCount(); %i++)
{
if(Canvas.getObject(%i).getName() $= HelpDlg)
{
Canvas.popDialog(HelpDlg);
return;
}
}
%content = Canvas.getContent();
%helpPage = %content.getHelpPage();
getHelp(%helpPage);
}
function GuiControl::getHelpPage(%this)
{
return %this.helpPage;
}
function GuiMLTextCtrl::onURL(%this, %url)
{
gotoWebPage( %url );
}

View file

@ -1,729 +0,0 @@
//==============================================================================
// Menu Input Buttons
// This file manages the Menu Input Buttons stuff
// Any time you have a GUI button that should be clickable AND map to a key input
// such as a gamepad button, or enter, etc, this stuff can be used
//==============================================================================
/*
Gamepad input reference for 360 controller
btn_a = A
btn_b = B
btn_x = X
btn_y = Y
btn_r = Right Bumper
btn_l = Right Bumper
upov = Dpad Up
dpov = Dpad Down
lpov = Dpad Left
rpov = Dpad Right
xaxis = Left Stick | + values = up, - values = down
yaxis = Left Stick | + values = up, - values = down
rxaxis = Right Stick | + values = up, - values = down
ryaxis = Right Stick | + values = up, - values = down
zaxis = Left Trigger
rzaxis = Right Trigger
btn_start = Start
btn_back = Back/Select
*/
//==============================================================================
/// Summary:
/// This is used with the main UI menu lists, when a non-axis input event is called
/// such as pressing a button
/// It is called from the engine
///
/// \param %device (string) The name of the device the input event is coming fromt
/// \param %action (string) The specific key/input action
/// \param %state (bool) The down/up state of the event sent
function UIMenuButtonList::onInputEvent(%this, %device, %action, %state)
{
if(%state)
$activeMenuButtonContainer.processInputs(%device, %action);
}
//==============================================================================
/// Summary:
/// This is used with the main UI menu lists, when an axis input event is called
/// such as moving a joystick
/// It is called from the engine
///
/// \param %device (string) The name of the device the input event is coming fromt
/// \param %action (string) The specific key/input action
/// \param %axisVal (float) The float value of the axis event
function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal)
{
//Skip out of the value is too low as it could just be noise or miscalibrated defaults
if(%axisVal < 0.02)
return;
$activeMenuButtonContainer.processAxisEvent(%device, %action);
}
//==============================================================================
/// Summary:
/// Sets the command and text for the specified button. If %text and %command
/// are left empty, the button will be disabled and hidden.
///
/// \param %gamepadButton (string) The button to set for when using gamepad input. See the input map reference comment at the top of the file
/// \param %keyboardButton (string) The button to set for when using keyboard/mouse input.
/// \param %text (string) The text to display next to the A button graphic.
/// \param %command (string) The command executed when the A button is pressed.
function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command)
{
%this.setHidden(false);
%set = (! ((%text $= "") && (%command $= "")));
%this.gamepadButton = %gamepadButton;
%this.keyboardButton = %keyboardButton;
if(%gamepadButton $= "")
%this.gamepadValid = false;
else
%this.gamepadValid = true;
if(%keyboardButton $= "")
%this.kbmValid = false;
else
%this.kbmValid = true;
if((!%this.kbmValid && $activeControllerType !$= "gamepad") ||
(!%this.gamepadValid && $activeControllerType $= "gamepad"))
%set = false;
%this.setText(%text);
%this.Command = %command;
%this.refresh();
}
//==============================================================================
/// Summary:
/// Disables the MenuInputButton, marking it as not to consume inputs or display
function MenuInputButton::disable(%this)
{
%this.setText("");
%this.Command = "";
%this.setActive(false);
%this.setVisible(false);
}
//==============================================================================
/// Summary:
/// Refreshes the specific button, updating it's visbility status and the displayed input image
function MenuInputButton::refresh(%this)
{
%set = (! ((%this.text $= "") && (%this.command $= "")));
//Do a check so if a MenuInput is selectively bound and we're not using the
//matched input type, then we skip
if((!%this.kbmValid && $activeControllerType !$= "gamepad") ||
(!%this.gamepadValid && $activeControllerType $= "gamepad"))
%set = false;
%this.setActive(%set);
%this.setVisible(%set);
if(!%this.isActive())
return;
if($activeControllerType $= "gamepad")
{
if(%this.gamepadButton !$= "")
{
%assetId = "";
if($activeControllerName $= "PS4 Controller")
{
%assetId = "UI:PS4_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "Cross";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "Circle";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "Square";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "Triangle";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "L1";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "L2";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "R1";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "R2";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Options";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Share";
}
else if($activeControllerName $= "Nintendo Switch Pro Controller")
{
%assetId = "UI:Switch_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "B";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "A";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "Y";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "X";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "LB";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "LT";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "RB";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "RT";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Plus";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Minus";
}
else if($activeControllerName !$= "")
{
%assetId = "UI:Xbox_";
if(%this.gamepadButton $= "btn_a")
%assetId = %assetId @ "A";
else if(%this.gamepadButton $= "btn_b")
%assetId = %assetId @ "B";
else if(%this.gamepadButton $= "btn_x")
%assetId = %assetId @ "X";
else if(%this.gamepadButton $= "btn_y")
%assetId = %assetId @ "Y";
else if(%this.gamepadButton $= "btn_l")
%assetId = %assetId @ "LB";
else if(%this.gamepadButton $= "zaxis")
%assetId = %assetId @ "LT";
else if(%this.gamepadButton $= "btn_r")
%assetId = %assetId @ "RB";
else if(%this.gamepadButton $= "rzaxis")
%assetId = %assetId @ "RT";
else if(%this.gamepadButton $= "btn_start")
%assetId = %assetId @ "Menu";
else if(%this.gamepadButton $= "btn_back")
%assetId = %assetId @ "Windows";
}
}
}
else
{
if(%this.keyboardButton !$= "")
{
%assetId = "UI:Keyboard_Black_" @ %this.keyboardButton;
}
}
%this.setBitmap(%assetId @ "_image");
return true;
}
//==============================================================================
/// Summary:
/// Refreshes a menu input container, updating the buttons inside it
function MenuInputButtonContainer::refresh(%this)
{
%count = %this.getCount();
for(%i=0; %i < %count; %i++)
{
%btn = %this.getObject(%i);
%btn.refresh();
}
}
//==============================================================================
/// Summary:
/// Sets the given MenuInputButtonContainer as the active one. This directs input events
/// to it's buttons, ensures it's visible, and auto-hides the old active container if it was set
function MenuInputButtonContainer::setActive(%this)
{
if(isObject($activeMenuButtonContainer))
$activeMenuButtonContainer.hidden = true;
$activeMenuButtonContainer = %this;
$activeMenuButtonContainer.hidden = false;
$activeMenuButtonContainer.refresh();
}
//==============================================================================
/// Summary:
/// Checks the input manager for if we have a gamepad active and gets it's name
/// If we have one, also sets the active input type to gamepad
function MenuInputButtonContainer::checkGamepad(%this)
{
%controllerName = SDLInputManager::JoystickNameForIndex(0);
$activeControllerName = %controllerName;
if($activeControllerName $= "")
$activeControllerType = "K&M";
else
$activeControllerType = "gamepad";
}
//==============================================================================
/// Summary:
/// This is called by the earlier inputs callback that comes from the menu list
/// this allows us to first check what the input type is, and if the device is different
/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update
/// the display
/// Then we process the input to see if it matches to any of the button maps for our
/// MenuInputButtons. If we have a match, we execute it's command.
///
/// \param %device (string) The device that is causing the input event
/// \param %action (string) The name of the input action
function MenuInputButtonContainer::processInputs(%this, %device, %action)
{
//check to see if our status has changed
%changed = false;
%oldDevice = $activeControllerName;
%deviceName = stripTrailingNumber(%device);
if(%deviceName $= "keyboard" || %deviceName $= "mouse")
{
if($activeControllerName !$= "K&M")
%changed = true;
$activeControllerName = "K&M";
$activeControllerType = "K&M";
Canvas.showCursor();
}
else
{
if(%this.checkGamepad())
{
Canvas.hideCursor();
}
if($activeControllerType !$= %oldDevice)
%changed = true;
}
if(%changed)
%this.refresh();
//Now process the input for the button accelerator, if applicable
//Set up our basic buttons
for(%i=0; %i < %this.getCount(); %i++)
{
%btn = %this.getObject(%i);
if(!%btn.isActive())
continue;
if($activeControllerType !$= "K&M")
{
if(%btn.gamepadButton $= %action)
{
eval(%btn.command);
}
}
else
{
if(%btn.keyboardButton $= %action)
{
eval(%btn.command);
}
}
}
}
//==============================================================================
/// Summary:
/// This is called by the earlier inputs callback that comes from the menu list
/// this allows us to first check what the input type is, and if the device is different
/// (such as going from keyboard and mouse to gamepad) we can refresh the buttons to update
/// the display
///
/// \param %device (string) The name of the device the input event is coming fromt
/// \param %action (string) The specific key/input action
/// \param %axisVal (float) The float value of the axis event
function MenuInputButtonContainer::processAxisEvent(%this, %device, %action, %axisVal)
{
//check to see if our status has changed
%changed = false;
%oldDevice = $activeControllerName;
%deviceName = stripTrailingNumber(%device);
if(%deviceName $= "mouse")
{
if($activeControllerName !$= "K&M")
%changed = true;
$activeControllerName = "K&M";
$activeControllerType = "K&M";
Canvas.showCursor();
}
else
{
if(%this.checkGamepad())
{
Canvas.hideCursor();
}
if($activeControllerType !$= %oldDevice)
%changed = true;
}
if(%changed)
%this.refresh();
}
//
//
function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType)
{
/*if(GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = false;
}*/
}
function onSDLDeviceDisconnected(%sdlIndex)
{
/*if(!GamepadButtonsGui.checkGamepad())
{
GamepadButtonsGui.hidden = true;
}*/
}
//==============================================================================
// Menu Input processing
// These functions manage the Menu input processing in general
// Whenever a MenuInputHandler consumes an input event, it'll process them here
// This'll let the active menu list be navigated, as well as buttons be processed
// and ultimately handled by the Input Buttons above
//==============================================================================
//==============================================================================
/// Summary:
/// This is used with the main UI menu lists, when an axis input event is called
/// such as moving a joystick
/// It is called from the engine
///
/// \param %device (string) The name of the device the input event is coming fromt
/// \param %action (string) The specific key/input action
/// \param %axisVal (float) The float value of the axis event
function MenuInputHandler::onAxisEvent(%this, %device, %action, %value)
{
//this is to force a refresh of the menu
if(%value == 1 || %value == -1)
$activeMenuButtonContainer.processInputs(%device, %action);
if(startsWith(%device, "mouse"))
return;
if((%action $= "upov" && %value > 0) || (%action $= "yaxis" && %value == -1))
{
$activeMenuList.navigateUp();
}
if((%action $= "dpov" && %value > 0) || (%action $= "yaxis" && %value == 1))
{
$activeMenuList.navigateDown();
}
//How we deal with the left and right navigation is dependant on the mode of the
//menu list
if($activeMenuListMode $= "Settings")
{
if((%action $= "lpov" && %value > 0) || (%action $= "xaxis" && %value == -1))
{
echo("Options menu nudged left!");
//$activeMenuList.navigateLeft();
}
if((%action $= "rpov" && %value > 0) || (%action $= "xaxis" && %value == -1))
{
echo("Options menu nudged right!");
//$activeMenuList.navigateRight();
}
}
else
{
if((%action $= "lpov" && %value > 0) || (%action $= "xaxis" && %value == -1))
{
$activeMenuList.navigateLeft();
}
if((%action $= "rpov" && %value > 0) || (%action $= "xaxis" && %value == -1))
{
$activeMenuList.navigateRight();
}
}
}
//==============================================================================
/// Summary:
/// This is used with the main UI menu lists, when a non-axis input event is called
/// such as pressing a button
/// It is called from the engine
///
/// \param %device (string) The name of the device the input event is coming fromt
/// \param %action (string) The specific key/input action
/// \param %state (bool) The down/up state of the event sent
function MenuInputHandler::onInputEvent(%this, %device, %action, %state)
{
if(%action $= "upov" || %action $= "dpov" || %action $= "lpov" || %action $= "rpov")
{
%this.onAxisEvent(%device, %action, %state);
return;
}
if(%state)
$activeMenuButtonContainer.processInputs(%device, %action);
}
//==============================================================================
// Menu List processing
// These functions manage the navigation and activation of the Menu Lists
//==============================================================================
//==============================================================================
/// Summary:
/// Is the GUIContainer with this MenuList namespace the 'active' menulist as far
/// as UI interfaces is concerned?
function MenuList::isActiveMenuList(%this)
{
if($activeMenuList == %this)
return true;
return false;
}
//==============================================================================
/// Summary:
/// Sets the GUIContainer with this MenuList namespace as the active menulist.
/// This means that any input events caught in MenuInputHandlers is directed at
/// this menu list to navigate it
///
/// \param %startPosition (Point2F) The X and Y starting positions of the selection for this menuList
/// \param %menuMode (string) Indicates the mode/type of menuList, allowing for special behaviors depending on type
function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode)
{
if(%startPosition $= "")
%startPosition = "0 0";
if(%menuMode $= "")
%menuMode = "Menu";
$activeMenuList = %this;
$activeMenuList.hidden = false;
$activeMenuList.ListPosition = %startPosition;
$activeMenuListMode = %menuMode;
%this.refresh();
}
//==============================================================================
/// Summary:
/// Activates the currently highlighted child object
function MenuList::activate(%this)
{
//check for a highlighted element
if($activeMenuList.ListPosition.y > -1 && $activeMenuList.ListPosition < $activeMenuList.getCount())
{
%btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
%btn.performClick();
}
}
//==============================================================================
/// Summary:
/// refreshes the menuList, updating children highlight status and if there is
/// a button pointer control defined on our list, we update it's position as
/// needed
function MenuList::refresh(%this)
{
%selectedObject = -1;
for(%i=0; %i < $activeMenuList.getCount(); %i++)
{
%btn = $activeMenuList.getObject(%i);
%isSelected = %i == $activeMenuList.ListPosition.y;
%btn.setHighlighted(%isSelected);
if(%isSelected)
%selectedObject = %i;
}
if(isObject(%this.buttonPointerCtrl))
{
if(%selectedObject != -1)
{
%this.buttonPointerCtrl.setHidden(false);
%buttonCenter = $activeMenuList.getObject(%selectedObject).getGlobalCenter();
if(%this.centerButtonPointerCtrl)
{
%this.buttonPointerCtrl.setCenter(%buttonCenter.x, %buttonCenter.y);
}
else
{
//if we're not centering, then left-justify
%this.buttonPointerCtrl.setCenter(%buttonCenter.x - $activeMenuList.getObject(%selectedObject).extent.x / 2, %buttonCenter.y);
}
}
else
{
%this.buttonPointerCtrl.setHidden(true);
}
}
if($activeMenuList.isMethod("onNavigate"))
$activeMenuList.onNavigate($activeMenuList.ListPosition.y);
%parent = $activeMenuList.getParent();
if(%parent.getClassName() $= "GuiScrollCtrl")
{
%parent.scrollToObject(%selectedObject);
}
}
//==============================================================================
/// Summary:
/// Selects the next 'up' child item in the menuList. If the current is the topmost
/// then nothing happens
function MenuList::navigateUp(%this)
{
$activeMenuList.ListPosition.y -= 1;
if($activeMenuList.ListPosition.y < 0)
$activeMenuList.ListPosition.y = 0;
%this.refresh();
}
//==============================================================================
/// Summary:
/// Selects the next 'down' child item in the menuList. If the current is the bottommost
/// then nothing happens
function MenuList::navigateDown(%this)
{
$activeMenuList.ListPosition.y += 1;
if($activeMenuList.ListPosition.y >= $activeMenuList.getCount())
$activeMenuList.ListPosition.y = $activeMenuList.getCount()-1;
%this.refresh();
}
//==============================================================================
/// Summary:
/// Selects the next 'left' child item in the menuList. If the current item is the leftmost
/// then nothing happens
function MenuList::navigateLeft()
{
//Atm, we're only handling specific control types, namely options entries, but
//this could readily be expanded upon to handle grids like for inventory screens
//or the like
%btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
{
%mode = %btn.getMode();
if(%mode == 0) //options list
{
%optionId = %btn.getCurrentOptionIndex() - 1;
%btn.selectOptionByIndex(%optionId);
%btn.onChange();
}
else if(%mode == 1) //slider
{
%value = %btn.getValue();
%adjustedValue = %value - %btn.getIncrement();
%minValue = %btn.getRange().x;
if(%adjustedValue < %minValue)
%adjustedValue = %minValue;
%btn.setValue(%adjustedValue);
%btn.onChange();
}
}
}
//==============================================================================
/// Summary:
/// Selects the next 'right' child item in the menuList. If the current item is the rightmost
/// then nothing happens
function MenuList::navigateRight()
{
%btn = $activeMenuList.getObject($activeMenuList.ListPosition.y);
if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled())
{
%mode = %btn.getMode();
if(%mode == 0) //options list
{
%optionId = %btn.getCurrentOptionIndex() + 1;
%btn.selectOptionByIndex(%optionId);
%btn.onChange();
}
else if(%mode == 1) //slider
{
%value = %btn.getValue();
%adjustedValue = %value + %btn.getIncrement();
%maxValue = %btn.getRange().y;
if(%adjustedValue > %maxValue)
%adjustedValue = %maxValue;
%btn.setValue(%adjustedValue);
%btn.onChange();
}
}
}
//==============================================================================
/// Summary:
/// Gets the current vertical positionally selected child object
function MenuList::getActiveRow(%this)
{
return $activeMenuList.ListPosition.y;
}
//==============================================================================
/// Summary:
/// Called from the engine when a GUIButtonBase-derived class with MenuListButton namespace class
/// has its highlighting status changed. Allows us to react to this change of state and trigger refreshse
/// or other events to keep the navigation tracking up to date
///
/// \param %state (bool) The on/off state of the button being highlighted
function MenuListButton::onHighlighted(%this, %state)
{
echo("MenuListButton::onHighlighted() - " @ %this.internalName @ " was " @ %state @ " highlighted");
%parentContainer = %this.getParent();
if(%parentContainer.class $= "MenuList" || %parentContainer.superClass $= "MenuList")
{
if(isObject(%parentContainer.buttonPointerCtrl))
{
if(%state)
{
%parentContainer.buttonPointerCtrl.setHidden(false);
%buttonCenter = %this.getGlobalCenter();
echo(" - button center:" @ %buttonCenter);
if(%parentContainer.centerButtonPointerCtrl)
{
%parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x, %buttonCenter.y);
}
else
{
//if we're not centering, then left-justify
%parentContainer.buttonPointerCtrl.setGlobalCenter(%buttonCenter.x - %this.extent.x / 2, %buttonCenter.y);
}
echo(" - pointer position:" @ %parentContainer.buttonPointerCtrl.getPosition());
}
/*else
{
%parentContainer.buttonPointerCtrl.setHidden(true);
}*/
}
}
}

View file

@ -1,308 +0,0 @@
//==============================================================================
/// Summary:
/// This function sets the root page for the navigation stack. The root page is 'below'
/// all other normal pages and cannot be popped like a normal page.
/// When we set a new root page, we first check if we have an existing root page.
/// If we do, we run the usual canClose() then onClose() function pair, then we
/// set it and call the onOpen() for the new root page.
///
/// \param %rootPage (guiControl) The new guiControl that is being set as the root page of the navigation stack
function UINavigation::setRootPage(%this, %rootPage)
{
if(!isObject(%this.pageStack))
{
%this.pageStack = new ArrayObject();
}
if(%this.rootPage $= %rootPage)
return;
if(isObject(%this.rootPage))
{
%canClose = true;
if(%this.rootPage.isMethod("canClose"))
%canClose = %this.rootPage.call("canClose");
if(!%canClose)
return; //if we're not allowed to close, just bail out wholesale because clearly
//something is blocking changes to pages
%this.remove(%this.rootPage);
if(%this.rootPage.isMethod("onClose"))
%this.rootPage.call("onClose");
%this.rootPage.navigation = "";
}
%this.rootPage = %rootPage;
%this.add(%rootPage);
if(%this.resizePages)
{
%rootPage.resize(%this.position.x, %this.position.y,
%this.extent.x, %this.extent.y);
}
%rootPage.navigation = %this;
if(%rootPage.isMethod("onOpen"))
%rootPage.call("onOpen");
}
//==============================================================================
/// Summary:
/// This function pushes a page onto the given UINavigation-classed GUIContainer's stack
/// The order of operations is thus:
/// 1) check to see if the new page being pushed says it can open via the canOpen() function.
/// If this method is not defined, it defaults to true, as there's no impediment to continuing
/// If this check returns false, the pushPage event cancels.
/// 2) check to see if the current page on the stack says it can close. Similar to
/// the canOpen() check on the new page, we default to true
/// If this check returns false, the pushPage event cancels.
/// 3) Call - if defined - onClose() on the current top page of the stack
/// 4) Add the new page onto the stack
/// 5) Call - if defined - onOpen() on the new page
/// 6) Finally, if we defined a callback, call that.
/// With this all run, the previous top page has done any cleanup work it needed to
/// and the new top page has been opened successfully.
///
/// \param %newPage (guiControl) The new guiControl that is being added onto the page stack
/// \param %callback[optional]: (Evaluable string) A evalable statement to invoke when the push has been completed
function UINavigation::pushPage(%this, %newPage, %callback)
{
if(!isObject(%this.pageStack))
{
%this.pageStack = new ArrayObject();
}
//don't re-add pages
if(%this.getPageCount() != 0 &&
%this.pageStack.getIndexFromKey(%newPage) != -1)
return;
%canChange = true;
if(%newPage.isMethod("canOpen"))
%canChange = %newPage.call("canOpen");
if(!%canChange)
return;
%currentPage = %this.getCurrentPage();
if(isObject(%currentPage))
{
if(%currentPage.isMethod("canClose"))
%canChange = %currentPage.call("canClose");
if(!%canChange)
return;
if(%currentPage.isMethod("onClose"))
%currentPage.call("onClose");
}
%this.pageStack.push_back(%newPage);
%this.add(%newPage);
if(%this.resizePages)
{
%newPage.resize(%this.position.x, %this.position.y,
%this.extent.x, %this.extent.y);
}
if(%newPage.isMethod("onOpen"))
%newPage.call("onOpen");
%newPage.navigation = %this;
if(%callback !$= "")
eval(%callback);
}
//==============================================================================
/// Summary:
/// This function pops the topmost page off the given UINavigation-classed GUIContainer's stack
/// The order of operations is thus:
/// 1) check to see if the top page being popped says it can close via the canClose() function.
/// If this method is not defined, it defaults to true, as there's no impediment to continuing
/// If this check returns false, the popPage event cancels.
/// 2) check to see if the previous page on the stack says it can open. Similar to
/// the canClose() check on the new page, we default to true
/// If this check returns false, the popPage event cancels.
/// 3) Call - if defined - onClose() on the current top page of the stack
/// 4) Remove the top page
/// 5) Call - if defined - onOpen() on the now topmost page
/// 6) Finally, if we defined a callback, call that.
/// With this all run, the previous top page has done any cleanup work it needed to
/// and the new top page has been opened successfully.
///
/// \param %callback[optional] (Evaluable string) A evalable statement to invoke when the pop has been completed
function UINavigation::popPage(%this, %callback)
{
if(%this.pageStack.count() == 0)
return;
%currentPage = %this.getCurrentPage();
if(isObject(%currentPage))
{
%canChange = true;
if(%currentPage.isMethod("canClose"))
%canChange = %currentPage.call("canClose");
if(!%canChange)
return;
}
%prevPage = %this.getPreviousPage();
if(isObject(%prevPage))
{
%canChange = true;
if(%prevPage.isMethod("canOpen"))
%canChange = %prevPage.call("canOpen");
if(!%canChange)
return;
}
if(isObject(%currentPage))
{
if(%currentPage.isMethod("onClose"))
{
%currentPage.call("onClose");
}
%this.pageStack.pop_back();
%this.remove(%currentPage);
%currentPage.navigation = "";
}
%newTopPage = %this.getCurrentPage();
if(isObject(%newTopPage))
{
if(%newTopPage.isMethod("onOpen"))
%newTopPage.call("onOpen");
}
if(%callback !$= "")
eval(%callback);
}
//==============================================================================
/// Summary:
/// In order tops the topmost page in a loop until it has closed the entire stack,
/// leaving only the root page
///
/// \param %callback[optional] (Evaluable String) A evalable statement to invoke when the pop has been completed
function UINavigation::popToRoot(%this, %callback)
{
%pageChanged = false;
while(%this.getPageCount() != 0)
{
%currentPage = %this.getCurrentPage();
if(isObject(%currentPage))
{
if(%currentPage.isMethod("canClose"))
%canChange = %currentPage.call("canClose");
if(!%canChange)
return;
}
%prevPage = %this.getPreviousPage();
if(isObject(%prevPage))
{
if(%prevPage.isMethod("canOpen"))
%canChange = %prevPage.call("canOpen");
if(!%canChange)
return;
}
if(isObject(%currentPage))
{
if(%currentPage.isMethod("onClose"))
{
%currentPage.call("onClose");
}
%this.pageStack.pop_back();
%this.remove(%currentPage);
%currentPage.navigation = "";
}
%newTopPage = %this.getCurrentPage();
if(%newTopPage.isMethod("onOpen"))
%newTopPage.call("onOpen");
%pageChanged = true;
}
if(%pageChanged && %callback !$= "")
eval(%callback);
}
//==============================================================================
/// Summary:
/// Gets the current, topmost page on the stack. If no non-root pages are on the stack
/// the root page is returned
function UINavigation::getCurrentPage(%this)
{
if(isObject(%this.pageStack) && %this.pageStack.count() != 0)
{
return %this.pageStack.getKey(%this.pageStack.count()-1);
}
else
{
if(isObject(%this.rootPage))
return %this.rootPage;
}
return 0;
}
//==============================================================================
/// Summary:
/// Gets the page just under the topmost page in the stack. If there is no previous page
/// then the root page is returned
function UINavigation::getPreviousPage(%this)
{
if(isObject(%this.pageStack) && %this.pageStack.count() > 1)
{
return %this.pageStack.getKey(%this.pageStack.count()-2);
}
else
{
if(isObject(%this.rootPage))
return %this.rootPage;
}
return 0;
}
//==============================================================================
/// Summary:
/// Gets the number of pages on the stack.
function UINavigation::getPageCount(%this)
{
%count = 0;
if(isObject(%this.pageStack))
%count = %this.pageStack.count();
if(isObject(%this.rootPage))
%count++;
return %count;
}
//==============================================================================
/// Summary:
/// Force the page to reprocess to ensure it's status is up to date
function UINavigation::refreshPage(%this)
{
%page = %this.getCurrentPage();
if(!isObject(%page))
return;
if(%page.isMethod("onOpen"))
%page.call("onOpen");
}

View file

@ -1,341 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// --------------------------------------------------------------------
// Message Sound
// --------------------------------------------------------------------
/*new SFXDescription(MessageBoxAudioDescription)
{
volume = 1.0;
isLooping = false;
is3D = false;
channel = $GuiAudioType;
};
new SFXProfile(messageBoxBeep)
{
filename = "./messageBoxSound";
description = MessageBoxAudioDescription;
preload = true;
};*/
//---------------------------------------------------------------------------------------------
// messageCallback
// Calls a callback passed to a message box.
//---------------------------------------------------------------------------------------------
function messageCallback(%dlg, %callback)
{
Canvas.popDialog(%dlg);
eval(%callback);
}
//---------------------------------------------------------------------------------------------
// MBSetText
// Sets the text of a message box and resizes it to accomodate the new string.
//---------------------------------------------------------------------------------------------
function MBSetText(%text, %frame, %msg)
{
// Get the extent of the text box.
%ext = %text.getExtent();
// Set the text in the center of the text box.
%text.setText("<just:center>" @ %msg);
// Force the textbox to resize itself vertically.
%text.forceReflow();
// Grab the new extent of the text box.
%newExtent = %text.getExtent();
// Get the vertical change in extent.
%deltaY = getWord(%newExtent, 1) - getWord(%ext, 1);
// Resize the window housing the text box.
%windowPos = %frame.getPosition();
%windowExt = %frame.getExtent();
%frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2),
getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY);
%frame.canMove = "0";
//%frame.canClose = "0";
%frame.resizeWidth = "0";
%frame.resizeHeight = "0";
%frame.canMinimize = "0";
%frame.canMaximize = "0";
//sfxPlayOnce( messageBoxBeep );
}
function MessageBoxCtrl::onWake(%this)
{
}
//---------------------------------------------------------------------------------------------
// Various message box display functions. Each one takes a window title, a message, and a
// callback for each button.
//---------------------------------------------------------------------------------------------
//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\"");
function MessageBoxOK(%title, %message, %callback)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MessageBoxOCButtonHolder.hidden = true;
MessageBoxYNCButtonHolder.hidden = true;
MessageBoxOKButtonHolder.hidden = false;
MessageBoxOKButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);");
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
MessageBoxOKButtonHolder.setActive();
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.callback = %callback;
}
function MessageBoxOKDlg::onSleep( %this )
{
%this.callback = "";
MessageBoxCtrl.originalMenuInputContainer.setActive();
}
function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MessageBoxOCButtonHolder.hidden = false;
MessageBoxYNCButtonHolder.hidden = true;
MessageBoxOKButtonHolder.hidden = true;
if(%okLabelOverride $= "")
%okLabel = "OK";
else
%okLabel = %okLabelOverride;
if(%cancelLabelOverride $= "")
%cancelLabel = "Cancel";
else
%cancelLabel = %cancelLabelOverride;
MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", %okLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);");
MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", %cancelLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);");
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
MessageBoxOCButtonHolder.setActive();
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.callback = %callback;
MessageBoxDlg.cancelCallback = %cancelCallback;
}
function MessageBoxOKCancelDlg::onSleep( %this )
{
%this.callback = "";
MessageBoxCtrl.originalMenuInputContainer.setActive();
}
function MessageBoxOKCancelDetails(%title, %message, %details, %callback, %cancelCallback)
{
if(%details $= "")
{
MBOKCancelDetailsButton.setVisible(false);
}
MBOKCancelDetailsScroll.setVisible(false);
MBOKCancelDetailsFrame.setText( %title );
Canvas.pushDialog(MessageBoxOKCancelDetailsDlg);
MBSetText(MBOKCancelDetailsText, MBOKCancelDetailsFrame, %message);
MBOKCancelDetailsInfoText.setText(%details);
%textExtent = MBOKCancelDetailsText.getExtent();
%textExtentY = getWord(%textExtent, 1);
%textPos = MBOKCancelDetailsText.getPosition();
%textPosY = getWord(%textPos, 1);
%extentY = %textPosY + %textExtentY + 65;
MBOKCancelDetailsInfoText.setExtent(285, 128);
MBOKCancelDetailsFrame.setExtent(300, %extentY);
MessageBoxOKCancelDetailsDlg.callback = %callback;
MessageBoxOKCancelDetailsDlg.cancelCallback = %cancelCallback;
MBOKCancelDetailsFrame.defaultExtent = MBOKCancelDetailsFrame.getExtent();
}
function MBOKCancelDetailsToggleInfoFrame()
{
if(!MBOKCancelDetailsScroll.isVisible())
{
MBOKCancelDetailsScroll.setVisible(true);
MBOKCancelDetailsText.forceReflow();
%textExtent = MBOKCancelDetailsText.getExtent();
%textExtentY = getWord(%textExtent, 1);
%textPos = MBOKCancelDetailsText.getPosition();
%textPosY = getWord(%textPos, 1);
%verticalStretch = %textExtentY;
if((%verticalStretch > 260) || (%verticalStretch < 0))
%verticalStretch = 260;
%extent = MBOKCancelDetailsFrame.defaultExtent;
%height = getWord(%extent, 1);
%posY = %textPosY + %textExtentY + 10;
%posX = getWord(MBOKCancelDetailsScroll.getPosition(), 0);
MBOKCancelDetailsScroll.setPosition(%posX, %posY);
MBOKCancelDetailsScroll.setExtent(getWord(MBOKCancelDetailsScroll.getExtent(), 0), %verticalStretch);
MBOKCancelDetailsFrame.setExtent(300, %height + %verticalStretch + 10);
} else
{
%extent = MBOKCancelDetailsFrame.defaultExtent;
%width = getWord(%extent, 0);
%height = getWord(%extent, 1);
MBOKCancelDetailsFrame.setExtent(%width, %height);
MBOKCancelDetailsScroll.setVisible(false);
}
}
function MessageBoxOKCancelDetailsDlg::onSleep( %this )
{
%this.callback = "";
MessageBoxCtrl.originalMenuInputContainer.setActive();
}
function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MessageBoxOCButtonHolder.hidden = false;
MessageBoxYNCButtonHolder.hidden = true;
MessageBoxOKButtonHolder.hidden = true;
MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);");
MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);");
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
MessageBoxOCButtonHolder.setActive();
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.yesCallBack = %yesCallback;
MessageBoxDlg.noCallback = %noCallback;
}
function MessageBoxYesNoCancel(%title, %message, %yesCallback, %noCallback, %cancelCallback)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MessageBoxOCButtonHolder.hidden = true;
MessageBoxYNCButtonHolder.hidden = false;
MessageBoxOKButtonHolder.hidden = true;
MessageBoxYNCButtonHolder-->yesButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);");
MessageBoxYNCButtonHolder-->noButton.set("btn_x", "backspace", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);");
MessageBoxYNCButtonHolder-->cancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);");
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
MessageBoxYNCButtonHolder.setActive();
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
MessageBoxDlg.yesCallBack = %yesCallback;
MessageBoxDlg.noCallback = %noCallback;
MessageBoxDlg.cancelCallback = %cancelCallback;
}
function MessageBoxDlg::onSleep( %this )
{
%this.callback = "";
%this.cancelCallback = "";
%this.yesCallback = "";
%this.noCallback = "";
%this.cancelCallback = "";
MessageBoxCtrl.originalMenuInputContainer.setActive();
}
//---------------------------------------------------------------------------------------------
// MessagePopup
// Displays a message box with no buttons. Disappears after %delay milliseconds.
//---------------------------------------------------------------------------------------------
function MessagePopup(%title, %message, %delay)
{
Canvas.pushDialog(MessageBoxDlg);
MessageBoxTitleText.text = %title;
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
if (%delay !$= "")
schedule(%delay, 0, CloseMessagePopup);
}
function CloseMessagePopup()
{
Canvas.popDialog(MessageBoxDlg);
}
//---------------------------------------------------------------------------------------------
// IODropdown
// By passing in a simgroup or simset, the user will be able to choose a child of that group
// through a guiPopupMenuCtrl
//---------------------------------------------------------------------------------------------
function IODropdown(%title, %message, %simgroup, %callback, %cancelCallback)
{
IODropdownFrame.text = %title;
Canvas.pushDialog(IODropdownDlg);
MBSetText(IODropdownText, IODropdownFrame, %message);
if(isObject(%simgroup))
{
for(%i = 0; %i < %simgroup.getCount(); %i++)
IODropdownMenu.add(%simgroup.getObject(%i).getName());
}
IODropdownMenu.sort();
IODropdownMenu.setFirstSelected(0);
IODropdownDlg.callback = %callback;
IODropdownDlg.cancelCallback = %cancelCallback;
}
function IODropdownDlg::onSleep( %this )
{
%this.callback = "";
%this.cancelCallback = "";
IODropdownMenu.clear();
}
//The # in the function passed replaced with the output
//of the preset menu.
function IOCallback(%dlg, %callback)
{
%id = IODropdownMenu.getSelected();
%text = IODropdownMenu.getTextById(%id);
%callback = strreplace(%callback, "#", %text);
eval(%callback);
Canvas.popDialog(%dlg);
}

View file

@ -1,8 +1,10 @@
$TextMediumEmphasisColor = "200 200 200";
$TextMediumEmphasisColorHL = "0 0 0";
$TextHighEmphasisColor = "224 224 224";
$TextHighEmphasisColorHL = "0 0 0";
$TextDisabledColor = "108 108 108";
new GuiGameListMenuProfile(DefaultListMenuProfile)
singleton GuiGameListMenuProfile(DefaultListMenuProfile)
{
fontType = "Arial Bold";
fontSize = 20;
@ -26,12 +28,12 @@ new GuiGameListMenuProfile(DefaultListMenuProfile)
canKeyFocus = true;
};
new GuiControlProfile(GamepadDefaultProfile)
singleton GuiControlProfile(GamepadDefaultProfile)
{
border = 0;
};
new GuiControlProfile(GamepadButtonTextLeft)
singleton GuiControlProfile(GamepadButtonTextLeft)
{
fontType = "Arial Bold";
fontSize = 20;
@ -39,20 +41,26 @@ new GuiControlProfile(GamepadButtonTextLeft)
justify = "left";
};
new GuiControlProfile(GamepadButtonTextRight : GamepadButtonTextLeft)
singleton GuiControlProfile(GamepadButtonTextRight : GamepadButtonTextLeft)
{
justify = "right";
};
new GuiControlProfile(MenuHeaderText)
singleton GuiControlProfile(MenuHeaderText)
{
fontType = "Arial Bold";
fontSize = 30;
fontColor = $TextHighEmphasisColor;
justify = "left";
modal = false;
};
new GuiControlProfile(MenuHeaderTextCenter)
singleton GuiControlProfile(MenuHeaderTextHighlighted : MenuHeaderText)
{
fontColor = $TextHighEmphasisColorHL;
};
singleton GuiControlProfile(MenuHeaderTextCenter)
{
fontType = "Arial Bold";
fontSize = 30;
@ -60,15 +68,26 @@ new GuiControlProfile(MenuHeaderTextCenter)
justify = "center";
};
new GuiControlProfile(MenuSubHeaderText)
singleton GuiControlProfile(MenuSubHeaderText)
{
fontType = "Arial Bold";
fontSize = 20;
fontColor = $TextMediumEmphasisColor;
justify = "left";
modal = false;
};
new GuiControlProfile(MenuMLSubHeaderText)
singleton GuiControlProfile(MenuSubHeaderTextHighlighted : MenuSubHeaderText)
{
fontColor = $TextMediumEmphasisColorHL;
};
singleton GuiControlProfile(MenuSubHeaderCenteredText : MenuSubHeaderText)
{
justify = "center";
};
singleton GuiControlProfile(MenuMLSubHeaderText)
{
fontType = "Arial Bold";
fontSize = 20;
@ -76,15 +95,21 @@ new GuiControlProfile(MenuMLSubHeaderText)
justify = "left";
autoSizeWidth = true;
autoSizeHeight = true;
modal = false;
};
new GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText)
singleton GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText)
{
justify = "center";
};
if( !isObject( GuiMenuButtonProfile ) )
new GuiControlProfile( GuiMenuButtonProfile )
singleton GuiControlProfile( GuiMenuDefaultProfile )
{
opaque = false;
fillColor = "0 0 0 0";
};
singleton GuiControlProfile( GuiMenuButtonProfile )
{
opaque = true;
border = false;
@ -115,8 +140,13 @@ new GuiControlProfile( GuiMenuButtonProfile )
fontColorLinkHL = "Magenta";
};
if( !isObject( GuiHighlightMenuButtonProfile ) )
new GuiControlProfile( GuiHighlightMenuButtonProfile )
singleton GuiControlProfile( LevelPreviewButtonProfile : GuiMenuButtonProfile )
{
fontSize = 22;
justify = "Left";
};
singleton GuiControlProfile( GuiHighlightMenuButtonProfile )
{
opaque = true;
border = false;
@ -134,8 +164,7 @@ new GuiControlProfile( GuiHighlightMenuButtonProfile )
category = "Core";
};
if( !isObject( GuiBlankMenuButtonProfile ) )
new GuiControlProfile( GuiBlankMenuButtonProfile )
singleton GuiControlProfile( GuiBlankMenuButtonProfile )
{
opaque = true;
border = false;
@ -155,14 +184,12 @@ new GuiControlProfile( GuiBlankMenuButtonProfile )
category = "Core";
};
if( !isObject( GuiJoinServerButtonProfile ) )
new GuiControlProfile( GuiJoinServerButtonProfile : GuiMenuButtonProfile )
singleton GuiControlProfile( GuiJoinServerButtonProfile : GuiMenuButtonProfile )
{
justify = "left";
};
if( !isObject( GuiMenuTextProfile ) )
new GuiControlProfile( GuiMenuTextProfile )
singleton GuiControlProfile( GuiMenuTextProfile )
{
opaque = true;
border = false;
@ -173,27 +200,30 @@ new GuiControlProfile( GuiMenuTextProfile )
fontColorNA = "125 125 125";
fixedExtent = false;
justify = "center";
category = "Core";
category = "BaseUI";
modal = false;
};
if( !isObject( GuiSolidDefaultProfile ) )
new GuiControlProfile (GuiSolidDefaultProfile)
singleton GuiControlProfile( GuiMenuTextProfileHighlighted : GuiMenuTextProfile )
{
fontColor = "0 0 0";
};
singleton GuiControlProfile (GuiSolidDefaultProfile)
{
opaque = true;
border = true;
category = "Core";
};
if( !isObject( GuiTransparentProfile ) )
new GuiControlProfile (GuiTransparentProfile)
singleton GuiControlProfile (GuiTransparentProfile)
{
opaque = false;
border = false;
category = "Core";
};
if( !isObject( GuiGroupBorderProfile ) )
new GuiControlProfile( GuiGroupBorderProfile )
singleton GuiControlProfile( GuiGroupBorderProfile )
{
border = false;
opaque = false;
@ -202,8 +232,7 @@ new GuiControlProfile( GuiGroupBorderProfile )
category = "Core";
};
if( !isObject( GuiTabBorderProfile ) )
new GuiControlProfile( GuiTabBorderProfile )
singleton GuiControlProfile( GuiTabBorderProfile )
{
border = false;
opaque = false;
@ -212,15 +241,13 @@ new GuiControlProfile( GuiTabBorderProfile )
category = "Core";
};
if( !isObject( GuiModelessDialogProfile ) )
new GuiControlProfile( GuiModelessDialogProfile )
singleton GuiControlProfile( GuiModelessDialogProfile )
{
modal = false;
category = "Core";
};
if( !isObject( GuiFrameSetProfile ) )
new GuiControlProfile (GuiFrameSetProfile)
singleton GuiControlProfile (GuiFrameSetProfile)
{
fillcolor = "255 255 255";
borderColor = "246 245 244";
@ -230,31 +257,27 @@ new GuiControlProfile (GuiFrameSetProfile)
category = "Core";
};
if( !isObject( GuiInputCtrlProfile ) )
new GuiControlProfile( GuiInputCtrlProfile )
singleton GuiControlProfile( GuiInputCtrlProfile )
{
tab = true;
canKeyFocus = true;
category = "Core";
};
if( !isObject( GuiTextProfile ) )
new GuiControlProfile (GuiTextProfile)
singleton GuiControlProfile (GuiTextProfile)
{
justify = "left";
fontColor = "20 20 20";
category = "Core";
};
if( !isObject( GuiTextRightProfile ) )
new GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
singleton GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
{
justify = "right";
category = "Core";
};
if( !isObject( GuiAutoSizeTextProfile ) )
new GuiControlProfile (GuiAutoSizeTextProfile)
singleton GuiControlProfile (GuiAutoSizeTextProfile)
{
fontColor = "0 0 0";
autoSizeWidth = true;
@ -262,22 +285,19 @@ new GuiControlProfile (GuiAutoSizeTextProfile)
category = "Core";
};
if( !isObject( GuiMediumTextProfile ) )
new GuiControlProfile( GuiMediumTextProfile : GuiTextProfile )
singleton GuiControlProfile( GuiMediumTextProfile : GuiTextProfile )
{
fontSize = 24;
category = "Core";
};
if( !isObject( GuiBigTextProfile ) )
new GuiControlProfile( GuiBigTextProfile : GuiTextProfile )
singleton GuiControlProfile( GuiBigTextProfile : GuiTextProfile )
{
fontSize = 36;
category = "Core";
};
if( !isObject( GuiMLTextProfile ) )
new GuiControlProfile( GuiMLTextProfile )
singleton GuiControlProfile( GuiMLTextProfile )
{
fontColor = $TextMediumEmphasisColor;
fontColorHL = $TextMediumEmphasisColor;
@ -289,11 +309,16 @@ new GuiControlProfile( GuiMLTextProfile )
autoSizeWidth = true;
autoSizeHeight = true;
border = false;
category = "Core";
modal = false;
category = "BaseUI";
};
if( !isObject( GuiMLWhiteTextProfile ) )
new GuiControlProfile( GuiMLWhiteTextProfile )
singleton GuiControlProfile( GuiMLTextProfileHighlighted : GuiMLTextProfile )
{
fontColor = $TextMediumEmphasisColorHL;
};
singleton GuiControlProfile( GuiMLWhiteTextProfile )
{
fontColor = "220 220 220";
fontColorHL = $TextMediumEmphasisColor;
@ -303,8 +328,7 @@ new GuiControlProfile( GuiMLWhiteTextProfile )
category = "Core";
};
if( !isObject( GuiTextArrayProfile ) )
new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile )
singleton GuiControlProfile( GuiTextArrayProfile : GuiTextProfile )
{
fontColor = $TextMediumEmphasisColor;
fontColorHL = $TextMediumEmphasisColor;
@ -324,8 +348,7 @@ new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile )
canKeyFocus = true;
};
if( !isObject( GuiMenuTextEditProfile ) )
new GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile )
singleton GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile )
{
fontColor = $TextMediumEmphasisColor;
fontColorHL = $TextMediumEmphasisColor;
@ -347,8 +370,7 @@ new GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile )
// TODO: Revisit Popupmenu
// ----------------------------------------------------------------------------
if( !isObject( GuiPopupMenuItemBorder ) )
new GuiControlProfile( GuiPopupMenuItemBorder : GuiButtonProfile )
singleton GuiControlProfile( GuiPopupMenuItemBorder : GuiButtonProfile )
{
opaque = true;
border = true;
@ -362,8 +384,7 @@ new GuiControlProfile( GuiPopupMenuItemBorder : GuiButtonProfile )
category = "Core";
};
if( !isObject( GuiPopUpMenuDefault ) )
new GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile )
singleton GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile )
{
opaque = true;
mouseOverSelected = true;
@ -385,8 +406,7 @@ new GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile )
category = "Core";
};
if( !isObject( GuiPopUpMenuProfile ) )
new GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault )
singleton GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault )
{
textOffset = "6 4";
bitmapAsset = "UI:dropDown_image";
@ -396,8 +416,7 @@ new GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault )
category = "Core";
};
if( !isObject( GuiTabBookProfile ) )
new GuiControlProfile( GuiTabBookProfile )
singleton GuiControlProfile( GuiTabBookProfile )
{
fillColorHL = "100 100 100";
fillColorNA = "150 150 150";
@ -418,8 +437,7 @@ new GuiControlProfile( GuiTabBookProfile )
category = "Core";
};
if( !isObject( GuiTabPageProfile ) )
new GuiControlProfile( GuiTabPageProfile : GuiDefaultProfile )
singleton GuiControlProfile( GuiTabPageProfile : GuiDefaultProfile )
{
fontType = "Arial";
fontSize = 10;
@ -430,8 +448,7 @@ new GuiControlProfile( GuiTabPageProfile : GuiDefaultProfile )
category = "Core";
};
if( !isObject( GuiConsoleProfile ) )
new GuiControlProfile( GuiConsoleProfile )
singleton GuiControlProfile( GuiConsoleProfile )
{
fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console";
fontSize = ($platform $= "macos") ? 13 : 12;
@ -445,8 +462,7 @@ new GuiControlProfile( GuiConsoleProfile )
category = "Core";
};
if( !isObject( GuiConsoleTextProfile ) )
new GuiControlProfile( GuiConsoleTextProfile )
singleton GuiControlProfile( GuiConsoleTextProfile )
{
fontColor = "0 0 0";
autoSizeWidth = true;
@ -462,8 +478,7 @@ new GuiControlProfile( GuiConsoleTextProfile )
$ConsoleDefaultFillColor = "0 0 0 175";
if( !isObject( ConsoleScrollProfile ) )
new GuiControlProfile( ConsoleScrollProfile : GuiScrollProfile )
singleton GuiControlProfile( ConsoleScrollProfile : GuiScrollProfile )
{
opaque = true;
fillColor = $ConsoleDefaultFillColor;
@ -473,8 +488,7 @@ new GuiControlProfile( ConsoleScrollProfile : GuiScrollProfile )
category = "Core";
};
if( !isObject( ConsoleTextEditProfile ) )
new GuiControlProfile( ConsoleTextEditProfile : GuiTextEditProfile )
singleton GuiControlProfile( ConsoleTextEditProfile : GuiTextEditProfile )
{
fillColor = "242 241 240 255";
fillColorHL = "255 255 255";
@ -485,8 +499,7 @@ new GuiControlProfile( ConsoleTextEditProfile : GuiTextEditProfile )
// Center and bottom print
//-----------------------------------------------------------------------------
if( !isObject( CenterPrintProfile ) )
new GuiControlProfile ( CenterPrintProfile )
singleton GuiControlProfile ( CenterPrintProfile )
{
opaque = false;
fillColor = "128 128 128";
@ -496,8 +509,7 @@ new GuiControlProfile ( CenterPrintProfile )
category = "Core";
};
if( !isObject( CenterPrintTextProfile ) )
new GuiControlProfile ( CenterPrintTextProfile )
singleton GuiControlProfile ( CenterPrintTextProfile )
{
opaque = false;
fontType = "Arial";
@ -509,9 +521,7 @@ new GuiControlProfile ( CenterPrintTextProfile )
// ----------------------------------------------------------------------------
// Radio button control
// ----------------------------------------------------------------------------
if( !isObject( GuiRadioProfile ) )
new GuiControlProfile( GuiRadioProfile )
singleton GuiControlProfile( GuiRadioProfile )
{
fontSize = 14;
fillColor = "232 232 232";
@ -526,31 +536,16 @@ new GuiControlProfile( GuiRadioProfile )
//
// Scroll Profile
//
if(!isObject(GuiMenuScrollProfile))
new GuiControlProfile(GuiMenuScrollProfile)
singleton GuiControlProfile(GuiMenuScrollProfile)
{
opaque = false;
fillcolor = "22 22 22";
fillcolor = "0 0 0 0";
fontColor = "200 200 200";
fontColorHL = "250 250 250";
border = false;
bitmapAsset = "UI:scrollBar_image";
hasBitmapArray = true;
category = "Core";
};
// Scroll
if(!isObject(GuiMenuScrollProfile))
new GuiControlProfile(GuiMenuScrollProfile)
{
opaque = true;
fillcolor = "128 128 128";
fontColor = "0 0 0";
fontColorHL = "150 150 150";
border = true;
bitmapAsset = "UI:scrollBar_image";
hasBitmapArray = true;
category = "Core";
category = "BaseUI";
};
singleton GuiControlProfile(SliderBitmapGUIProfile)
@ -561,9 +556,23 @@ singleton GuiControlProfile(SliderBitmapGUIProfile)
borderColor = "0 0 0 255";
};
singleton GuiControlProfile(GuiMenuBackgroundProfile)
{
category = "BaseUI";
opaque = true;
fillcolor = "34 34 34 255";
};
singleton GuiControlProfile(GuiMenuPanelProfile)
{
category = "BaseUI";
opaque = true;
fillcolor = "15 15 15 255";
};
singleton GuiControlProfile(GuiMenuBasePanelProfile)
{
category = "BaseUI";
opaque = true;
fillcolor = "40 40 40 255";
};

View file

@ -1,3 +1,25 @@
function ActionMap::getCommandButtonBitmap(%this, %device, %command)
{
%binding = %this.getBinding(%command);
if(%device $= "mouse" || %device $= "")
%device = "keyboard";
%bindingCount = getFieldCount(%binding);
for(%i=0; %i < %bindingCount; %i+=2)
{
%mapDevice = stripTrailingNumber(getField(%binding, %i));
if(%mapDevice $= %device)
{
%button = getField(%binding, %i+1);
break;
}
}
%assetId = getButtonBitmap(%device, %button);
return %assetId;
}
function getButtonBitmap(%device, %button)
{
if(%device $= "gamepad")