mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
* [x86UNIXFileio] BugFix: Correct an error in the initial call to recurseDumpDirectories that causes an empty list of directories to always be returned.
* [UI Module] BugFix: Change module directory name to uppercase for matching the declared module name in its module file for asset tree browsing to work correctly on case sensitive systems.
This commit is contained in:
parent
9dd9e9fae5
commit
3a4f0e8808
511 changed files with 13 additions and 13 deletions
330
Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript
Normal file
330
Templates/BaseGame/game/data/UI/scripts/controlsMenu.tscript
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
// =============================================================================
|
||||
// KEYBINDS MENU
|
||||
// =============================================================================
|
||||
function ControlsMenuDefaultsButton::onClick(%this)
|
||||
{
|
||||
//For this to work with module-style, we have to figure that somewhere, we'll set where our default keybind script is at.
|
||||
//This can be hardcoded in your actual project.
|
||||
//exec($KeybindPath);
|
||||
//ControlsMenu.reload();
|
||||
}
|
||||
|
||||
function getMapDisplayName( %device, %action )
|
||||
{
|
||||
if ( %device $= "keyboard" )
|
||||
return( %action );
|
||||
else if ( strstr( %device, "mouse" ) != -1 )
|
||||
{
|
||||
// Substitute "mouse" for "button" in the action string:
|
||||
%pos = strstr( %action, "button" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%mods = getSubStr( %action, 0, %pos );
|
||||
%object = getSubStr( %action, %pos, 1000 );
|
||||
%instance = getSubStr( %object, strlen( "button" ), 1000 );
|
||||
return( %mods @ "mouse" @ ( %instance + 1 ) );
|
||||
}
|
||||
else
|
||||
error( "Mouse input object other than button passed to getDisplayMapName!" );
|
||||
}
|
||||
else if ( strstr( %device, "joystick" ) != -1 )
|
||||
{
|
||||
// Substitute "joystick" for "button" in the action string:
|
||||
%pos = strstr( %action, "button" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%mods = getSubStr( %action, 0, %pos );
|
||||
%object = getSubStr( %action, %pos, 1000 );
|
||||
%instance = getSubStr( %object, strlen( "button" ), 1000 );
|
||||
return( %mods @ "joystick" @ ( %instance + 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = strstr( %action, "pov" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%wordCount = getWordCount( %action );
|
||||
%mods = %wordCount > 1 ? getWords( %action, 0, %wordCount - 2 ) @ " " : "";
|
||||
%object = getWord( %action, %wordCount - 1 );
|
||||
switch$ ( %object )
|
||||
{
|
||||
case "upov": %object = "POV1 up";
|
||||
case "dpov": %object = "POV1 down";
|
||||
case "lpov": %object = "POV1 left";
|
||||
case "rpov": %object = "POV1 right";
|
||||
case "upov2": %object = "POV2 up";
|
||||
case "dpov2": %object = "POV2 down";
|
||||
case "lpov2": %object = "POV2 left";
|
||||
case "rpov2": %object = "POV2 right";
|
||||
default: %object = "";
|
||||
}
|
||||
return( %mods @ %object );
|
||||
}
|
||||
else
|
||||
error( "Unsupported Joystick input object passed to getDisplayMapName!" );
|
||||
}
|
||||
}
|
||||
else if ( strstr( %device, "gamepad" ) != -1 )
|
||||
{
|
||||
return %action;
|
||||
|
||||
%pos = strstr( %action, "button" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
%mods = getSubStr( %action, 0, %pos );
|
||||
%object = getSubStr( %action, %pos, 1000 );
|
||||
%instance = getSubStr( %object, strlen( "button" ), 1000 );
|
||||
return( %mods @ "joystick" @ ( %instance + 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = strstr( %action, "thumb" );
|
||||
if ( %pos != -1 )
|
||||
{
|
||||
//%instance = getSubStr( %action, strlen( "thumb" ), 1000 );
|
||||
//return( "thumb" @ ( %instance + 1 ) );
|
||||
return %action;
|
||||
}
|
||||
else
|
||||
error( "Unsupported gamepad input object passed to getDisplayMapName!" );
|
||||
}
|
||||
}
|
||||
|
||||
return( "" );
|
||||
}
|
||||
|
||||
function buildFullMapString( %index, %actionMap, %deviceType )
|
||||
{
|
||||
%name = $RemapName[%index];
|
||||
%cmd = $RemapCmd[%index];
|
||||
|
||||
%temp = %actionMap.getBinding( %cmd );
|
||||
if ( %temp $= "" )
|
||||
return %name TAB "";
|
||||
|
||||
%mapString = "";
|
||||
|
||||
%count = getFieldCount( %temp );
|
||||
for ( %i = 0; %i < %count; %i += 2 )
|
||||
{
|
||||
if ( %mapString !$= "" )
|
||||
continue;
|
||||
//%mapString = %mapString @ ", ";
|
||||
|
||||
%device = getField( %temp, %i + 0 );
|
||||
%object = getField( %temp, %i + 1 );
|
||||
|
||||
if (startsWith(%device,"mouse"))
|
||||
%deviceType = "mouse";
|
||||
|
||||
if(%deviceType !$= "" && !startsWith(%device, %deviceType))
|
||||
continue;
|
||||
|
||||
%mapString = %mapString @ getMapDisplayName( %device, %object );
|
||||
}
|
||||
|
||||
return %name TAB %mapString;
|
||||
}
|
||||
|
||||
function fillRemapList()
|
||||
{
|
||||
%device = $remapListDevice;
|
||||
|
||||
OptionsMenuSettingsList.clearRows();
|
||||
|
||||
//build out our list of action maps
|
||||
%actionMapCount = ActionMapGroup.getCount();
|
||||
|
||||
%actionMapList = "";
|
||||
for(%i=0; %i < %actionMapCount; %i++)
|
||||
{
|
||||
%actionMap = ActionMapGroup.getObject(%i);
|
||||
|
||||
if(%actionMap == GlobalActionMap.getId())
|
||||
continue;
|
||||
|
||||
%actionMapName = %actionMap.humanReadableName $= "" ? %actionMap.getName() : %actionMap.humanReadableName;
|
||||
|
||||
if(%actionMapList $= "")
|
||||
%actionMapList = %actionMapName;
|
||||
else
|
||||
%actionMapList = %actionMapList TAB %actionMapName;
|
||||
}
|
||||
|
||||
//If we didn't find any valid actionMaps, then just exit out
|
||||
if(%actionMapList $= "")
|
||||
return;
|
||||
|
||||
if($activeRemapControlSet $= "")
|
||||
$activeRemapControlSet = getField(%actionMapList, 0);
|
||||
|
||||
OptionsMenuSettingsList.addOptionRow("Control Set", %actionMapList, false, "controlSetChanged", -1, -30, true, "Which keybind control set to edit", $activeRemapControlSet);
|
||||
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
{
|
||||
if(%device !$= "" && %device !$= $RemapDevice[%i])
|
||||
continue;
|
||||
|
||||
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
||||
|
||||
if($activeRemapControlSet !$= %actionMapName)
|
||||
continue;
|
||||
|
||||
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
||||
%description = $RemapDescription[%i];
|
||||
|
||||
OptionsMenuSettingsList.addKeybindRow(getField(%keyMap, 0), getButtonBitmap(%device, getField(%keyMap, 1)), "doKeyRemap", -1, -15, true, %description);
|
||||
}
|
||||
|
||||
OptionsMenuSettingsList.refresh();
|
||||
//OptionsMenu.addRow( %i, %this.buildFullMapString( %i ) );
|
||||
}
|
||||
|
||||
function controlSetChanged()
|
||||
{
|
||||
$activeRemapControlSet = OptionsMenuSettingsList.getCurrentOption(0);
|
||||
fillRemapList();
|
||||
}
|
||||
|
||||
function doKeyRemap( %rowIndex )
|
||||
{
|
||||
%rowIndex--; //Offset the rowIndex to account for controlset option
|
||||
%name = $RemapName[%rowIndex];
|
||||
|
||||
RemapDlg-->OptRemapText.setValue( "Re-bind \"" @ %name @ "\" to..." );
|
||||
OptRemapInputCtrl.index = %rowIndex;
|
||||
Canvas.pushDialog( RemapDlg );
|
||||
}
|
||||
|
||||
function ControlsMenuRebindButton::onClick(%this)
|
||||
{
|
||||
%name = $RemapName[%this.keybindIndex];
|
||||
RemapDlg-->OptRemapText.setValue( "Re-bind \"" @ %name @ "\" to..." );
|
||||
|
||||
OptRemapInputCtrl.index = %this.keybindIndex;
|
||||
OptRemapInputCtrl.optionIndex = %this.optionIndex;
|
||||
Canvas.pushDialog( RemapDlg );
|
||||
}
|
||||
|
||||
function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||
{
|
||||
//error( "** onInputEvent called - device = " @ %device @ ", action = " @ %action @ " **" );
|
||||
Canvas.popDialog( RemapDlg );
|
||||
|
||||
// Test for the reserved keystrokes:
|
||||
if ( %device $= "keyboard" )
|
||||
{
|
||||
// Cancel...
|
||||
if ( %action $= "escape" )
|
||||
{
|
||||
// Do nothing...
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%cmd = $RemapCmd[%this.index];
|
||||
%name = $RemapName[%this.index];
|
||||
%actionMap = $RemapActionMap[%this.index];
|
||||
|
||||
// Grab the friendly display name for this action
|
||||
// which we'll use when prompting the user below.
|
||||
%mapName = getMapDisplayName( %device, %action );
|
||||
|
||||
// Get the current command this action is mapped to.
|
||||
%prevMap = %actionMap.getCommand( %device, %action );
|
||||
|
||||
//TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times
|
||||
unbindExtraActions( %cmd, %actionMap, 0 );
|
||||
unbindExtraActions( %cmd, %actionMap, 1 );
|
||||
|
||||
// If nothing was mapped to the previous command
|
||||
// mapping then it's easy... just bind it.
|
||||
if ( %prevMap $= "" )
|
||||
{
|
||||
//unbindExtraActions( %cmd, %actionMap, 1 );
|
||||
%actionMap.bind( %device, %action, %cmd );
|
||||
|
||||
fillRemapList();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the previous command is the same as the
|
||||
// current then they hit the same input as what
|
||||
// was already assigned.
|
||||
if ( %prevMap $= %cmd )
|
||||
{
|
||||
//unbindExtraActions( %cmd, %actionMap, 0 );
|
||||
%actionMap.bind( %device, %action, %cmd );
|
||||
|
||||
fillRemapList();
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for the index of the previous mapping.
|
||||
%prevMapIndex = findRemapCmdIndex( %prevMap );
|
||||
|
||||
// If we get a negative index then the previous
|
||||
// mapping was to an item that isn't included in
|
||||
// the mapping list... so we cannot unmap it.
|
||||
if ( %prevMapIndex == -1 )
|
||||
{
|
||||
MessageBoxOK( "Remap Failed", "\"" @ %mapName @ "\" is already bound to a non-remappable command!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup the forced remapping callback command.
|
||||
%callback = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @
|
||||
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
|
||||
|
||||
// Warn that we're about to remove the old mapping and
|
||||
// replace it with another.
|
||||
%prevCmdName = $RemapName[%prevMapIndex];
|
||||
Canvas.pushDialog( RemapConfirmDlg );
|
||||
|
||||
RemapConfirmationText.setText("\"" @ %mapName @ "\" is already bound to \""
|
||||
@ %prevCmdName @ "\"! Do you wish to replace this mapping?");
|
||||
RemapConfirmationYesButton.command = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @
|
||||
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ "); Canvas.popDialog();";
|
||||
RemapConfirmationNoButton.command = "Canvas.popDialog();";
|
||||
|
||||
/*MessageBoxYesNo( "Warning",
|
||||
"\"" @ %mapName @ "\" is already bound to \""
|
||||
@ %prevCmdName @ "\"!\nDo you wish to replace this mapping?",
|
||||
%callback, "" );*/
|
||||
}
|
||||
|
||||
function findRemapCmdIndex( %command )
|
||||
{
|
||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||
{
|
||||
if ( %command $= $RemapCmd[%i] )
|
||||
return( %i );
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/// This unbinds actions beyond %count associated to the
|
||||
/// particular actionMap %commmand.
|
||||
function unbindExtraActions( %command, %actionMap, %count )
|
||||
{
|
||||
%temp = %actionMap.getBinding( %command );
|
||||
if ( %temp $= "" )
|
||||
return;
|
||||
|
||||
%count = getFieldCount( %temp ) - ( %count * 2 );
|
||||
for ( %i = 0; %i < %count; %i += 2 )
|
||||
{
|
||||
%device = getField( %temp, %i + 0 );
|
||||
%action = getField( %temp, %i + 1 );
|
||||
|
||||
%actionMap.unbind( %device, %action );
|
||||
}
|
||||
}
|
||||
|
||||
function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
|
||||
{
|
||||
//%actionMap.bind( %device, %action, $RemapCmd[%newIndex] );
|
||||
%actionMap.bind( %device, %action, %cmd );
|
||||
|
||||
fillRemapList();
|
||||
}
|
||||
40
Templates/BaseGame/game/data/UI/scripts/cursors.tscript
Normal file
40
Templates/BaseGame/game/data/UI/scripts/cursors.tscript
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
if($platform $= "macos")
|
||||
{
|
||||
new GuiCursor(DefaultCursor)
|
||||
{
|
||||
hotSpot = "4 4";
|
||||
renderOffset = "0 0";
|
||||
bitmapName = "data/ui/images/macCursor";
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
new GuiCursor(DefaultCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
renderOffset = "0 0";
|
||||
bitmapName = "data/ui/images/defaultCursor";
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
90
Templates/BaseGame/game/data/UI/scripts/help.tscript
Normal file
90
Templates/BaseGame/game/data/UI/scripts/help.tscript
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 );
|
||||
}
|
||||
|
||||
341
Templates/BaseGame/game/data/UI/scripts/menuInputButtons.tscript
Normal file
341
Templates/BaseGame/game/data/UI/scripts/menuInputButtons.tscript
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
//==============================================================================
|
||||
// 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
|
||||
*/
|
||||
|
||||
/// 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
|
||||
function UIMenuButtonList::onInputEvent(%this, %device, %action, %state)
|
||||
{
|
||||
if(%state)
|
||||
$activeMenuButtonContainer.processInputs(%device, %action);
|
||||
}
|
||||
|
||||
/// 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
|
||||
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);
|
||||
}
|
||||
|
||||
/// 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.
|
||||
/// \param %gamepadOnly (bool) If true, will only show the button when working in the gamepad input mode
|
||||
function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command, %gamepadOnly)
|
||||
{
|
||||
%set = (! ((%text $= "") && (%command $= "")));
|
||||
%this.setText(%text);
|
||||
%this.setActive(%set);
|
||||
%this.setVisible(%set);
|
||||
|
||||
%this.gamepadButton = %gamepadButton;
|
||||
%this.keyboardButton = %keyboardButton;
|
||||
|
||||
if(%gamepadOnly $= "")
|
||||
%gamepadOnly = false;
|
||||
|
||||
%this.gamepadOnly = %gamepadOnly;
|
||||
|
||||
%this.Command = %command;
|
||||
}
|
||||
|
||||
/// Refreshes the specific button, updating it's visbility status and the displayed input image
|
||||
function MenuInputButton::refresh(%this)
|
||||
{
|
||||
%set = (! ((%this.text $= "") && (%this.command $= "")));
|
||||
|
||||
//Special-case of where we're in keyboard+mouse mode, but the menubutton is gamepad only mode, so we early out
|
||||
if(%this.gamepadOnly && $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;
|
||||
}
|
||||
|
||||
/// 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();
|
||||
}
|
||||
}
|
||||
|
||||
/// 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();
|
||||
}
|
||||
|
||||
/// 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";
|
||||
}
|
||||
|
||||
/// 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.
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
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;
|
||||
}*/
|
||||
}
|
||||
331
Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript
Normal file
331
Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
Canvas.pushDialog(MessageBoxDlg);
|
||||
MessageBoxTitleText.text = %title;
|
||||
|
||||
MessageBoxOCButtonHolder.hidden = false;
|
||||
MessageBoxYNCButtonHolder.hidden = true;
|
||||
MessageBoxOKButtonHolder.hidden = true;
|
||||
|
||||
MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);");
|
||||
MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "Cancel", "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);
|
||||
}
|
||||
544
Templates/BaseGame/game/data/UI/scripts/profiles.tscript
Normal file
544
Templates/BaseGame/game/data/UI/scripts/profiles.tscript
Normal file
|
|
@ -0,0 +1,544 @@
|
|||
$TextMediumEmphasisColor = "200 200 200";
|
||||
$TextHighEmphasisColor = "224 224 224";
|
||||
$TextDisabledColor = "108 108 108";
|
||||
|
||||
new GuiGameListMenuProfile(DefaultListMenuProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 20;
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
fontColorSEL = $TextMediumEmphasisColor;
|
||||
fontColorNA = $TextDisabledColor;
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
|
||||
fillColor = "108 108 108";
|
||||
fillColorHL = "140 140 140";
|
||||
fillColorSEL = "180 180 180";
|
||||
|
||||
HitAreaUpperLeft = "16 20";
|
||||
HitAreaLowerRight = "503 74";
|
||||
IconOffset = "40 0";
|
||||
TextOffset = "100 0";
|
||||
RowSize = "500 90";
|
||||
ColumnSplit = "250";
|
||||
RightPad = "20";
|
||||
bitmap = "UI:listMenuArray_image";
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
new GuiControlProfile(GamepadDefaultProfile)
|
||||
{
|
||||
border = 0;
|
||||
};
|
||||
|
||||
new GuiControlProfile(GamepadButtonTextLeft)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 20;
|
||||
fontColor = "255 255 255";
|
||||
justify = "left";
|
||||
};
|
||||
|
||||
new GuiControlProfile(GamepadButtonTextRight : GamepadButtonTextLeft)
|
||||
{
|
||||
justify = "right";
|
||||
};
|
||||
|
||||
new GuiControlProfile(MenuHeaderText)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 30;
|
||||
fontColor = $TextHighEmphasisColor;
|
||||
justify = "left";
|
||||
};
|
||||
|
||||
new GuiControlProfile(MenuHeaderTextCenter)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 30;
|
||||
fontColor = $TextHighEmphasisColor;
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
new GuiControlProfile(MenuSubHeaderText)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 20;
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
justify = "left";
|
||||
};
|
||||
|
||||
new GuiControlProfile(MenuMLSubHeaderText)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 20;
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
justify = "left";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if( !isObject( GuiMenuButtonProfile ) )
|
||||
new GuiControlProfile( GuiMenuButtonProfile )
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
fontSize = 18;
|
||||
fontType = "Arial Bold";
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
fontColorNA = $TextDisabledColor;
|
||||
fontColorSEL = $TextMediumEmphasisColor;
|
||||
fillColor = "40 40 40";
|
||||
fillColorHL = "56 56 56";
|
||||
fillColorNA = "40 40 40";
|
||||
borderColor = "87 87 87";
|
||||
borderColorNA = "0 0 0";
|
||||
borderColorHL = "255 255 255";
|
||||
fixedExtent = false;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
//bitmapAsset = "UI:menu_button_image";
|
||||
hasBitmapArray = false;
|
||||
soundButtonDown = menuButtonPressed;
|
||||
soundButtonOver = menuButtonHover;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiHighlightMenuButtonProfile ) )
|
||||
new GuiControlProfile( GuiHighlightMenuButtonProfile )
|
||||
{
|
||||
opaque = true;
|
||||
border = false;
|
||||
fontSize = 18;
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "240 240 240";
|
||||
fontColorHL = "0 0 0";
|
||||
fontColorNA = "125 125 125";
|
||||
//fontColorSEL ="0 0 0";
|
||||
fixedExtent = false;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
bitmapAsset = "UI:selector_button_highlight_only_image";
|
||||
hasBitmapArray = false;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiBlankMenuButtonProfile ) )
|
||||
new GuiControlProfile( GuiBlankMenuButtonProfile )
|
||||
{
|
||||
opaque = true;
|
||||
border = false;
|
||||
fontSize = 18;
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "220 220 220";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "200 200 200";
|
||||
//fontColorSEL ="0 0 0";
|
||||
fixedExtent = false;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
bitmapAsset = "UI:selector_button_blank_image";
|
||||
hasBitmapArray = false;
|
||||
soundButtonDown = menuButtonPressed;
|
||||
soundButtonOver = menuButtonHover;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiMenuTextProfile ) )
|
||||
new GuiControlProfile( GuiMenuTextProfile )
|
||||
{
|
||||
opaque = true;
|
||||
border = false;
|
||||
fontSize = 18;
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "240 240 240";
|
||||
fontColorHL = "0 0 0";
|
||||
fontColorNA = "125 125 125";
|
||||
fixedExtent = false;
|
||||
justify = "center";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiSolidDefaultProfile ) )
|
||||
new GuiControlProfile (GuiSolidDefaultProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTransparentProfile ) )
|
||||
new GuiControlProfile (GuiTransparentProfile)
|
||||
{
|
||||
opaque = false;
|
||||
border = false;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiGroupBorderProfile ) )
|
||||
new GuiControlProfile( GuiGroupBorderProfile )
|
||||
{
|
||||
border = false;
|
||||
opaque = false;
|
||||
hasBitmapArray = true;
|
||||
bitmapAsset = "UI:group_border_image";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTabBorderProfile ) )
|
||||
new GuiControlProfile( GuiTabBorderProfile )
|
||||
{
|
||||
border = false;
|
||||
opaque = false;
|
||||
hasBitmapArray = true;
|
||||
bitmapAsset = "UI:tab_border_image";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiModelessDialogProfile ) )
|
||||
new GuiControlProfile( GuiModelessDialogProfile )
|
||||
{
|
||||
modal = false;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiFrameSetProfile ) )
|
||||
new GuiControlProfile (GuiFrameSetProfile)
|
||||
{
|
||||
fillcolor = "255 255 255";
|
||||
borderColor = "246 245 244";
|
||||
border = 1;
|
||||
opaque = true;
|
||||
border = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiInputCtrlProfile ) )
|
||||
new GuiControlProfile( GuiInputCtrlProfile )
|
||||
{
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTextProfile ) )
|
||||
new GuiControlProfile (GuiTextProfile)
|
||||
{
|
||||
justify = "left";
|
||||
fontColor = "20 20 20";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTextRightProfile ) )
|
||||
new GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
|
||||
{
|
||||
justify = "right";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiAutoSizeTextProfile ) )
|
||||
new GuiControlProfile (GuiAutoSizeTextProfile)
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiMediumTextProfile ) )
|
||||
new GuiControlProfile( GuiMediumTextProfile : GuiTextProfile )
|
||||
{
|
||||
fontSize = 24;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiBigTextProfile ) )
|
||||
new GuiControlProfile( GuiBigTextProfile : GuiTextProfile )
|
||||
{
|
||||
fontSize = 36;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiMLTextProfile ) )
|
||||
new GuiControlProfile( GuiMLTextProfile )
|
||||
{
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
fontColorSEL = $TextMediumEmphasisColor;
|
||||
fontColorNA = $TextDisabledColor;
|
||||
|
||||
fontColorLink = "100 100 100";
|
||||
fontColorLinkHL = $TextMediumEmphasisColor;
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
border = false;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiMLWhiteTextProfile ) )
|
||||
new GuiControlProfile( GuiMLWhiteTextProfile )
|
||||
{
|
||||
fontColor = "220 220 220";
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
border = false;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTextArrayProfile ) )
|
||||
new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile )
|
||||
{
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
fontColorSEL = $TextMediumEmphasisColor;
|
||||
fontColorNA = $TextDisabledColor;
|
||||
|
||||
fillColor = "22 22 22 255";
|
||||
fillColorHL = "22 22 22 255";
|
||||
fillColorSEL = "56 56 56 255";
|
||||
|
||||
border = true;
|
||||
borderColor ="87 87 87";
|
||||
borderColorHL = "87 87 87";
|
||||
borderColorSEL = "255 255 255";
|
||||
|
||||
category = "Core";
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if( !isObject( GuiMenuTextEditProfile ) )
|
||||
new GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile )
|
||||
{
|
||||
fontColor = $TextMediumEmphasisColor;
|
||||
fontColorHL = $TextMediumEmphasisColor;
|
||||
fontColorSEL = $TextMediumEmphasisColor;
|
||||
fontColorNA = $TextDisabledColor;
|
||||
|
||||
fillColor = "22 22 22 255";
|
||||
fillColorHL = "22 22 22 255";
|
||||
|
||||
border = true;
|
||||
borderColor ="87 87 87";
|
||||
borderColorHL = "87 87 87";
|
||||
borderColorSEL = "255 255 255";
|
||||
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// TODO: Revisit Popupmenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
if( !isObject( GuiPopupMenuItemBorder ) )
|
||||
new GuiControlProfile( GuiPopupMenuItemBorder : GuiButtonProfile )
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "0 0 0";
|
||||
fontColorNA = "255 255 255";
|
||||
fixedExtent = false;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
bitmap = "data/ui/images/button";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiPopUpMenuDefault ) )
|
||||
new GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile )
|
||||
{
|
||||
opaque = true;
|
||||
mouseOverSelected = true;
|
||||
textOffset = "3 3";
|
||||
border = 0;
|
||||
borderThickness = 0;
|
||||
fixedExtent = true;
|
||||
bitmapAsset = "UI:scrollBar_image";
|
||||
hasBitmapArray = true;
|
||||
profileForChildren = GuiPopupMenuItemBorder;
|
||||
fillColor = "242 241 240 ";//"255 255 255";//100
|
||||
fillColorHL = "228 228 235 ";//"204 203 202";
|
||||
fillColorSEL = "98 100 137 ";//"204 203 202";
|
||||
// font color is black
|
||||
fontColorHL = "0 0 0 ";//"0 0 0";
|
||||
fontColorSEL = "255 255 255";//"0 0 0";
|
||||
borderColor = "100 100 100";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiPopUpMenuProfile ) )
|
||||
new GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault )
|
||||
{
|
||||
textOffset = "6 4";
|
||||
bitmapAsset = "UI:dropDown_image";
|
||||
hasBitmapArray = true;
|
||||
border = 1;
|
||||
profileForChildren = GuiPopUpMenuDefault;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTabBookProfile ) )
|
||||
new GuiControlProfile( GuiTabBookProfile )
|
||||
{
|
||||
fillColorHL = "100 100 100";
|
||||
fillColorNA = "150 150 150";
|
||||
fontColor = "30 30 30";
|
||||
fontColorHL = "0 0 0";
|
||||
fontColorNA = "50 50 50";
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
justify = "center";
|
||||
bitmapAsset = "UI:tab_image";
|
||||
tabWidth = 64;
|
||||
tabHeight = 24;
|
||||
tabPosition = "Top";
|
||||
tabRotation = "Horizontal";
|
||||
textOffset = "0 -3";
|
||||
tab = true;
|
||||
cankeyfocus = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiTabPageProfile ) )
|
||||
new GuiControlProfile( GuiTabPageProfile : GuiDefaultProfile )
|
||||
{
|
||||
fontType = "Arial";
|
||||
fontSize = 10;
|
||||
justify = "center";
|
||||
bitmapAsset = "UI:tab_image";
|
||||
opaque = false;
|
||||
fillColor = "240 239 238";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiConsoleProfile ) )
|
||||
new GuiControlProfile( GuiConsoleProfile )
|
||||
{
|
||||
fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console";
|
||||
fontSize = ($platform $= "macos") ? 13 : 12;
|
||||
fontColor = "255 255 255";
|
||||
fontColorHL = "0 255 255";
|
||||
fontColorNA = "255 0 0";
|
||||
fontColors[6] = "100 100 100";
|
||||
fontColors[7] = "100 100 0";
|
||||
fontColors[8] = "0 0 100";
|
||||
fontColors[9] = "0 100 0";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( GuiConsoleTextProfile ) )
|
||||
new GuiControlProfile( GuiConsoleTextProfile )
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
textOffset = "2 2";
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
border = true;
|
||||
borderThickness = 1;
|
||||
borderColor = "0 0 0";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
$ConsoleDefaultFillColor = "0 0 0 175";
|
||||
|
||||
if( !isObject( ConsoleScrollProfile ) )
|
||||
new GuiControlProfile( ConsoleScrollProfile : GuiScrollProfile )
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = $ConsoleDefaultFillColor;
|
||||
border = 1;
|
||||
//borderThickness = 0;
|
||||
borderColor = "0 0 0";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( ConsoleTextEditProfile ) )
|
||||
new GuiControlProfile( ConsoleTextEditProfile : GuiTextEditProfile )
|
||||
{
|
||||
fillColor = "242 241 240 255";
|
||||
fillColorHL = "255 255 255";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Center and bottom print
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
if( !isObject( CenterPrintProfile ) )
|
||||
new GuiControlProfile ( CenterPrintProfile )
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "128 128 128";
|
||||
fontColor = "0 255 0";
|
||||
border = true;
|
||||
borderColor = "0 255 0";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
if( !isObject( CenterPrintTextProfile ) )
|
||||
new GuiControlProfile ( CenterPrintTextProfile )
|
||||
{
|
||||
opaque = false;
|
||||
fontType = "Arial";
|
||||
fontSize = 12;
|
||||
fontColor = "0 255 0";
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Radio button control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
if( !isObject( GuiRadioProfile ) )
|
||||
new GuiControlProfile( GuiRadioProfile )
|
||||
{
|
||||
fontSize = 14;
|
||||
fillColor = "232 232 232";
|
||||
fontColor = "20 20 20";
|
||||
fontColorHL = "80 80 80";
|
||||
fixedExtent = true;
|
||||
bitmapAsset = "UI:radioButton_image";
|
||||
hasBitmapArray = true;
|
||||
category = "Core";
|
||||
};
|
||||
|
||||
//
|
||||
// Scroll Profile
|
||||
//
|
||||
if(!isObject(GuiMenuScrollProfile))
|
||||
new GuiControlProfile(GuiMenuScrollProfile)
|
||||
{
|
||||
opaque = false;
|
||||
fillcolor = "22 22 22";
|
||||
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";
|
||||
};
|
||||
|
||||
singleton GuiControlProfile(SliderBitmapGUIProfile)
|
||||
{
|
||||
bitmapAsset = "UI:optionsMenuSliderBitmapArray_image";
|
||||
hasBitmapArray = true;
|
||||
opaque = false;
|
||||
};
|
||||
126
Templates/BaseGame/game/data/UI/scripts/utility.tscript
Normal file
126
Templates/BaseGame/game/data/UI/scripts/utility.tscript
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
function getButtonBitmap(%device, %button)
|
||||
{
|
||||
if(%device $= "gamepad")
|
||||
{
|
||||
//In the event we passed in a generic gamepad device name, we'll try fetching the actual device here
|
||||
%device = SDLInputManager::JoystickNameForIndex(0);
|
||||
|
||||
//If we couldn't figure out what it was, just use the generic Xbox images
|
||||
if(%device $= "")
|
||||
%device = "Xbox";
|
||||
}
|
||||
|
||||
%path = "";
|
||||
if(%device $= "PS4")
|
||||
{
|
||||
%path = "data/ui/images/inputs/PS4/PS4_";
|
||||
|
||||
if(%button $= "A" || %button $= "btn_a")
|
||||
%path = %path @ "Cross";
|
||||
else if(%button $= "B" || %button $= "btn_b")
|
||||
%path = %path @ "Circle";
|
||||
else if(%button $= "X" || %button $= "btn_x")
|
||||
%path = %path @ "Square";
|
||||
else if(%button $= "Y" || %button $= "btn_y")
|
||||
%path = %path @ "Triangle";
|
||||
else if(%button $= "LB")
|
||||
%path = %path @ "L1";
|
||||
else if(%button $= "LT")
|
||||
%path = %path @ "L2";
|
||||
else if(%button $= "RB")
|
||||
%path = %path @ "R1";
|
||||
else if(%button $= "RT")
|
||||
%path = %path @ "R2";
|
||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||
%path = %path @ "Right_Stick";
|
||||
else if(%button $= "thumblx" || %button $= "thumbly")
|
||||
%path = %path @ "Left_Stick";
|
||||
else if(%button $= "start")
|
||||
%path = %path @ "Options";
|
||||
else if(%button $= "back")
|
||||
%path = %path @ "Share";
|
||||
else if(%button $= "dpadu")
|
||||
%path = %path @ "Dpad_Up";
|
||||
else if(%button $= "dpadd")
|
||||
%path = %path @ "Dpad_Down";
|
||||
else if(%button $= "dpadl")
|
||||
%path = %path @ "Dpad_Left";
|
||||
else if(%button $= "dpadr")
|
||||
%path = %path @ "Dpad_Right";
|
||||
}
|
||||
else if(%device $= "Switch")
|
||||
{
|
||||
%path = "data/ui/images/inputs/Switch/Switch_";
|
||||
|
||||
if(%button $= "A" || %button $= "btn_a")
|
||||
%path = %path @ "B";
|
||||
else if(%button $= "B" || %button $= "btn_b")
|
||||
%path = %path @ "A";
|
||||
else if(%button $= "X" || %button $= "btn_x")
|
||||
%path = %path @ "Y";
|
||||
else if(%button $= "Y" || %button $= "btn_y")
|
||||
%path = %path @ "X";
|
||||
else if(%button $= "LB")
|
||||
%path = %path @ "LB";
|
||||
else if(%button $= "LT")
|
||||
%path = %path @ "LT";
|
||||
else if(%button $= "RB")
|
||||
%path = %path @ "RB";
|
||||
else if(%button $= "RT")
|
||||
%path = %path @ "RT";
|
||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||
%path = %path @ "Right_Stick";
|
||||
else if(%button $= "thumblx" || %button $= "thumbly")
|
||||
%path = %path @ "Left_Stick";
|
||||
else if(%button $= "start")
|
||||
%path = %path @ "Plus";
|
||||
else if(%button $= "back")
|
||||
%path = %path @ "Minus";
|
||||
else if(%button $= "dpadu")
|
||||
%path = %path @ "Dpad_Up";
|
||||
else if(%button $= "dpadd")
|
||||
%path = %path @ "Dpad_Down";
|
||||
else if(%button $= "dpadl")
|
||||
%path = %path @ "Dpad_Left";
|
||||
else if(%button $= "dpadr")
|
||||
%path = %path @ "Dpad_Right";
|
||||
}
|
||||
else if(%device $= "Keyboard" || %device $= "Mouse")
|
||||
{
|
||||
%pathBase = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_";
|
||||
%path = %pathBase @ %button @ ".png";
|
||||
if(!isFile(%path))
|
||||
%path = %pathBase @ "Blank";
|
||||
}
|
||||
else if(%device !$= "")
|
||||
{
|
||||
%path = "data/ui/images/inputs/Xbox/Xbox_";
|
||||
|
||||
if(%button $= "btn_a")
|
||||
%path = %path @ "B";
|
||||
else if(%button $= "btn_b")
|
||||
%path = %path @ "A";
|
||||
else if(%button $= "btn_x")
|
||||
%path = %path @ "Y";
|
||||
else if(%button $= "btn_y")
|
||||
%path = %path @ "X";
|
||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||
%path = %path @ "Right_Stick";
|
||||
else if(%button $= "thumblx" || %button $= "thumbly")
|
||||
%path = %path @ "Left_Stick";
|
||||
else if(%button $= "start")
|
||||
%path = %path @ "Menu";
|
||||
else if(%button $= "back")
|
||||
%path = %path @ "Windows";
|
||||
else if(%button $= "dpadu")
|
||||
%path = %path @ "Dpad_Up";
|
||||
else if(%button $= "dpadd")
|
||||
%path = %path @ "Dpad_Down";
|
||||
else if(%button $= "dpadl")
|
||||
%path = %path @ "Dpad_Left";
|
||||
else if(%button $= "dpadr")
|
||||
%path = %path @ "Dpad_Right";
|
||||
}
|
||||
|
||||
return %path;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue