mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #1172 from Areloch/BaseUIUpdate_Wipwork
BaseUI Update
This commit is contained in:
commit
cf7e9f7a00
79 changed files with 5091 additions and 6538 deletions
|
|
@ -478,7 +478,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
|
||||||
setProtocolVersion(currentProtocol < CurrentProtocolVersion ? currentProtocol : CurrentProtocolVersion);
|
setProtocolVersion(currentProtocol < CurrentProtocolVersion ? currentProtocol : CurrentProtocolVersion);
|
||||||
|
|
||||||
const char *serverPassword = Con::getVariable("pref::Server::Password");
|
const char *serverPassword = Con::getVariable("pref::Server::Password");
|
||||||
if(serverPassword[0])
|
if(serverPassword[0] && !isLocalConnection())
|
||||||
{
|
{
|
||||||
if(String::compare(joinPassword, serverPassword))
|
if(String::compare(joinPassword, serverPassword))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition
|
||||||
dSprintf(extensionBuffer, sizeof(extensionBuffer), "*.%s", pDeclaredAssets->getExtension());
|
dSprintf(extensionBuffer, sizeof(extensionBuffer), "*.%s", pDeclaredAssets->getExtension());
|
||||||
|
|
||||||
// Scan declared assets at location.
|
// Scan declared assets at location.
|
||||||
if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) )
|
if ( !scanDeclaredAssets( filePathBuffer, extensionBuffer, pDeclaredAssets->getRecurse(), pModuleDefinition ) && mEchoInfo)
|
||||||
{
|
{
|
||||||
// Warn.
|
// Warn.
|
||||||
Con::warnf( "AssetManager::addModuleDeclaredAssets() - No assets found at location '%s' with extension '%s'.", filePathBuffer, pDeclaredAssets->getExtension() );
|
Con::warnf( "AssetManager::addModuleDeclaredAssets() - No assets found at location '%s' with extension '%s'.", filePathBuffer, pDeclaredAssets->getExtension() );
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,16 @@ IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseDragged, void, (), (),
|
||||||
"pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with "
|
"pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with "
|
||||||
"the mouse button still pressed.");
|
"the mouse button still pressed.");
|
||||||
|
|
||||||
|
IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onHighlighted, void, (bool highlighted), (highlighted),
|
||||||
|
"This is called when the highlighted state of the button is changed.");
|
||||||
|
|
||||||
|
|
||||||
ImplementEnumType(GuiButtonType,
|
ImplementEnumType(GuiButtonType,
|
||||||
"Type of button control.\n\n"
|
"Type of button control.\n\n"
|
||||||
"@ingroup GuiButtons")
|
"@ingroup GuiButtons")
|
||||||
{ GuiButtonBaseCtrl::ButtonTypePush, "PushButton", "A button that triggers an action when clicked." },
|
{
|
||||||
|
GuiButtonBaseCtrl::ButtonTypePush, "PushButton", "A button that triggers an action when clicked."
|
||||||
|
},
|
||||||
{ GuiButtonBaseCtrl::ButtonTypeCheck, "ToggleButton", "A button that is toggled between on and off state." },
|
{ GuiButtonBaseCtrl::ButtonTypeCheck, "ToggleButton", "A button that is toggled between on and off state." },
|
||||||
{ GuiButtonBaseCtrl::ButtonTypeRadio, "RadioButton", "A button placed in groups for presenting choices." },
|
{ GuiButtonBaseCtrl::ButtonTypeRadio, "RadioButton", "A button placed in groups for presenting choices." },
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
@ -290,6 +295,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
|
||||||
{
|
{
|
||||||
mDepressed = true;
|
mDepressed = true;
|
||||||
mHighlighted = true;
|
mHighlighted = true;
|
||||||
|
onHighlighted_callback(mHighlighted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -297,6 +303,8 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
|
||||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||||
|
|
||||||
mHighlighted = true;
|
mHighlighted = true;
|
||||||
|
messageSiblings(mRadioGroup);
|
||||||
|
onHighlighted_callback(mHighlighted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,6 +319,8 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)
|
||||||
if (isMouseLocked())
|
if (isMouseLocked())
|
||||||
mDepressed = false;
|
mDepressed = false;
|
||||||
mHighlighted = false;
|
mHighlighted = false;
|
||||||
|
onHighlighted_callback(mHighlighted);
|
||||||
|
messageSiblings(mRadioGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -459,7 +469,9 @@ void GuiButtonBaseCtrl::onAction()
|
||||||
void GuiButtonBaseCtrl::onMessage(GuiControl* sender, S32 msg)
|
void GuiButtonBaseCtrl::onMessage(GuiControl* sender, S32 msg)
|
||||||
{
|
{
|
||||||
Parent::onMessage(sender, msg);
|
Parent::onMessage(sender, msg);
|
||||||
if( mRadioGroup == msg && mButtonType == ButtonTypeRadio )
|
if (mRadioGroup == msg)
|
||||||
|
{
|
||||||
|
if (mButtonType == ButtonTypeRadio)
|
||||||
{
|
{
|
||||||
setUpdate();
|
setUpdate();
|
||||||
mStateOn = (sender == this);
|
mStateOn = (sender == this);
|
||||||
|
|
@ -468,6 +480,23 @@ void GuiButtonBaseCtrl::onMessage( GuiControl *sender, S32 msg )
|
||||||
if (mConsoleVariable[0])
|
if (mConsoleVariable[0])
|
||||||
Con::setBoolVariable(mConsoleVariable, mStateOn);
|
Con::setBoolVariable(mConsoleVariable, mStateOn);
|
||||||
}
|
}
|
||||||
|
else if (mButtonType == ButtonTypePush)
|
||||||
|
{
|
||||||
|
mHighlighted = (sender == this);
|
||||||
|
onHighlighted_callback(mHighlighted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiButtonBaseCtrl::setHighlighted(bool highlighted)
|
||||||
|
{
|
||||||
|
mHighlighted = highlighted;
|
||||||
|
onHighlighted_callback(mHighlighted);
|
||||||
|
|
||||||
|
if (mRadioGroup != -1)
|
||||||
|
{
|
||||||
|
messageSiblings(mRadioGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ class GuiButtonBaseCtrl : public GuiControl
|
||||||
DECLARE_CALLBACK(void, onMouseEnter, ());
|
DECLARE_CALLBACK(void, onMouseEnter, ());
|
||||||
DECLARE_CALLBACK(void, onMouseLeave, ());
|
DECLARE_CALLBACK(void, onMouseLeave, ());
|
||||||
DECLARE_CALLBACK(void, onMouseDragged, ());
|
DECLARE_CALLBACK(void, onMouseDragged, ());
|
||||||
|
DECLARE_CALLBACK(void, onHighlighted, (bool));
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -97,7 +98,7 @@ class GuiButtonBaseCtrl : public GuiControl
|
||||||
void setDepressed(bool depressed) { mDepressed = depressed; }
|
void setDepressed(bool depressed) { mDepressed = depressed; }
|
||||||
void resetState() { mDepressed = false; mHighlighted = false; }
|
void resetState() { mDepressed = false; mHighlighted = false; }
|
||||||
|
|
||||||
void setHighlighted(bool highlighted) { mHighlighted = highlighted; }
|
void setHighlighted(bool highlighted);
|
||||||
bool isHighlighted() { return mHighlighted; }
|
bool isHighlighted() { return mHighlighted; }
|
||||||
|
|
||||||
void acceleratorKeyPress(U32 index);
|
void acceleratorKeyPress(U32 index);
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
if (mProfile->mBorder != 0)
|
if (mProfile->mBorder != 0)
|
||||||
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
|
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
|
||||||
else
|
else
|
||||||
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
|
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mHighlighted && mActive)
|
else if(mHighlighted && mActive)
|
||||||
|
|
@ -269,7 +269,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
if (mProfile->mBorder != 0)
|
if (mProfile->mBorder != 0)
|
||||||
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
|
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
|
||||||
else
|
else
|
||||||
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
|
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -388,6 +388,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
|
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawer->setBitmapModulation(fontColor);
|
||||||
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -395,6 +396,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
{
|
{
|
||||||
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||||
|
|
||||||
|
drawer->setBitmapModulation(fontColor);
|
||||||
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -408,6 +410,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
start.set( ( getWidth() - textWidth ) / 2, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
start.set( ( getWidth() - textWidth ) / 2, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
|
||||||
|
|
||||||
drawer->setBitmapModulation( fontColor );
|
drawer->setBitmapModulation( fontColor );
|
||||||
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,8 @@ GuiControl::GuiControl() : mAddGroup( NULL ),
|
||||||
mLangTable(NULL),
|
mLangTable(NULL),
|
||||||
mFirstResponder(NULL),
|
mFirstResponder(NULL),
|
||||||
mHorizSizing(horizResizeRight),
|
mHorizSizing(horizResizeRight),
|
||||||
mVertSizing(vertResizeBottom)
|
mVertSizing(vertResizeBottom),
|
||||||
|
mCategory(StringTable->EmptyString())
|
||||||
{
|
{
|
||||||
mConsoleVariable = StringTable->EmptyString();
|
mConsoleVariable = StringTable->EmptyString();
|
||||||
mAcceleratorKey = StringTable->EmptyString();
|
mAcceleratorKey = StringTable->EmptyString();
|
||||||
|
|
@ -294,6 +295,10 @@ void GuiControl::initPersistFields()
|
||||||
addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl),
|
addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl),
|
||||||
"Key combination that triggers the control's primary action when the control is on the canvas." );
|
"Key combination that triggers the control's primary action when the control is on the canvas." );
|
||||||
|
|
||||||
|
addField("category", TypeString, Offset(mCategory, GuiControl),
|
||||||
|
"Name of the category this gui control should be grouped into for organizational purposes. Primarily for tooling.");
|
||||||
|
|
||||||
|
|
||||||
endGroup( "Control" );
|
endGroup( "Control" );
|
||||||
|
|
||||||
addGroup( "ToolTip" );
|
addGroup( "ToolTip" );
|
||||||
|
|
@ -2942,3 +2947,19 @@ DefineEngineMethod( GuiControl, getAspect, F32, (),,
|
||||||
const Point2I &ext = object->getExtent();
|
const Point2I &ext = object->getExtent();
|
||||||
return (F32)ext.x / (F32)ext.y;
|
return (F32)ext.x / (F32)ext.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiControl, execCommand, const char*, (), ,
|
||||||
|
"Forcefully executes the command field value(if any) on this guiControl.\n"
|
||||||
|
"@return The results of the evaluation of the command.")
|
||||||
|
{
|
||||||
|
return object->execConsoleCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiControl, execAltCommand, const char*, (), ,
|
||||||
|
"Forcefully executes the altCommand field value(if any) on this guiControl.\n"
|
||||||
|
"@return The results of the evaluation of the altCommand.")
|
||||||
|
{
|
||||||
|
return object->execAltConsoleCallback();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,8 @@ class GuiControl : public SimGroup
|
||||||
|
|
||||||
String mTooltip;
|
String mTooltip;
|
||||||
|
|
||||||
|
StringTableEntry mCategory;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Console
|
/// @name Console
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
#include "gui/editor/editorFunctions.h"
|
#include "gui/editor/editorFunctions.h"
|
||||||
#include "math/mEase.h"
|
#include "math/mEase.h"
|
||||||
#include "math/mathTypes.h"
|
#include "math/mathTypes.h"
|
||||||
|
#include "sim/actionMap.h"
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -60,7 +61,7 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl()
|
||||||
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
|
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
|
||||||
|
|
||||||
// Let's make it look pretty.
|
// Let's make it look pretty.
|
||||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" );
|
retCtrl->setDataField( StringTable->insert("profile"), NULL, "ToolsGuiPopupMenuProfile" );
|
||||||
_registerEditControl( retCtrl );
|
_registerEditControl( retCtrl );
|
||||||
|
|
||||||
// Configure it to update our value when the popup is closed
|
// Configure it to update our value when the popup is closed
|
||||||
|
|
@ -387,6 +388,44 @@ void GuiInspectorTypeGuiProfile::consoleInit()
|
||||||
ConsoleBaseType::getType( TYPEID< GuiControlProfile >() )->setInspectorFieldType("GuiInspectorTypeGuiProfile");
|
ConsoleBaseType::getType( TYPEID< GuiControlProfile >() )->setInspectorFieldType("GuiInspectorTypeGuiProfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// GuiInspectorTypeActionMap
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
IMPLEMENT_CONOBJECT(GuiInspectorTypeActionMap);
|
||||||
|
|
||||||
|
ConsoleDocClass(GuiInspectorTypeActionMap,
|
||||||
|
"@brief Inspector field type for ActionMap\n\n"
|
||||||
|
"Editor use only.\n\n"
|
||||||
|
"@internal"
|
||||||
|
);
|
||||||
|
|
||||||
|
void GuiInspectorTypeActionMap::_populateMenu(GuiPopUpMenuCtrl* menu)
|
||||||
|
{
|
||||||
|
// Add the action maps to the menu.
|
||||||
|
//First add a blank entry so you can clear the action map
|
||||||
|
menu->addEntry("", 0);
|
||||||
|
|
||||||
|
SimGroup* grp = Sim::getRootGroup();
|
||||||
|
SimSetIterator iter(grp);
|
||||||
|
for (; *iter; ++iter)
|
||||||
|
{
|
||||||
|
ActionMap* actionMap = dynamic_cast<ActionMap*>(*iter);
|
||||||
|
if (!actionMap)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
menu->addEntry(actionMap->getName(), actionMap->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiInspectorTypeActionMap::consoleInit()
|
||||||
|
{
|
||||||
|
Parent::consoleInit();
|
||||||
|
|
||||||
|
ConsoleBaseType::getType(TYPEID< ActionMap >())->setInspectorFieldType("GuiInspectorTypeActionMap");
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// GuiInspectorTypeCheckBox
|
// GuiInspectorTypeCheckBox
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,20 @@ public:
|
||||||
virtual void _populateMenu( GuiPopUpMenuCtrl *menu );
|
virtual void _populateMenu( GuiPopUpMenuCtrl *menu );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// GuiInspectorTypeActionMap Class
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class GuiInspectorTypeActionMap : public GuiInspectorTypeMenuBase
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
typedef GuiInspectorTypeMenuBase Parent;
|
||||||
|
public:
|
||||||
|
DECLARE_CONOBJECT(GuiInspectorTypeActionMap);
|
||||||
|
static void consoleInit();
|
||||||
|
|
||||||
|
virtual void _populateMenu(GuiPopUpMenuCtrl* menu);
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// GuiInspectorTypeCheckBox Class
|
// GuiInspectorTypeCheckBox Class
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ GuiInputCtrl::GuiInputCtrl()
|
||||||
mSendModifierEvents(false),
|
mSendModifierEvents(false),
|
||||||
mIgnoreMouseEvents(false)
|
mIgnoreMouseEvents(false)
|
||||||
{
|
{
|
||||||
|
mActionmap = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -80,6 +81,7 @@ void GuiInputCtrl::initPersistFields()
|
||||||
"If true, Make events will be sent for modifier keys (Default false).");
|
"If true, Make events will be sent for modifier keys (Default false).");
|
||||||
addField("ignoreMouseEvents", TypeBool, Offset(mIgnoreMouseEvents, GuiInputCtrl),
|
addField("ignoreMouseEvents", TypeBool, Offset(mIgnoreMouseEvents, GuiInputCtrl),
|
||||||
"If true, any events from mouse devices will be passed through.");
|
"If true, any events from mouse devices will be passed through.");
|
||||||
|
addField("actionMap", TYPEID<ActionMap>(), Offset(mActionmap, GuiInputCtrl), "The name of an action map to push/pop on the input stack alongside the wake/sleep of this control.");
|
||||||
endGroup("GuiInputCtrl");
|
endGroup("GuiInputCtrl");
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
@ -104,6 +106,12 @@ bool GuiInputCtrl::onWake()
|
||||||
if( !smDesignTime && !mIgnoreMouseEvents)
|
if( !smDesignTime && !mIgnoreMouseEvents)
|
||||||
mouseLock();
|
mouseLock();
|
||||||
|
|
||||||
|
if(mActionmap != nullptr)
|
||||||
|
{
|
||||||
|
SimSet* actionMapSet = Sim::getActiveActionMapSet();
|
||||||
|
actionMapSet->pushObject(mActionmap);
|
||||||
|
}
|
||||||
|
|
||||||
setFirstResponder();
|
setFirstResponder();
|
||||||
|
|
||||||
return( true );
|
return( true );
|
||||||
|
|
@ -115,6 +123,13 @@ void GuiInputCtrl::onSleep()
|
||||||
{
|
{
|
||||||
Parent::onSleep();
|
Parent::onSleep();
|
||||||
mouseUnlock();
|
mouseUnlock();
|
||||||
|
|
||||||
|
if (mActionmap != nullptr)
|
||||||
|
{
|
||||||
|
SimSet* actionMapSet = Sim::getActiveActionMapSet();
|
||||||
|
actionMapSet->removeObject(mActionmap);
|
||||||
|
}
|
||||||
|
|
||||||
clearFirstResponder();
|
clearFirstResponder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,6 +173,9 @@ bool GuiInputCtrl::onInputEvent( const InputEventInfo &event )
|
||||||
if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType)
|
if (mIgnoreMouseEvents && event.deviceType == MouseDeviceType)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (mActionmap != nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
char deviceString[32];
|
char deviceString[32];
|
||||||
if ( event.action == SI_MAKE )
|
if ( event.action == SI_MAKE )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#ifndef _GUIMOUSEEVENTCTRL_H_
|
#ifndef _GUIMOUSEEVENTCTRL_H_
|
||||||
#include "gui/utility/guiMouseEventCtrl.h"
|
#include "gui/utility/guiMouseEventCtrl.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "sim/actionMap.h"
|
||||||
|
|
||||||
|
|
||||||
/// A control that locks the mouse and reports all keyboard input events
|
/// A control that locks the mouse and reports all keyboard input events
|
||||||
|
|
@ -38,6 +39,8 @@ protected:
|
||||||
bool mSendModifierEvents;
|
bool mSendModifierEvents;
|
||||||
bool mIgnoreMouseEvents;
|
bool mIgnoreMouseEvents;
|
||||||
|
|
||||||
|
ActionMap* mActionmap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef GuiMouseEventCtrl Parent;
|
typedef GuiMouseEventCtrl Parent;
|
||||||
|
|
|
||||||
|
|
@ -729,7 +729,8 @@ bool ActionMap::nextBoundNode( const char* function, U32 &devMapIndex, U32 &node
|
||||||
for ( U32 j = nodeIndex; j < dvcMap->nodeMap.size(); j++ )
|
for ( U32 j = nodeIndex; j < dvcMap->nodeMap.size(); j++ )
|
||||||
{
|
{
|
||||||
const Node* node = &dvcMap->nodeMap[j];
|
const Node* node = &dvcMap->nodeMap[j];
|
||||||
if ( !( node->flags & Node::BindCmd ) && ( dStricmp( function, node->consoleFunction ) == 0 ) )
|
if ( ( (node->flags & Node::BindCmd) && (dStricmp(function, node->makeConsoleCommand) == 0 || dStricmp(function, node->breakConsoleCommand) == 0) )
|
||||||
|
|| (!(node->flags & Node::BindCmd) && dStricmp( function, node->consoleFunction ) == 0 ) )
|
||||||
{
|
{
|
||||||
devMapIndex = i;
|
devMapIndex = i;
|
||||||
nodeIndex = j;
|
nodeIndex = j;
|
||||||
|
|
@ -1805,6 +1806,7 @@ bool ActionMap::handleEvent(const InputEventInfo* pEvent)
|
||||||
for (SimSet::iterator itr = pActionMapSet->end() - 1;
|
for (SimSet::iterator itr = pActionMapSet->end() - 1;
|
||||||
itr > pActionMapSet->begin(); itr--) {
|
itr > pActionMapSet->begin(); itr--) {
|
||||||
ActionMap* pMap = static_cast<ActionMap*>(*itr);
|
ActionMap* pMap = static_cast<ActionMap*>(*itr);
|
||||||
|
|
||||||
if (pMap->processAction(pEvent) == true)
|
if (pMap->processAction(pEvent) == true)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ new GuiControlProfile(GuiConsoleTextProfile)
|
||||||
category = "Core";
|
category = "Core";
|
||||||
};
|
};
|
||||||
|
|
||||||
$ConsoleDefaultFillColor = "12 14 19 175";
|
$ConsoleDefaultFillColor = "0 0 0 175";
|
||||||
|
|
||||||
if(!isObject(ConsoleScrollProfile))
|
if(!isObject(ConsoleScrollProfile))
|
||||||
new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile)
|
new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile)
|
||||||
|
|
|
||||||
|
|
@ -147,25 +147,31 @@ new GuiControlProfile(GuiTextEditProfile)
|
||||||
category = "Core";
|
category = "Core";
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!isObject(GuiMenuScrollProfile))
|
if(!isObject(GuiScrollProfile))
|
||||||
new GuiControlProfile(GuiMenuScrollProfile)
|
new GuiControlProfile(GuiScrollProfile)
|
||||||
{
|
{
|
||||||
opaque = true;
|
opaque = "0";
|
||||||
fontColor = $TextMediumEmphasisColor;
|
fontColor = "200 200 200 255";
|
||||||
fontColorHL = $TextMediumEmphasisColor;
|
fontColorHL = "200 200 200 255";
|
||||||
fontColorNA = $TextDisabledColor;
|
fontColorNA = "108 108 108 255";
|
||||||
fontColorSEL = $TextMediumEmphasisColor;
|
fontColorSEL = "200 200 200 255";
|
||||||
fillColor = "40 40 40";
|
fillColor = "0 0 0 0";
|
||||||
fillColorHL = "56 56 56";
|
fillColorHL = "56 56 56";
|
||||||
fillColorNA = "40 40 40";
|
fillColorNA = "40 40 40";
|
||||||
borderColor = "87 87 87";
|
borderColor = "87 87 87";
|
||||||
borderColorNA = "0 0 0";
|
borderColorNA = "0 0 0";
|
||||||
borderColorHL = "255 255 255";
|
borderColorHL = "255 255 255";
|
||||||
border = true;
|
border = "0";
|
||||||
bitmapAsset = "Core_GUI:scrollBar_image";
|
bitmapAsset = "Core_GUI:scrollBar_image";
|
||||||
hasBitmapArray = true;
|
hasBitmapArray = true;
|
||||||
category = "Core";
|
category = "Core";
|
||||||
fontSize = 15;
|
fontSize = 15;
|
||||||
|
fontColors[0] = "200 200 200 255";
|
||||||
|
fontColors[1] = "200 200 200 255";
|
||||||
|
fontColors[2] = "108 108 108 255";
|
||||||
|
fontColors[3] = "200 200 200 255";
|
||||||
|
fontColors[8] = "Fuchsia";
|
||||||
|
fontColors[9] = "255 0 255 255";
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!isObject(GuiOverlayProfile))
|
if(!isObject(GuiOverlayProfile))
|
||||||
|
|
@ -261,3 +267,24 @@ new GuiControlProfile(GuiScrollProfile)
|
||||||
bitmapAsset = "Core_GUI:scrollBar_image";
|
bitmapAsset = "Core_GUI:scrollBar_image";
|
||||||
category = "Core";
|
category = "Core";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
singleton GuiControlProfile( GuiInputCtrlProfile )
|
||||||
|
{
|
||||||
|
tab = true;
|
||||||
|
canKeyFocus = true;
|
||||||
|
category = "Core";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile (GuiTextProfile)
|
||||||
|
{
|
||||||
|
justify = "left";
|
||||||
|
fontColor = "20 20 20";
|
||||||
|
category = "Core";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
|
||||||
|
{
|
||||||
|
justify = "right";
|
||||||
|
category = "Core";
|
||||||
|
};
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ function Core_SFX::onCreate(%this)
|
||||||
exec("./scripts/audioDescriptions." @ $TorqueScriptFileExtension);
|
exec("./scripts/audioDescriptions." @ $TorqueScriptFileExtension);
|
||||||
exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension);
|
exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension);
|
||||||
exec("./scripts/audioStates." @ $TorqueScriptFileExtension);
|
exec("./scripts/audioStates." @ $TorqueScriptFileExtension);
|
||||||
|
exec("./scripts/audioOptions." @ $TorqueScriptFileExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Core_SFX::onDestroy(%this)
|
function Core_SFX::onDestroy(%this)
|
||||||
|
|
|
||||||
|
|
@ -309,17 +309,26 @@ function sfxAutodetect()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Volume channel IDs for backwards-compatibility.
|
// Volume channel IDs for backwards-compatibility.
|
||||||
|
$AudioChannelCount = 5;
|
||||||
$GuiAudioType = 1; // Interface.
|
$GuiAudioType = 1; // Interface.
|
||||||
$SimAudioType = 2; // Game.
|
$SimAudioType = 2; // Game.
|
||||||
$MessageAudioType = 3; // Notifications.
|
$MessageAudioType = 3; // Notifications.
|
||||||
$MusicAudioType = 4; // Music.
|
$MusicAudioType = 4; // Music.
|
||||||
|
|
||||||
$AudioChannels[ 0 ] = AudioChannelDefault;
|
$AudioChannels[ 0 ] = AudioChannelDefault;
|
||||||
|
$AudioChannelsName[ 0 ] = "Master";
|
||||||
|
|
||||||
$AudioChannels[ $GuiAudioType ] = AudioChannelGui;
|
$AudioChannels[ $GuiAudioType ] = AudioChannelGui;
|
||||||
|
$AudioChannelsName[ $GuiAudioType ] = "Gui";
|
||||||
|
|
||||||
$AudioChannels[ $SimAudioType ] = AudioChannelEffects;
|
$AudioChannels[ $SimAudioType ] = AudioChannelEffects;
|
||||||
|
$AudioChannelsName[ $SimAudioType ] = "Effects";
|
||||||
|
|
||||||
$AudioChannels[ $MessageAudioType ] = AudioChannelMessages;
|
$AudioChannels[ $MessageAudioType ] = AudioChannelMessages;
|
||||||
|
$AudioChannelsName[ $MessageAudioType ] = "Messages";
|
||||||
|
|
||||||
$AudioChannels[ $MusicAudioType ] = AudioChannelMusic;
|
$AudioChannels[ $MusicAudioType ] = AudioChannelMusic;
|
||||||
|
$AudioChannelsName[ $MusicAudioType ] = "Music";
|
||||||
|
|
||||||
function sfxOldChannelToGroup( %channel )
|
function sfxOldChannelToGroup( %channel )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
103
Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript
Normal file
103
Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
new SimGroup(AudioSettingsGroup)
|
||||||
|
{
|
||||||
|
class = "PrimaryOptionsGroup";
|
||||||
|
displayName = "Audio";
|
||||||
|
|
||||||
|
new SimGroup()
|
||||||
|
{
|
||||||
|
class = "SubOptionsGroup";
|
||||||
|
displayName = "Audio Devices";
|
||||||
|
|
||||||
|
new SimGroup(AudioSettingsProviderGroup)
|
||||||
|
{
|
||||||
|
class = "AudioOptionsSettings";
|
||||||
|
|
||||||
|
OptionName = "Audio Provider";
|
||||||
|
Description = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
new SimGroup(AudioSettingsDeviceGroup)
|
||||||
|
{
|
||||||
|
class = "AudioOptionsSettings";
|
||||||
|
|
||||||
|
OptionName = "Audio Device";
|
||||||
|
Description = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function AudioSettingsGroup::populateSettings(%this)
|
||||||
|
{
|
||||||
|
AudioSettingsProviderGroup.clear();
|
||||||
|
AudioSettingsDeviceGroup.clear();
|
||||||
|
|
||||||
|
%buffer = sfxGetAvailableDevices();
|
||||||
|
%count = getRecordCount( %buffer );
|
||||||
|
|
||||||
|
for(%i = 0; %i < %count; %i++)
|
||||||
|
{
|
||||||
|
%record = getRecord(%buffer, %i);
|
||||||
|
%provider = getField(%record, 0);
|
||||||
|
%device = getField(%record, 1);
|
||||||
|
|
||||||
|
//When the client is actually running, we don't care about null audo devices
|
||||||
|
if(%provider $= "null")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//We can't have duplicate providers, so double check for uniqueness
|
||||||
|
%foundProvider = false;
|
||||||
|
foreach(%registeredProviders in AudioSettingsProviderGroup)
|
||||||
|
{
|
||||||
|
if(%registeredProviders.displayName $= %provider)
|
||||||
|
{
|
||||||
|
%foundProvider = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!%foundProvider)
|
||||||
|
{
|
||||||
|
//Provider entry
|
||||||
|
%providerEntry = new ArrayObject()
|
||||||
|
{
|
||||||
|
class = "OptionsQualityLevel";
|
||||||
|
displayName = %provider;
|
||||||
|
key["$pref::SFX::provider"] = %provider;
|
||||||
|
};
|
||||||
|
|
||||||
|
AudioSettingsProviderGroup.add(%providerEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Device Entry
|
||||||
|
%deviceEntry = new ArrayObject()
|
||||||
|
{
|
||||||
|
class = "OptionsQualityLevel";
|
||||||
|
displayName = %device;
|
||||||
|
provider = %provider; //this is for filtering later, if we need to
|
||||||
|
key["$pref::SFX::device"] = %device;
|
||||||
|
};
|
||||||
|
|
||||||
|
AudioSettingsDeviceGroup.add(%deviceEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AudioSettingsProviderGroup::onApply(%this)
|
||||||
|
{
|
||||||
|
updateAudioOptionsSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function AudioSettingsDeviceGroup::onApply(%this)
|
||||||
|
{
|
||||||
|
updateAudioOptionsSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateAudioOptionsSettings()
|
||||||
|
{
|
||||||
|
if ( !sfxCreateDevice( $pref::SFX::provider,
|
||||||
|
$pref::SFX::device,
|
||||||
|
$pref::SFX::useHardware,
|
||||||
|
-1 ) )
|
||||||
|
error( "Unable to create SFX device: " @ $pref::SFX::provider
|
||||||
|
SPC $pref::SFX::device
|
||||||
|
SPC $pref::SFX::useHardware );
|
||||||
|
}
|
||||||
|
|
@ -17,13 +17,20 @@ addKeyRemap("Ascend", "ExampleMoveMap", "keyboard", "moveup", "Makes the camera
|
||||||
addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend");
|
addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend");
|
||||||
addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump");
|
addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump");
|
||||||
|
|
||||||
|
//addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement");
|
||||||
|
//addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement");
|
||||||
|
//addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement");
|
||||||
|
//addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement");
|
||||||
|
addKeyRemap("Jump", "ExampleMoveMap", "gamepad", "jump", "Jump");
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Non-remapable binds
|
// Non-remapable binds
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ExampleMoveMap.bind( keyboard, F2, showPlayerList );
|
ExampleMoveMap.bind( keyboard, F2, showPlayerList );
|
||||||
ExampleMoveMap.bind(keyboard, "ctrl h", hideHUDs);
|
ExampleMoveMap.bind(keyboard, "ctrl h", hideHUDs);
|
||||||
ExampleMoveMap.bind(keyboard, "alt p", doScreenShotHudless);
|
ExampleMoveMap.bind(keyboard, "alt p", doScreenShotHudless);
|
||||||
ExampleMoveMap.bindCmd(keyboard, "escape", "", "Canvas.pushDialog(PauseMenu);");
|
ExampleMoveMap.bindCmd(keyboard, "escape", "", "Canvas.pushDialog(GameMenu);");
|
||||||
|
ExampleMoveMap.bindCmd(gamepad, btn_start, "Canvas.pushDialog(GameMenu);", "" );
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Movement Keys
|
// Movement Keys
|
||||||
|
|
|
||||||
|
|
@ -40,20 +40,11 @@ function UI::initClient(%this)
|
||||||
//Profiles
|
//Profiles
|
||||||
%this.queueExec("./scripts/profiles");
|
%this.queueExec("./scripts/profiles");
|
||||||
|
|
||||||
//Navigation Utility Scripts
|
|
||||||
%this.queueExec("./scripts/menuNavigation");
|
|
||||||
|
|
||||||
//Now gui files
|
|
||||||
%this.queueExec("./scripts/menuInputHandling");
|
|
||||||
|
|
||||||
%this.queueExec("./guis/mainMenu");
|
%this.queueExec("./guis/mainMenu");
|
||||||
%this.queueExec("./guis/mainMenu.gui");
|
%this.queueExec("./guis/mainMenu.gui");
|
||||||
|
|
||||||
%this.queueExec("./guis/mainMenuButtons");
|
%this.queueExec("./guis/ChooseLevelMenu");
|
||||||
%this.queueExec("./guis/mainMenuButtons.gui");
|
%this.queueExec("./guis/ChooseLevelMenu.gui");
|
||||||
|
|
||||||
%this.queueExec("./guis/chooseLevelDlg");
|
|
||||||
%this.queueExec("./guis/chooseLevelDlg.gui");
|
|
||||||
|
|
||||||
%this.queueExec("./guis/joinServerMenu");
|
%this.queueExec("./guis/joinServerMenu");
|
||||||
%this.queueExec("./guis/joinServerMenu.gui");
|
%this.queueExec("./guis/joinServerMenu.gui");
|
||||||
|
|
@ -63,9 +54,10 @@ function UI::initClient(%this)
|
||||||
%this.queueExec("./guis/optionsMenu");
|
%this.queueExec("./guis/optionsMenu");
|
||||||
%this.queueExec("./guis/optionsMenu.gui");
|
%this.queueExec("./guis/optionsMenu.gui");
|
||||||
|
|
||||||
%this.queueExec("./guis/pauseMenu");
|
%this.queueExec("./guis/GameMenu");
|
||||||
%this.queueExec("./guis/pauseMenu.gui");
|
%this.queueExec("./guis/GameMenu.gui");
|
||||||
|
|
||||||
|
%this.queueExec("./guis/remapDlg");
|
||||||
%this.queueExec("./guis/remapDlg.gui");
|
%this.queueExec("./guis/remapDlg.gui");
|
||||||
%this.queueExec("./guis/remapConfirmDlg.gui");
|
%this.queueExec("./guis/remapConfirmDlg.gui");
|
||||||
|
|
||||||
|
|
@ -73,21 +65,18 @@ function UI::initClient(%this)
|
||||||
%this.queueExec("./guis/profiler.gui");
|
%this.queueExec("./guis/profiler.gui");
|
||||||
|
|
||||||
%this.queueExec("./guis/netGraphGui.gui");
|
%this.queueExec("./guis/netGraphGui.gui");
|
||||||
%this.queueExec("./guis/RecordingsDlg.gui");
|
|
||||||
|
|
||||||
%this.queueExec("./guis/guiMusicPlayer");
|
|
||||||
%this.queueExec("./guis/guiMusicPlayer.gui");
|
|
||||||
|
|
||||||
%this.queueExec("./guis/startupGui");
|
%this.queueExec("./guis/startupGui");
|
||||||
%this.queueExec("./guis/startupGui.gui");
|
%this.queueExec("./guis/startupGui.gui");
|
||||||
|
|
||||||
// Load Editor Dialogs
|
%this.queueExec("./guis/messageBoxDlg");
|
||||||
%this.queueExec("./guis/messageBoxDlg.gui");
|
%this.queueExec("./guis/messageBoxDlg.gui");
|
||||||
|
|
||||||
|
%this.queueExec("./guis/SystemMenu");
|
||||||
|
%this.queueExec("./guis/SystemMenu.gui");
|
||||||
|
|
||||||
//Load scripts
|
//Load scripts
|
||||||
%this.queueExec("./scripts/controlsMenu");
|
%this.queueExec("./scripts/controlsMenu");
|
||||||
%this.queueExec("./scripts/messageBoxes");
|
|
||||||
%this.queueExec("./scripts/help");
|
|
||||||
%this.queueExec("./scripts/cursors");
|
%this.queueExec("./scripts/cursors");
|
||||||
|
|
||||||
if(isToolBuild())
|
if(isToolBuild())
|
||||||
|
|
@ -97,3 +86,8 @@ function UI::initClient(%this)
|
||||||
function UI::onCreateClientConnection(%this){}
|
function UI::onCreateClientConnection(%this){}
|
||||||
|
|
||||||
function UI::onDestroyClientConnection(%this){}
|
function UI::onDestroyClientConnection(%this){}
|
||||||
|
|
||||||
|
function UI::registerGameMenus(%this, %menusArrayObj)
|
||||||
|
{
|
||||||
|
%menusArrayObj.add("System", SystemMenu);
|
||||||
|
}
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="ChooseLevelDlg"
|
|
||||||
scriptFile="@assetFile=chooseLevelDlg"
|
|
||||||
GUIFile="@assetFile=chooseLevelDlg.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<GUIAsset
|
||||||
|
AssetName="ChooseLevelMenu"
|
||||||
|
scriptFile="@assetFile=ChooseLevelMenu"
|
||||||
|
GUIFile="@assetFile=ChooseLevelMenu.gui"
|
||||||
|
VersionId="1"/>
|
||||||
345
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui
Normal file
345
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.gui
Normal file
|
|
@ -0,0 +1,345 @@
|
||||||
|
//--- OBJECT WRITE BEGIN ---
|
||||||
|
$guiContent = new GuiControl(ChooseLevelMenu) {
|
||||||
|
extent = "1280 720";
|
||||||
|
minExtent = "8 8";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuBackgroundProfile";
|
||||||
|
category = "BaseUI";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
launchInEditor = "0";
|
||||||
|
previewButtonSize = "445 120";
|
||||||
|
|
||||||
|
new GuiInputCtrl(ChooseLevelInputHandler) {
|
||||||
|
ignoreMouseEvents = "1";
|
||||||
|
ActionMap = "ChooseLevelActionMap";
|
||||||
|
position = "-50 0";
|
||||||
|
extent = "2186 851";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiPanel(ChooseLevelTitlePanel) {
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl(ChooseLevelTitleText) {
|
||||||
|
text = "SINGLE PLAYER";
|
||||||
|
position = "22 23";
|
||||||
|
extent = "1281 28";
|
||||||
|
profile = "MenuHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiStackControl(ChooseLevelMenuTabList) {
|
||||||
|
stackingType = "Horizontal";
|
||||||
|
padding = "10";
|
||||||
|
position = "485 61";
|
||||||
|
extent = "310 41";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Level";
|
||||||
|
groupNum = "1";
|
||||||
|
extent = "150 41";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "ChooseLevelMenu.openMenu(0);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "ChooseLevelMenuButton";
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Server Config";
|
||||||
|
groupNum = "1";
|
||||||
|
position = "160 0";
|
||||||
|
extent = "150 41";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "ChooseLevelMenu.openMenu(1);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "ChooseLevelMenuButton";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiControl(ChooseLevelMenuNavButtonOverlay) {
|
||||||
|
position = "0 61";
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(ChooseLevelMenuPrevNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Q_image";
|
||||||
|
position = "485 24";
|
||||||
|
extent = "40 40";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiBitmapCtrl(ChooseLevelMenuNextNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_E_image";
|
||||||
|
position = "595 24";
|
||||||
|
extent = "40 40";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer(LevelSelectContainer) {
|
||||||
|
position = "196 119";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiScrollCtrl(LevelPreviewScroll) {
|
||||||
|
hScrollBar = "alwaysOff";
|
||||||
|
vScrollBar = "dynamic";
|
||||||
|
extent = "445 562";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuScrollProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiStackControl(LevelPreviewArray) {
|
||||||
|
padding = "5";
|
||||||
|
position = "0 1";
|
||||||
|
extent = "445 120";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiBitmapCtrl(LevelPreviewBitmap) {
|
||||||
|
BitmapAsset = "";
|
||||||
|
position = "448 0";
|
||||||
|
extent = "440 440";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextCtrl(LevelNameText) {
|
||||||
|
text = "";
|
||||||
|
position = "448 445";
|
||||||
|
extent = "440 20";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "MenuSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "levelNameTxt";
|
||||||
|
};
|
||||||
|
new GuiMLTextCtrl(LevelDescriptionText) {
|
||||||
|
position = "448 473";
|
||||||
|
extent = "440 19";
|
||||||
|
horizSizing = "left";
|
||||||
|
profile = "GuiMLTextProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "levelDescTxt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer(ServerConfigContainer) {
|
||||||
|
position = "196 119";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
hidden = "1";
|
||||||
|
|
||||||
|
new GuiScrollCtrl(ServerConfigScroll) {
|
||||||
|
hScrollBar = "alwaysOff";
|
||||||
|
vScrollBar = "dynamic";
|
||||||
|
extent = "888 566";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuScrollProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiStackControl(ServerConfigList) {
|
||||||
|
padding = "5";
|
||||||
|
changeChildSizeToFit = "0";
|
||||||
|
position = "1 1";
|
||||||
|
extent = "900 170";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiContainer() {
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Host Player Name";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "140 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(playerNameCTRL) {
|
||||||
|
text = "Visitor";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$pref::Player::Name";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 35";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Name";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "101 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(serverNameCTRL) {
|
||||||
|
text = "";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Name";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 70";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Password";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "135 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(serverPassCTRL) {
|
||||||
|
text = "";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Password";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 105";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Description";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "147 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(serverInfoCTRL) {
|
||||||
|
text = "This is a Torque 3D server.";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::Info";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "0 140";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Max Players";
|
||||||
|
position = "0 3";
|
||||||
|
extent = "94 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(serverMaxPlayersCTRL) {
|
||||||
|
text = "64";
|
||||||
|
position = "606 4";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Pref::Server::MaxPlayers";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiPanel(ChooseLevelButtonPanel) {
|
||||||
|
position = "0 683";
|
||||||
|
extent = "1281 40";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiIconButtonCtrl(ChooseLevelStartBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Start Game";
|
||||||
|
position = "1092 0";
|
||||||
|
extent = "163 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "ChooseLevelBegin(1);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(ChooseLevelBackBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Escape_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Back";
|
||||||
|
position = "16 0";
|
||||||
|
extent = "140 40";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "Canvas.popDialog();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//--- OBJECT WRITE END ---
|
||||||
285
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript
Normal file
285
Templates/BaseGame/game/data/UI/guis/ChooseLevelMenu.tscript
Normal file
|
|
@ -0,0 +1,285 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// 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 ChooseLevelMenu::onAdd( %this )
|
||||||
|
{
|
||||||
|
if(!isObject(ChooseLevelAssetQuery))
|
||||||
|
new AssetQuery(ChooseLevelAssetQuery);
|
||||||
|
|
||||||
|
%this.previewButtonSize = "445 120";
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenu::fillPrefEntries( %this )
|
||||||
|
{
|
||||||
|
playerNameCTRL.setText($Pref::Player::Name);
|
||||||
|
serverNameCTRL.setText($Pref::Server::Name);
|
||||||
|
serverPassCTRL.setText($Pref::Server::Password);
|
||||||
|
serverInfoCTRL.setText($Pref::Server::Info);
|
||||||
|
serverMaxPlayersCTRL.setText($Pref::Server::MaxPlayers);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenu::onWake(%this)
|
||||||
|
{
|
||||||
|
%this.fillPrefEntries();
|
||||||
|
LevelPreviewArray.clear();
|
||||||
|
|
||||||
|
ChooseLevelAssetQuery.clear();
|
||||||
|
AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset");
|
||||||
|
|
||||||
|
%count = ChooseLevelAssetQuery.getCount();
|
||||||
|
|
||||||
|
if(%count == 0 && !IsDirectory("tools"))
|
||||||
|
{
|
||||||
|
//We have no levels found. Prompt the user to open the editor to the default level if the tools are present
|
||||||
|
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
|
||||||
|
"Canvas.popDialog(ChooseLevelMenu); if(isObject(ChooseLevelMenu.returnGui) && ChooseLevelMenu.returnGui.isMethod(\"onReturnTo\")) ChooseLevelMenu.returnGui.onReturnTo();");
|
||||||
|
|
||||||
|
ChooseLevelAssetQuery.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(%i=0; %i < %count; %i++)
|
||||||
|
{
|
||||||
|
%assetId = ChooseLevelAssetQuery.getAsset(%i);
|
||||||
|
|
||||||
|
if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
%levelAsset = AssetDatabase.acquireAsset(%assetId);
|
||||||
|
|
||||||
|
%file = %levelAsset.getLevelPath();
|
||||||
|
|
||||||
|
if ( !isFile(%file) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
%levelPreviewImg = %levelAsset.getPreviewImagePath();
|
||||||
|
|
||||||
|
if (!isFile(%levelPreviewImg))
|
||||||
|
%levelPreviewImg = "UI:no_preview_image";
|
||||||
|
|
||||||
|
%preview = new GuiIconButtonCtrl() {
|
||||||
|
position = "0 0";
|
||||||
|
extent = %this.previewButtonSize;
|
||||||
|
buttonType = "PushButton";
|
||||||
|
profile = GuiMenuButtonLeftJustProfile;
|
||||||
|
horizSizing = "right";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
internalName = "button";
|
||||||
|
class = "LevelPreviewButton";
|
||||||
|
//command = "$selectedLevelAsset = " @ %assetId @ ";";
|
||||||
|
altCommand = "ChooseLevelBegin(1);"; //allow doubleclick to quick action it
|
||||||
|
text = %levelAsset.levelName;
|
||||||
|
bitmapAsset = %levelPreviewImg;
|
||||||
|
levelAsset = %levelAsset;
|
||||||
|
levelAssetId = %assetId;
|
||||||
|
iconLocation = "left";
|
||||||
|
sizeIconToButton = true;
|
||||||
|
makeIconSquare = true;
|
||||||
|
textLocation = "left";
|
||||||
|
textMargin = 120;
|
||||||
|
groupNum = 2;
|
||||||
|
cansave = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
LevelPreviewArray.add(%preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelPreviewArray.listPosition = 0;
|
||||||
|
|
||||||
|
// Also add the new level mission as defined in the world editor settings
|
||||||
|
// if we are choosing a level to launch in the editor.
|
||||||
|
if ( %this.launchInEditor )
|
||||||
|
{
|
||||||
|
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$pref::HostMultiPlayer)
|
||||||
|
ChooseLevelTitleText.setText("SINGLE PLAYER");
|
||||||
|
else
|
||||||
|
ChooseLevelTitleText.setText("CREATE SERVER");
|
||||||
|
|
||||||
|
ChooseLevelMenuTabList.visible = $pref::HostMultiPlayer;
|
||||||
|
ChooseLevelMenuNavButtonOverlay.visible = $pref::HostMultiPlayer;
|
||||||
|
|
||||||
|
%this.schedule(32, openMenu, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isObject( ChooseLevelActionMap ) )
|
||||||
|
{
|
||||||
|
new ActionMap(ChooseLevelActionMap){};
|
||||||
|
|
||||||
|
ChooseLevelActionMap.bind( keyboard, q, ChooseLevelMenuPrevMenu);
|
||||||
|
ChooseLevelActionMap.bind( gamepad, btn_l, ChooseLevelMenuPrevMenu);
|
||||||
|
|
||||||
|
ChooseLevelActionMap.bind( keyboard, e, ChooseLevelMenuNextMenu);
|
||||||
|
ChooseLevelActionMap.bind( gamepad, btn_r, ChooseLevelMenuNextMenu);
|
||||||
|
|
||||||
|
ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin );
|
||||||
|
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenu::syncGUI(%this)
|
||||||
|
{
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
//Category handling
|
||||||
|
%btn = ChooseLevelMenuTabList.getObject(%this.currentMenuIdx);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
%buttonPosX = %btn.position.x + ChooseLevelMenuTabList.position.x;
|
||||||
|
|
||||||
|
ChooseLevelMenuPrevNavIcon.position.x = %buttonPosX;
|
||||||
|
ChooseLevelMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
|
||||||
|
|
||||||
|
ChooseLevelBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
|
||||||
|
|
||||||
|
ChooseLevelStartBtn.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelBegin"));
|
||||||
|
|
||||||
|
ChooseLevelMenuPrevNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuPrevMenu"));
|
||||||
|
ChooseLevelMenuNextNavIcon.setBitmap(ChooseLevelActionMap.getCommandButtonBitmap(%device, "ChooseLevelMenuNextMenu"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function LevelPreviewArray::syncGUI(%this)
|
||||||
|
{
|
||||||
|
%btn = %this.getObject(%this.listPosition);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
$selectedLevelAsset = %btn.levelAssetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenuPrevMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val && $pref::HostMultiPlayer)
|
||||||
|
{
|
||||||
|
%currentIdx = ChooseLevelMenu.currentMenuIdx;
|
||||||
|
ChooseLevelMenu.currentMenuIdx -= 1;
|
||||||
|
|
||||||
|
ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1);
|
||||||
|
|
||||||
|
if(%currentIdx == ChooseLevelMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenuNextMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val && $pref::HostMultiPlayer)
|
||||||
|
{
|
||||||
|
%currentIdx = ChooseLevelMenu.currentMenuIdx;
|
||||||
|
ChooseLevelMenu.currentMenuIdx += 1;
|
||||||
|
|
||||||
|
ChooseLevelMenu.currentMenuIdx = mClamp(ChooseLevelMenu.currentMenuIdx, 0, 1);
|
||||||
|
|
||||||
|
if(%currentIdx == ChooseLevelMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChooseLevelMenu.openMenu(ChooseLevelMenu.currentMenuIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ChooseLevelMenu::openMenu(%this, %menuIdx)
|
||||||
|
{
|
||||||
|
LevelSelectContainer.setVisible(%menuIdx == 0);
|
||||||
|
ServerConfigContainer.setVisible(%menuIdx == 1);
|
||||||
|
|
||||||
|
if(%menuIdx == 0)
|
||||||
|
$MenuList = LevelPreviewArray;
|
||||||
|
else if(%menuIdx == 1)
|
||||||
|
$MenuList = ServerConfigList;
|
||||||
|
|
||||||
|
%this.currentMenuIdx = %menuIdx;
|
||||||
|
|
||||||
|
if($MenuList.isMethod("syncGui"))
|
||||||
|
$MenuList.syncGui();
|
||||||
|
|
||||||
|
%this.syncGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelBegin(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
// So we can't fire the button when loading is in progress.
|
||||||
|
if ( isObject( ServerGroup ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Canvas.popDialog();
|
||||||
|
|
||||||
|
%entry = LevelPreviewArray.getObject(LevelPreviewArray.listPosition);
|
||||||
|
|
||||||
|
if(!AssetDatabase.isDeclaredAsset(%entry.levelAssetId))
|
||||||
|
{
|
||||||
|
MessageBoxOK("Error", "Selected level preview does not have a valid level asset!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedLevelAsset = %entry.levelAssetId;
|
||||||
|
|
||||||
|
// Launch the chosen level with the editor open?
|
||||||
|
if ( ChooseLevelMenu.launchInEditor )
|
||||||
|
{
|
||||||
|
activatePackage( "BootEditor" );
|
||||||
|
ChooseLevelMenu.launchInEditor = false;
|
||||||
|
StartGame(%entry.levelAssetId, "SinglePlayer");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartGame(%entry.levelAssetId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ChooseLevelMenu::onSleep( %this )
|
||||||
|
{
|
||||||
|
// This is set from the outside, only stays true for a single wake/sleep
|
||||||
|
// cycle.
|
||||||
|
%this.launchInEditor = false;
|
||||||
|
|
||||||
|
//Ensure any changes we made to our server configs is saved out
|
||||||
|
if($pref::HostMultiPlayer)
|
||||||
|
{
|
||||||
|
echo("Exporting server prefs");
|
||||||
|
%prefPath = getPrefpath();
|
||||||
|
export("$Pref::Server::*", %prefPath @ "/serverPrefs." @ $TorqueScriptFileExtension, false);
|
||||||
|
BanList::Export(%prefPath @ "/banlist." @ $TorqueScriptFileExtension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function LevelPreviewButton::onHighlighted(%this, %highlighted)
|
||||||
|
{
|
||||||
|
if(%highlighted)
|
||||||
|
{
|
||||||
|
$MenuList.listPosition = $MenuList.getObjectIndex(%this);
|
||||||
|
|
||||||
|
LevelPreviewBitmap.bitmapAsset = %this.bitmapAsset;
|
||||||
|
LevelNameText.text = %this.levelAsset.levelName;
|
||||||
|
LevelDescriptionText.setText(%this.levelAsset.levelDescription);
|
||||||
|
|
||||||
|
LevelPreviewScroll.scrollToObject(%this);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Templates/BaseGame/game/data/UI/guis/GameMenu.asset.taml
Normal file
5
Templates/BaseGame/game/data/UI/guis/GameMenu.asset.taml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<GUIAsset
|
||||||
|
AssetName="GameMenu"
|
||||||
|
scriptFile="@assetFile=GameMenu"
|
||||||
|
GUIFile="@assetFile=GameMenu.gui"
|
||||||
|
VersionId="1"/>
|
||||||
93
Templates/BaseGame/game/data/UI/guis/GameMenu.gui
Normal file
93
Templates/BaseGame/game/data/UI/guis/GameMenu.gui
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
//--- OBJECT WRITE BEGIN ---
|
||||||
|
$guiContent = new GuiControl(GameMenu) {
|
||||||
|
extent = "1280 720";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
|
||||||
|
new GuiInputCtrl(GameMenuInputHandler) {
|
||||||
|
ignoreMouseEvents = "1";
|
||||||
|
ActionMap = "GameMenuActionMap";
|
||||||
|
position = "-50 0";
|
||||||
|
extent = "50 50";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiChunkedBitmapCtrl(GameMenuBG) {
|
||||||
|
BitmapAsset = "UI:hudfill_image";
|
||||||
|
extent = "1280 720";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
|
||||||
|
new GuiPanel(GameMenuTitlePanel) {
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiStackControl(GameMenuButtonList){
|
||||||
|
position = "40 0";
|
||||||
|
extent = "1240 60";
|
||||||
|
profile = GuiDefaultProfile;
|
||||||
|
stackingType = "Horizontal";
|
||||||
|
padding = "10";
|
||||||
|
horizSizing = "center";
|
||||||
|
vertSizing = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiControl(GameMenuNavButtonOverlay) {
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(GameMenuPrevNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Q_image";
|
||||||
|
position = "0 24";
|
||||||
|
extent = "40 40";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
vertSizing = "top";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(GameMenuNextNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_E_image";
|
||||||
|
position = "0 24";
|
||||||
|
extent = "40 40";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
vertSizing = "top";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiPanel(GameMenuButtonPanel) {
|
||||||
|
position = "0 683";
|
||||||
|
extent = "1281 40";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiIconButtonCtrl(GameMenuBackBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Escape_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Back";
|
||||||
|
position = "16 0";
|
||||||
|
extent = "140 40";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "Canvas.popDialog(GameMenu);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//--- OBJECT WRITE END ---
|
||||||
187
Templates/BaseGame/game/data/UI/guis/GameMenu.tscript
Normal file
187
Templates/BaseGame/game/data/UI/guis/GameMenu.tscript
Normal file
|
|
@ -0,0 +1,187 @@
|
||||||
|
function GameMenu::onAdd(%this)
|
||||||
|
{
|
||||||
|
%this.gameMenusArray = new ArrayObject(){};
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenu::onWake(%this)
|
||||||
|
{
|
||||||
|
if($Server::ServerType $= "SinglePlayer")
|
||||||
|
{
|
||||||
|
$timescale = 0;
|
||||||
|
|
||||||
|
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
callOnModules("registerGameMenus", "", %this.gameMenusArray);
|
||||||
|
|
||||||
|
//Remove duplicates as needed
|
||||||
|
%this.gameMenusArray.uniqueKey();
|
||||||
|
|
||||||
|
GameMenuButtonList.clear();
|
||||||
|
|
||||||
|
%stackWidth = 0;
|
||||||
|
//process the entries and give 'em buttons on the button array
|
||||||
|
for(%i=0; %i < %this.gameMenusArray.count(); %i++)
|
||||||
|
{
|
||||||
|
%buttonText = %this.gameMenusArray.getKey(%i);
|
||||||
|
|
||||||
|
%textWidth = GuiMenuButtonProfile.getStringWidth(%buttonText);
|
||||||
|
|
||||||
|
%btn = new GuiButtonCtrl() {
|
||||||
|
extent = %textWidth + 80 SPC 40;
|
||||||
|
profile = GuiMenuButtonProfile;
|
||||||
|
text = %buttonText;
|
||||||
|
class = "GameMenuButton";
|
||||||
|
command = "GameMenu.openGameMenu(\"" @ %buttonText @ "\");";
|
||||||
|
canSave = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
%stackWidth += %textWidth + 40;
|
||||||
|
|
||||||
|
GameMenuButtonList.add(%btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
GameMenuButtonList.resize(GameMenuTitlePanel.extent.x/2 - %stackWidth/2, 0, %stackWidth, GameMenuTitlePanel.extent.y);
|
||||||
|
|
||||||
|
%this.openGameMenu("System");
|
||||||
|
|
||||||
|
//give a slight delay for the canvas to be fully refreshed before we sync things
|
||||||
|
%this.schedule(500, "syncGUI");
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenu::onSleep(%this)
|
||||||
|
{
|
||||||
|
if($Server::ServerType $= "SinglePlayer")
|
||||||
|
{
|
||||||
|
$timescale = 1;
|
||||||
|
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isObject(%this.currentMenu))
|
||||||
|
{
|
||||||
|
Canvas.popDialog(%this.currentMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isObject( GameMenuActionMap ) )
|
||||||
|
{
|
||||||
|
new ActionMap(GameMenuActionMap){};
|
||||||
|
|
||||||
|
//We'll just use the existing BaseUI nav functions because it'd be the same logic anyways
|
||||||
|
GameMenuActionMap.bind( keyboard, w, BaseUINavigatePrev );
|
||||||
|
GameMenuActionMap.bind( keyboard, s, BaseUINavigateNext );
|
||||||
|
GameMenuActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
|
||||||
|
GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
||||||
|
GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
||||||
|
|
||||||
|
GameMenuActionMap.bind( keyboard, Space, BaseUIActivateSelected );
|
||||||
|
GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
||||||
|
|
||||||
|
GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" );
|
||||||
|
GameMenuActionMap.bindCmd( gamepad, btn_b, "Canvas.popDialog(GameMenu);", "" );
|
||||||
|
GameMenuActionMap.bindCmd( gamepad, btn_start, "Canvas.popDialog(GameMenu);", "" );
|
||||||
|
|
||||||
|
GameMenuActionMap.bind( keyboard, q, GameMenuPrevMenu );
|
||||||
|
GameMenuActionMap.bind( gamepad, btn_l, GameMenuPrevMenu );
|
||||||
|
|
||||||
|
GameMenuActionMap.bind( keyboard, e, GameMenuNextMenu );
|
||||||
|
GameMenuActionMap.bind( gamepad, btn_r, GameMenuNextMenu );
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenu::openGameMenu(%this, %menuName)
|
||||||
|
{
|
||||||
|
%menuIdx = %this.gameMenusArray.getIndexFromKey(%menuName);
|
||||||
|
if(%menuIdx != -1)
|
||||||
|
{
|
||||||
|
%newMenu = %this.gameMenusArray.getValue(%menuIdx);
|
||||||
|
|
||||||
|
if(isObject(%this.currentMenu))
|
||||||
|
Canvas.popDialog(%this.currentMenu);
|
||||||
|
|
||||||
|
Canvas.pushDialog(%newMenu);
|
||||||
|
%this.currentMenu = %newMenu;
|
||||||
|
%this.currentMenuIdx = %menuIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
%this.syncGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
function openPauseMenuOptions()
|
||||||
|
{
|
||||||
|
GameMenu.pushPage(OptionsMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pauseMenuExitToMenu()
|
||||||
|
{
|
||||||
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function pauseMenuExitToDesktop()
|
||||||
|
{
|
||||||
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenuPrevMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
%currentIdx = GameMenu.currentMenuIdx;
|
||||||
|
GameMenu.currentMenuIdx -= 1;
|
||||||
|
if(GameMenu.currentMenuIdx < 0)
|
||||||
|
GameMenu.currentMenuIdx = 0;
|
||||||
|
|
||||||
|
if(%currentIdx == GameMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
%menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx);
|
||||||
|
|
||||||
|
GameMenu.openGameMenu(%menuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenuNextMenu(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
%currentIdx = GameMenu.currentMenuIdx;
|
||||||
|
GameMenu.currentMenuIdx += 1;
|
||||||
|
if(GameMenu.currentMenuIdx >= GameMenu.gameMenusArray.count())
|
||||||
|
GameMenu.currentMenuIdx = GameMenu.gameMenusArray.count()-1;
|
||||||
|
|
||||||
|
if(%currentIdx == GameMenu.currentMenuIdx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
%menuName = GameMenu.gameMenusArray.getKey(GameMenu.currentMenuIdx);
|
||||||
|
|
||||||
|
GameMenu.openGameMenu(%menuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function GameMenu::syncGui(%this)
|
||||||
|
{
|
||||||
|
GameMenuButtonList.callOnChildren("setHighlighted", false);
|
||||||
|
|
||||||
|
%btn = GameMenuButtonList.getObject(%this.currentMenuIdx);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
%buttonPosX = %btn.position.x + GameMenuButtonList.position.x;
|
||||||
|
|
||||||
|
GameMenuPrevNavIcon.position.x = %buttonPosX;
|
||||||
|
GameMenuNextNavIcon.position.x = %buttonPosX + %btn.extent.x - 40;
|
||||||
|
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
GameMenuBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
|
||||||
|
|
||||||
|
GameMenuPrevNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuPrevMenu"));
|
||||||
|
GameMenuNextNavIcon.setBitmap(GameMenuActionMap.getCommandButtonBitmap(%device, "GameMenuNextMenu"));
|
||||||
|
|
||||||
|
%this.schedule(500, "syncGUI");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="GuiMusicPlayer"
|
|
||||||
scriptFile="@assetFile=guiMusicPlayer"
|
|
||||||
GUIFile="@assetFile=guiMusicPlayer.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="IODropdownDlg"
|
|
||||||
GUIFile="@assetFile=IODropdownDlg.ed.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -1,159 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(IODropdownDlg) {
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "640 480";
|
|
||||||
minExtent = "8 8";
|
|
||||||
visible = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
new GuiWindowCtrl(IODropdownFrame) {
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
Profile = "GuiWindowProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
position = "272 77";
|
|
||||||
extent = "256 117";
|
|
||||||
minExtent = "256 8";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
hovertime = "1000";
|
|
||||||
maxLength = "255";
|
|
||||||
resizeWidth = "1";
|
|
||||||
resizeHeight = "1";
|
|
||||||
canMove = "1";
|
|
||||||
canClose = "1";
|
|
||||||
canMinimize = "0";
|
|
||||||
canMaximize = "0";
|
|
||||||
minSize = "50 50";
|
|
||||||
text = "";
|
|
||||||
closeCommand="IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);";
|
|
||||||
|
|
||||||
new GuiMLTextCtrl(IODropdownText) {
|
|
||||||
text = "";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiMLTextProfile";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "9 26";
|
|
||||||
extent = "237 16";
|
|
||||||
minExtent = "8 8";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiBitmapBorderCtrl() {
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiGroupBorderProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "7 51";
|
|
||||||
extent = "243 28";
|
|
||||||
minExtent = "0 0";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiTextCtrl(IOInputText) {
|
|
||||||
text = "Decal Datablock";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiTextRightProfile";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "5 5";
|
|
||||||
extent = "105 18";
|
|
||||||
minExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiPopUpMenuCtrl(IODropdownMenu) {
|
|
||||||
maxPopupHeight = "200";
|
|
||||||
sbUsesNAColor = "0";
|
|
||||||
reverseTextList = "0";
|
|
||||||
bitmapBounds = "16 16";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiPopUpMenuProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
position = "115 5";
|
|
||||||
extent = "122 18";
|
|
||||||
minExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "OK";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiButtonProfile";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "7 85";
|
|
||||||
extent = "156 24";
|
|
||||||
minExtent = "8 8";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
accelerator = "return";
|
|
||||||
command = "IOCallback(IODropdownDlg,IODropdownDlg.callback);";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Cancel";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
profile = "GuiButtonProfile";
|
|
||||||
horizSizing = "left";
|
|
||||||
vertSizing = "top";
|
|
||||||
position = "170 85";
|
|
||||||
extent = "80 24";
|
|
||||||
minExtent = "8 8";
|
|
||||||
canSave = "1";
|
|
||||||
visible = "1";
|
|
||||||
accelerator = "escape";
|
|
||||||
command = "IOCallback(IODropdownDlg,IODropdownDlg.cancelCallback);";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="MainMenuButtons"
|
|
||||||
scriptFile="@assetFile=MainMenuButtons.tscript"
|
|
||||||
GUIFile="@assetFile=MainMenuButtons.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(MainMenuButtons) {
|
|
||||||
extent = "1024 768";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiNonModalDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
originalAssetName = "MainMenuButtons";
|
|
||||||
|
|
||||||
new GuiStackControl(MainMenuButtonList) {
|
|
||||||
padding = "15";
|
|
||||||
dynamicSize = "0";
|
|
||||||
position = "312 145";
|
|
||||||
extent = "400 477";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
superClass = "MenuList";
|
|
||||||
|
|
||||||
new GuiButtonCtrl(MainMenuSinglePlayerBtn) {
|
|
||||||
text = "Single Player";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openSinglePlayerMenu();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
|
|
||||||
text = "Create Server";
|
|
||||||
position = "0 70";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openMultiPlayerMenu();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
|
|
||||||
text = "Join Server";
|
|
||||||
position = "0 140";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openJoinServerMenu();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuOptionBtn) {
|
|
||||||
text = "Options";
|
|
||||||
position = "0 210";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openOptionsMenu();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuWorldEditBtn) {
|
|
||||||
text = "Open World Editor (F11)";
|
|
||||||
position = "0 280";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openWorldEditorBtn();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
enabled = (ModuleDatabase.findModule("ToolsModule") !$= "");
|
|
||||||
visible = (ModuleDatabase.findModule("ToolsModule") !$= "");
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuGuiEditBtn) {
|
|
||||||
text = "Open GUI Editor (F10)";
|
|
||||||
position = "0 350";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openGUIEditorBtn();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
enabled = (ModuleDatabase.findModule("ToolsModule") !$= "");
|
|
||||||
visible = (ModuleDatabase.findModule("ToolsModule") !$= "");
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(MainMenuExitBtn) {
|
|
||||||
text = "Exit";
|
|
||||||
position = "0 420";
|
|
||||||
extent = "400 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "quit();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
function MainMenuButtons::onWake(%this)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
function MainMenuButtons::onSleep(%this)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control
|
|
||||||
// set MainMenuButtonList as it's root page.
|
|
||||||
// This is an optional function, but is called as part of the validation that the page
|
|
||||||
// CAN be opened, so it's shown here as an example
|
|
||||||
function MainMenuButtons::canOpen(%this)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// This gets called by the MainMenuGUI beacuse it, being a UINavigation classed control
|
|
||||||
// set MainMenuButtonList as it's root page.
|
|
||||||
// Once the page is added to the MainMenuGUI's UINavigation page stack, onOpen here is called
|
|
||||||
// Which allows us to actually do the work we need to do for display
|
|
||||||
function MainMenuButtons::onOpen(%this)
|
|
||||||
{
|
|
||||||
//Here, we set the MainMenuButtonList - a GuiStackControl with the MenuList class
|
|
||||||
// to be the active menu list.
|
|
||||||
// This means that when the MainMenuGUI's MainMenuInputHandler receives an input
|
|
||||||
// or we have one of the buttons in the MainMenuButtonHolder be actioned, we know
|
|
||||||
// we're working/navigating this list of buttons specifically
|
|
||||||
// In practice, it sets the $activeMenuList global variable so the various menu class code
|
|
||||||
// can reference it consistently
|
|
||||||
MainMenuButtonList.setAsActiveMenuList();
|
|
||||||
|
|
||||||
//Because MainMenuGUI set it's MainMenuButtonHolder as the active button container, we can reference it
|
|
||||||
//by $activeMenuButtonContainer and set the menu button/accelerator prompts we need for the MainMenuButtonList
|
|
||||||
//specifically.
|
|
||||||
//In particular, being a simple list of buttons, the only one we NEED is a simple activate, so we'll
|
|
||||||
//disable all the other ones to keep them clear in case they were set by other pages at some point
|
|
||||||
$activeMenuButtonContainer-->button1.disable();
|
|
||||||
$activeMenuButtonContainer-->button2.disable();
|
|
||||||
$activeMenuButtonContainer-->button3.disable();
|
|
||||||
|
|
||||||
//Here we set the 4th button in the container
|
|
||||||
//All the buttons have the MenuInputButton class, which, like the other classes
|
|
||||||
//help keep things accessible and consistent. Here we use that class's set function to
|
|
||||||
//configure the accelerator behavior
|
|
||||||
//The first parameter sets the gamepad button to the 'A' button
|
|
||||||
//The second sets the keyboard button to Enter or Return
|
|
||||||
//Third is what the displayed text will be
|
|
||||||
//And finally we set the command when the button is clicked, or either key inputs are caught by
|
|
||||||
//our MenuInputHandler
|
|
||||||
//The menu buttons automatically detect which input device you're using and swap the display between
|
|
||||||
//gamepad or keyboard for consistent behavior
|
|
||||||
$activeMenuButtonContainer-->button4.set("btn_a", "Return", "Go", "MainMenuButtonList.activate();");
|
|
||||||
$activeMenuButtonContainer-->button5.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Optional, as the check defaults to true, but here as an example case
|
|
||||||
function MainMenuButtons::canClose(%this)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function MainMenuButtons::onClose(%this)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//Our actual commands when we activate the buttons
|
|
||||||
function openSinglePlayerMenu()
|
|
||||||
{
|
|
||||||
$pref::HostMultiPlayer=false;
|
|
||||||
MainMenuGui.pushPage(ChooseLevelDlg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openMultiPlayerMenu()
|
|
||||||
{
|
|
||||||
$pref::HostMultiPlayer=true;
|
|
||||||
|
|
||||||
//Here, like the other commands, we add a new page onto the stack
|
|
||||||
//In this case, we'll push the ChooseLevelDlg control onto the stack. This will
|
|
||||||
//invoke the canClose() and then onClose() functions for MainMenuButtonList
|
|
||||||
//before calling the onOpen() for ChooseLevelDlg then displaying.
|
|
||||||
MainMenuGui.pushPage(ChooseLevelDlg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openJoinServerMenu()
|
|
||||||
{
|
|
||||||
//Here, like the other commands, we add a new page onto the stack
|
|
||||||
//In this case, we'll push the JoinServerMenu control onto the stack. This will
|
|
||||||
//invoke the canClose() and then onClose() functions for MainMenuButtonList
|
|
||||||
//before calling the onOpen() for JoinServerMenu then displaying.
|
|
||||||
MainMenuGui.pushPage(JoinServerMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openOptionsMenu()
|
|
||||||
{
|
|
||||||
//Here, like the other commands, we add a new page onto the stack
|
|
||||||
//In this case, we'll push the OptionsMenu control onto the stack. This will
|
|
||||||
//invoke the canClose() and then onClose() functions for MainMenuButtonList
|
|
||||||
//before calling the onOpen() for OptionsMenu then displaying.
|
|
||||||
//The options menu additionally has an example of why we may want to capitalize on the
|
|
||||||
//canClose() call.
|
|
||||||
MainMenuGui.pushPage(OptionsMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openWorldEditorBtn()
|
|
||||||
{
|
|
||||||
fastLoadWorldEdit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openGUIEditorBtn()
|
|
||||||
{
|
|
||||||
fastLoadGUIEdit(1);
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="PauseMenu"
|
|
||||||
scriptFile="@assetFile=pauseMenu"
|
|
||||||
GUIFile="@assetFile=pauseMenu.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -1,230 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(recordingsDlg) {
|
|
||||||
position = "0 0";
|
|
||||||
extent = "1024 768";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
helpTag = "0";
|
|
||||||
|
|
||||||
new GuiWindowCtrl() {
|
|
||||||
text = "Demo Recordings";
|
|
||||||
resizeWidth = "0";
|
|
||||||
resizeHeight = "0";
|
|
||||||
canMove = "1";
|
|
||||||
canClose = "1";
|
|
||||||
canMinimize = "0";
|
|
||||||
canMaximize = "0";
|
|
||||||
canCollapse = "0";
|
|
||||||
closeCommand = "Canvas.popDialog(recordingsDlg);";
|
|
||||||
edgeSnap = "1";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "247 215";
|
|
||||||
extent = "530 338";
|
|
||||||
minExtent = "48 92";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiWindowProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiScrollCtrl() {
|
|
||||||
willFirstRespond = "1";
|
|
||||||
hScrollBar = "dynamic";
|
|
||||||
vScrollBar = "alwaysOn";
|
|
||||||
lockHorizScroll = "0";
|
|
||||||
lockVertScroll = "0";
|
|
||||||
constantThumbHeight = "0";
|
|
||||||
childMargin = "0 0";
|
|
||||||
mouseWheelScrollSpeed = "-1";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "23 60";
|
|
||||||
extent = "484 237";
|
|
||||||
minExtent = "32 32";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiScrollProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiTextListCtrl(RecordingsDlgList) {
|
|
||||||
columns = "0";
|
|
||||||
fitParentWidth = "1";
|
|
||||||
clipColumnText = "0";
|
|
||||||
position = "1 1";
|
|
||||||
extent = "469 32";
|
|
||||||
minExtent = "8 20";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiTextArrayProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(DR_CancelBtn) {
|
|
||||||
text = "Cancel";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "396 306";
|
|
||||||
extent = "110 20";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "Canvas.popDialog(recordingsDlg);";
|
|
||||||
accelerator = "escape";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(DR_StartDemoBtn) {
|
|
||||||
text = "Play";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "25 305";
|
|
||||||
extent = "110 20";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "StartSelectedDemo();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "During gameplay press the following keys:";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "23 30";
|
|
||||||
extent = "206 18";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiTextProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Start = F3";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "253 32";
|
|
||||||
extent = "50 15";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiTextProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Stop = F4";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "320 32";
|
|
||||||
extent = "49 13";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiTextProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(DR_DelDemoBtn) {
|
|
||||||
text = "Delete";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "210 305";
|
|
||||||
extent = "110 20";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "deleteDemoRecord();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<GUIAsset
|
||||||
|
AssetName="SystemMenu"
|
||||||
|
ScriptFile="@assetFile=SystemMenu.tscript"
|
||||||
|
GUIFile="@assetFile=SystemMenu.gui"
|
||||||
|
VersionId="1"/>
|
||||||
60
Templates/BaseGame/game/data/UI/guis/SystemMenu.gui
Normal file
60
Templates/BaseGame/game/data/UI/guis/SystemMenu.gui
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
//--- OBJECT WRITE BEGIN ---
|
||||||
|
$guiContent = new GuiControl(SystemMenu) {
|
||||||
|
extent = "1280 720";
|
||||||
|
profile = "GuiNonModalDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
|
||||||
|
new GuiStackControl(SystemMenuButtonList) {
|
||||||
|
padding = "5";
|
||||||
|
dynamicSize = "0";
|
||||||
|
position = "440 263";
|
||||||
|
extent = "400 189";
|
||||||
|
horizSizing = "center";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Return to Game";
|
||||||
|
extent = "400 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "Canvas.popDialog(GameMenu);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
groupNum = "1";
|
||||||
|
class = "SystemMenuButton";
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Options";
|
||||||
|
position = "0 45";
|
||||||
|
extent = "400 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "Canvas.pushDialog(OptionsMenu);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
groupNum = "1";
|
||||||
|
class = "SystemMenuButton";
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Exit to Menu";
|
||||||
|
position = "0 90";
|
||||||
|
extent = "400 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "systemMenuExitToMenu();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
groupNum = "1";
|
||||||
|
class = "SystemMenuButton";
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
text = "Exit to Desktop";
|
||||||
|
position = "0 135";
|
||||||
|
extent = "400 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "systemMenuExitToDesktop();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
groupNum = "1";
|
||||||
|
class = "SystemMenuButton";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//--- OBJECT WRITE END ---
|
||||||
43
Templates/BaseGame/game/data/UI/guis/SystemMenu.tscript
Normal file
43
Templates/BaseGame/game/data/UI/guis/SystemMenu.tscript
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
function SystemMenu::onWake(%this)
|
||||||
|
{
|
||||||
|
$MenuList = SystemMenuButtonList;
|
||||||
|
$MenuList.listPosition = 0;
|
||||||
|
|
||||||
|
$MenuList.syncGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
function SystemMenu::onSleep(%this)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function systemMenuExitToMenu()
|
||||||
|
{
|
||||||
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function systemMenuExitToDesktop()
|
||||||
|
{
|
||||||
|
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function SystemMenuButton::onHighlighted(%this, %highlighted)
|
||||||
|
{
|
||||||
|
if(%highlighted)
|
||||||
|
$MenuList.listPosition = $MenuList.getObjectIndex(%this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SystemMenuButtonList::syncGUI(%this)
|
||||||
|
{
|
||||||
|
%btn = %this.getObject(%this.listPosition);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
//
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
//We'll call back to the GameMenu parent just to be sure everything's on the same page
|
||||||
|
GameMenu.syncGui();
|
||||||
|
}
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(ChooseLevelDlg) {
|
|
||||||
extent = "1024 768";
|
|
||||||
minExtent = "8 8";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiNonModalDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
Enabled = "1";
|
|
||||||
launchInEditor = "0";
|
|
||||||
returnGui = "MainMenuGui";
|
|
||||||
|
|
||||||
new GuiControl(ChooseLevelWindow) {
|
|
||||||
position = "48 56";
|
|
||||||
extent = "928 655";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
|
|
||||||
new GuiBitmapBarCtrl() {
|
|
||||||
BitmapAsset = "UI:panel_image";
|
|
||||||
extent = "927 40";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl(LevelSelectTitle) {
|
|
||||||
text = "SINGLE PLAYER";
|
|
||||||
position = "22 10";
|
|
||||||
extent = "307 28";
|
|
||||||
profile = "MenuHeaderText";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiBitmapBarCtrl() {
|
|
||||||
BitmapAsset = "UI:panel_low_image";
|
|
||||||
position = "0 40";
|
|
||||||
extent = "927 618";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiBitmapCtrl() {
|
|
||||||
BitmapAsset = "Core_Rendering:missingTexture_image";
|
|
||||||
position = "513 71";
|
|
||||||
extent = "400 300";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "CurrentPreview";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
Enabled = "1";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Example Level";
|
|
||||||
maxLength = "255";
|
|
||||||
position = "514 375";
|
|
||||||
extent = "398 27";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "MenuHeaderText";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "LevelName";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Description:";
|
|
||||||
maxLength = "255";
|
|
||||||
position = "522 410";
|
|
||||||
extent = "91 18";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "MenuSubHeaderText";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "LevelDescriptionLabel";
|
|
||||||
};
|
|
||||||
new GuiMLTextCtrl() {
|
|
||||||
text = "This is placeholder text";
|
|
||||||
position = "522 436";
|
|
||||||
extent = "391 14";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "GuiMLWhiteTextProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "LevelDescription";
|
|
||||||
};
|
|
||||||
new GuiScrollCtrl() {
|
|
||||||
hScrollBar = "dynamic";
|
|
||||||
vScrollBar = "dynamic";
|
|
||||||
position = "0 40";
|
|
||||||
extent = "450 580";
|
|
||||||
profile = "GuiMenuScrollProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
|
|
||||||
new GuiGameListMenuCtrl(LevelList) {
|
|
||||||
callbackOnInputs = "1";
|
|
||||||
position = "1 1";
|
|
||||||
extent = "450 90";
|
|
||||||
profile = "DefaultListMenuProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
class = "UIMenuButtonList";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,210 +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 ChooseLevelDlg::onWake( %this )
|
|
||||||
{
|
|
||||||
if(!isObject(LevelListEntries))
|
|
||||||
new ArrayObject(LevelListEntries){};
|
|
||||||
|
|
||||||
if(!isObject(ChooseLevelAssetQuery))
|
|
||||||
new AssetQuery(ChooseLevelAssetQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChooseLevelDlg::onOpen(%this)
|
|
||||||
{
|
|
||||||
LevelList.clearRows();
|
|
||||||
LevelListEntries.empty();
|
|
||||||
|
|
||||||
ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image");
|
|
||||||
ChooseLevelWindow->LevelDescriptionLabel.visible = false;
|
|
||||||
ChooseLevelWindow->LevelDescription.visible = false;
|
|
||||||
|
|
||||||
ChooseLevelAssetQuery.clear();
|
|
||||||
AssetDatabase.findAssetType(ChooseLevelAssetQuery, "LevelAsset");
|
|
||||||
|
|
||||||
%count = ChooseLevelAssetQuery.getCount();
|
|
||||||
|
|
||||||
if(%count == 0 && !IsDirectory("tools"))
|
|
||||||
{
|
|
||||||
//We have no levels found. Prompt the user to open the editor to the default level if the tools are present
|
|
||||||
MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.",
|
|
||||||
"Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();");
|
|
||||||
|
|
||||||
ChooseLevelAssetQuery.delete();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(%i=0; %i < %count; %i++)
|
|
||||||
{
|
|
||||||
%assetId = ChooseLevelAssetQuery.getAsset(%i);
|
|
||||||
|
|
||||||
if(AssetDatabase.getAssetModule(%assetId).ModuleId $= "ToolsModule")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
%levelAsset = AssetDatabase.acquireAsset(%assetId);
|
|
||||||
|
|
||||||
%file = %levelAsset.getLevelPath();
|
|
||||||
|
|
||||||
if ( !isFile(%file @ ".mis") && !isFile(%file @ ".mis.dso") &&!isFile(%file) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Skip our new level/mission if we arent choosing a level
|
|
||||||
// to launch in the editor.
|
|
||||||
if ( !%this.launchInEditor )
|
|
||||||
{
|
|
||||||
%fileName = fileName(%file);
|
|
||||||
if (strstr(%fileName, "newMission.mis") > -1 || strstr(%fileName, "newLevel.mis") > -1)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
%this.addLevelAsset( %levelAsset );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also add the new level mission as defined in the world editor settings
|
|
||||||
// if we are choosing a level to launch in the editor.
|
|
||||||
if ( %this.launchInEditor )
|
|
||||||
{
|
|
||||||
%this.addMissionFile( "tools/levels/DefaultEditorLevel.mis" );
|
|
||||||
}
|
|
||||||
|
|
||||||
for(%i=0; %i < LevelListEntries.count(); %i++)
|
|
||||||
{
|
|
||||||
%levelAsset = LevelListEntries.getKey(%i);
|
|
||||||
|
|
||||||
LevelList.addRow(%levelAsset.LevelName, "", -1, -30);
|
|
||||||
}
|
|
||||||
|
|
||||||
LevelList.setSelected(0);
|
|
||||||
LevelList.onChange();
|
|
||||||
|
|
||||||
if(!$pref::HostMultiPlayer)
|
|
||||||
LevelSelectTitle.setText("SINGLE PLAYER");
|
|
||||||
else
|
|
||||||
LevelSelectTitle.setText("CREATE SERVER");
|
|
||||||
|
|
||||||
$activeMenuButtonContainer-->button1.disable();
|
|
||||||
$activeMenuButtonContainer-->button2.disable();
|
|
||||||
$activeMenuButtonContainer-->button3.disable();
|
|
||||||
$activeMenuButtonContainer-->button4.set("btn_a", "Return", "Start Level", "ChooseLevelDlg.beginLevel();");
|
|
||||||
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", %this @ ".navigation.popPage();");
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChooseLevelDlg::onSleep( %this )
|
|
||||||
{
|
|
||||||
// This is set from the outside, only stays true for a single wake/sleep
|
|
||||||
// cycle.
|
|
||||||
%this.launchInEditor = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChooseLevelDlg::addMissionFile( %this, %file )
|
|
||||||
{
|
|
||||||
%levelName = fileBase(%file);
|
|
||||||
%levelDesc = "A Torque level";
|
|
||||||
|
|
||||||
%LevelInfoObject = getLevelInfo(%file);
|
|
||||||
|
|
||||||
if (%LevelInfoObject != 0)
|
|
||||||
{
|
|
||||||
if(%LevelInfoObject.levelName !$= "")
|
|
||||||
%levelName = %LevelInfoObject.levelName;
|
|
||||||
else if(%LevelInfoObject.name !$= "")
|
|
||||||
%levelName = %LevelInfoObject.name;
|
|
||||||
|
|
||||||
if (%LevelInfoObject.desc0 !$= "")
|
|
||||||
%levelDesc = %LevelInfoObject.desc0;
|
|
||||||
|
|
||||||
if (%LevelInfoObject.preview !$= "")
|
|
||||||
%levelPreview = %LevelInfoObject.preview;
|
|
||||||
|
|
||||||
%LevelInfoObject.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
LevelListEntries.add( %levelName TAB %file TAB %levelDesc TAB %levelPreview );
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChooseLevelDlg::addLevelAsset( %this, %levelAsset )
|
|
||||||
{
|
|
||||||
LevelListEntries.add( %levelAsset );
|
|
||||||
}
|
|
||||||
|
|
||||||
function LevelList::onChange(%this)
|
|
||||||
{
|
|
||||||
%index = %this.getSelectedRow();
|
|
||||||
|
|
||||||
%levelAsset = LevelListEntries.getKey(%index);
|
|
||||||
|
|
||||||
// Get the name
|
|
||||||
ChooseLevelWindow->LevelName.text = %levelAsset.LevelName;
|
|
||||||
|
|
||||||
// Get the level id
|
|
||||||
$selectedLevelAsset = %levelAsset.getAssetId();
|
|
||||||
|
|
||||||
// Find the preview image
|
|
||||||
%levelPreview = %levelAsset.getPreviewImagePath();
|
|
||||||
|
|
||||||
// Test against all of the different image formats
|
|
||||||
// This should probably be moved into an engine function
|
|
||||||
if (isFile(%levelPreview))
|
|
||||||
ChooseLevelWindow->CurrentPreview.setBitmap(%levelPreview);
|
|
||||||
else
|
|
||||||
ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image");
|
|
||||||
|
|
||||||
// Get the description
|
|
||||||
%levelDesc = %levelAsset.description;
|
|
||||||
|
|
||||||
if(%levelDesc !$= "")
|
|
||||||
{
|
|
||||||
ChooseLevelWindow->LevelDescriptionLabel.setVisible(true);
|
|
||||||
ChooseLevelWindow->LevelDescription.setVisible(true);
|
|
||||||
ChooseLevelWindow->LevelDescription.setText(%levelDesc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChooseLevelWindow->LevelDescriptionLabel.setVisible(false);
|
|
||||||
ChooseLevelWindow->LevelDescription.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do this onMouseUp not via Command which occurs onMouseDown so we do
|
|
||||||
// not have a lingering mouseUp event lingering in the ether.
|
|
||||||
function ChooseLevelDlg::beginLevel(%this)
|
|
||||||
{
|
|
||||||
// So we can't fire the button when loading is in progress.
|
|
||||||
if ( isObject( ServerGroup ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
%this.navigation.popPage();
|
|
||||||
|
|
||||||
// Launch the chosen level with the editor open?
|
|
||||||
if ( ChooseLevelDlg.launchInEditor )
|
|
||||||
{
|
|
||||||
activatePackage( "BootEditor" );
|
|
||||||
ChooseLevelDlg.launchInEditor = false;
|
|
||||||
StartGame("", "SinglePlayer");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StartGame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(GuiMusicPlayer) {
|
|
||||||
isContainer = "1";
|
|
||||||
Profile = "GuiWindowProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "0 0";
|
|
||||||
Extent = "1024 768";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
superClass = "GuiMusicPlayerClass";
|
|
||||||
|
|
||||||
new GuiWindowCtrl() {
|
|
||||||
resizeWidth = "0";
|
|
||||||
resizeHeight = "0";
|
|
||||||
canMove = "1";
|
|
||||||
canClose = "1";
|
|
||||||
canMinimize = "1";
|
|
||||||
canMaximize = "1";
|
|
||||||
minSize = "50 50";
|
|
||||||
EdgeSnap = "1";
|
|
||||||
text = "Torque Music Player";
|
|
||||||
Margin = "0 0 0 0";
|
|
||||||
Padding = "0 0 0 0";
|
|
||||||
AnchorTop = "1";
|
|
||||||
AnchorBottom = "0";
|
|
||||||
AnchorLeft = "1";
|
|
||||||
AnchorRight = "0";
|
|
||||||
isContainer = "1";
|
|
||||||
Profile = "GuiWindowProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "29 35";
|
|
||||||
Extent = "518 377";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
closeCommand = "toggleMusicPlayer();";
|
|
||||||
|
|
||||||
new GuiCheckBoxCtrl(GuiMusicPlayerFadeCheckBox) {
|
|
||||||
useInactiveState = "0";
|
|
||||||
text = "Fade";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "ToggleButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiCheckBoxProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "457 347";
|
|
||||||
Extent = "53 30";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiCheckBoxCtrl(GuiMusicPlayerLoopCheckBox) {
|
|
||||||
useInactiveState = "0";
|
|
||||||
text = "Loop";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "ToggleButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiCheckBoxProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "457 330";
|
|
||||||
Extent = "44 30";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiScrollCtrl() {
|
|
||||||
willFirstRespond = "1";
|
|
||||||
hScrollBar = "dynamic";
|
|
||||||
vScrollBar = "alwaysOn";
|
|
||||||
lockHorizScroll = "0";
|
|
||||||
lockVertScroll = "0";
|
|
||||||
constantThumbHeight = "0";
|
|
||||||
childMargin = "0 0";
|
|
||||||
mouseWheelScrollSpeed = "-1";
|
|
||||||
Margin = "0 0 0 0";
|
|
||||||
Padding = "0 0 0 0";
|
|
||||||
AnchorTop = "1";
|
|
||||||
AnchorBottom = "0";
|
|
||||||
AnchorLeft = "1";
|
|
||||||
AnchorRight = "0";
|
|
||||||
isContainer = "1";
|
|
||||||
Profile = "GuiScrollProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "9 31";
|
|
||||||
Extent = "500 298";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiListBoxCtrl(GuiMusicPlayerMusicList) {
|
|
||||||
AllowMultipleSelections = "1";
|
|
||||||
fitParentWidth = "1";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiListBoxProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "1 1";
|
|
||||||
Extent = "485 2";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
superClass = "GuiMusicPlayerMusicListClass";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiSliderCtrl(GuiMusicPlayerScrubber) {
|
|
||||||
range = "0 1";
|
|
||||||
ticks = "10";
|
|
||||||
value = "0";
|
|
||||||
snap = "false";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiSliderProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "114 343";
|
|
||||||
Extent = "331 23";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
Command = "$thisControl.onDragComplete();";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
class = "GuiMusicPlayerScrubberClass";
|
|
||||||
className = "GuiMusicPlayerScrubberClass";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(GuiMusicPlayerStopButton) {
|
|
||||||
text = "Stop";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiButtonProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "57 338";
|
|
||||||
Extent = "40 30";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
Command = "GuiMusicPlayer.stop();";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl(GuiMusicPlayerPlayButton) {
|
|
||||||
text = "Play";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
isContainer = "0";
|
|
||||||
Profile = "GuiButtonProfile";
|
|
||||||
HorizSizing = "right";
|
|
||||||
VertSizing = "bottom";
|
|
||||||
position = "13 338";
|
|
||||||
Extent = "40 30";
|
|
||||||
MinExtent = "8 2";
|
|
||||||
canSave = "1";
|
|
||||||
Visible = "1";
|
|
||||||
Command = "GuiMusicPlayer.play();";
|
|
||||||
tooltipprofile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,236 +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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// A very simple music player.
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// Preferences.
|
|
||||||
|
|
||||||
$pref::GuiMusicPlayer::filePattern = "*.ogg\t*.wav";
|
|
||||||
$pref::GuiMusicPlayer::fadeTime = "3.0";
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// Datablocks.
|
|
||||||
|
|
||||||
singleton SFXDescription( GuiMusicPlayerStream : AudioMusic2D )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
isLooping = false;
|
|
||||||
isStreaming = true;
|
|
||||||
is3D = false;
|
|
||||||
};
|
|
||||||
singleton SFXDescription( GuiMusicPlayerLoopingStream : AudioMusic2D )
|
|
||||||
{
|
|
||||||
volume = 1.0;
|
|
||||||
isLooping = true;
|
|
||||||
isStreaming = true;
|
|
||||||
is3D = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// Functions.
|
|
||||||
|
|
||||||
function toggleMusicPlayer()
|
|
||||||
{
|
|
||||||
if( !GuiMusicPlayer.isAwake() )
|
|
||||||
{
|
|
||||||
GuiMusicPlayer.setExtent( Canvas.getExtent() );
|
|
||||||
GuiMusicPlayer.setPosition( 0, 0 );
|
|
||||||
|
|
||||||
Canvas.pushDialog( GuiMusicPlayer );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Canvas.popDialog( GuiMusicPlayer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------
|
|
||||||
// Methods.
|
|
||||||
|
|
||||||
function GuiMusicPlayer_onSFXSourceStatusChange( %id, %status )
|
|
||||||
{
|
|
||||||
if( %status $= "Stopped" )
|
|
||||||
GuiMusicPlayer.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerClass::play( %this )
|
|
||||||
{
|
|
||||||
if( %this.status $= "Stopped"
|
|
||||||
|| %this.status $= "Paused"
|
|
||||||
|| %this.status $= "" )
|
|
||||||
{
|
|
||||||
%isPlaying = true;
|
|
||||||
if( %this.status $= "Paused" && isObject( %this.sfxSource ) )
|
|
||||||
%this.sfxSource.play();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%sel = GuiMusicPlayerMusicList.getSelectedItem();
|
|
||||||
if( %sel == -1 )
|
|
||||||
%isPlaying = false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%desc = GuiMusicPlayerStream;
|
|
||||||
if( GuiMusicPlayerLoopCheckBox.getValue() )
|
|
||||||
%desc = GuiMusicPlayerLoopingStream;
|
|
||||||
|
|
||||||
if( GuiMusicPlayerFadeCheckBox.getValue() )
|
|
||||||
{
|
|
||||||
%desc.fadeInTime = $pref::GuiMusicPlayer::fadeTime;
|
|
||||||
%desc.fadeOutTime = $pref::GuiMusicPlayer::fadeTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%desc.fadeInTime = 0;
|
|
||||||
%desc.fadeOutTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
%file = GuiMusicPlayerMusicList.getItemText( %sel );
|
|
||||||
%this.sfxSource = sfxPlayOnce( %desc, %file );
|
|
||||||
if( !%this.sfxSource )
|
|
||||||
%isPlaying = false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
%this.sfxSource.statusCallback = "GuiMusicPlayer_onSFXSourceStatusChange";
|
|
||||||
GuiMusicPlayer.status = "Playing";
|
|
||||||
|
|
||||||
GuiMusicPlayerScrubber.setActive( true );
|
|
||||||
GuiMusicPlayerScrubber.setup( %this.sfxSource.getDuration() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( %isPlaying )
|
|
||||||
{
|
|
||||||
GuiMusicPlayerPlayButton.setText( "Pause" );
|
|
||||||
GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.pause();";
|
|
||||||
GuiMusicPlayerLoopCheckBox.setActive( false );
|
|
||||||
GuiMusicPlayerFadeCheckBox.setActive( false );
|
|
||||||
%this.status = "Playing";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerClass::stop( %this )
|
|
||||||
{
|
|
||||||
if( %this.status $= "Playing"
|
|
||||||
|| %this.status $= "Paused" )
|
|
||||||
{
|
|
||||||
if( isObject( %this.sfxSource ) )
|
|
||||||
%this.sfxSource.stop( 0 ); // Stop immediately.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerClass::onStop( %this )
|
|
||||||
{
|
|
||||||
%this.sfxSource = 0;
|
|
||||||
|
|
||||||
GuiMusicPlayerLoopCheckBox.setActive( true );
|
|
||||||
GuiMusicPlayerFadeCheckBox.setActive( true );
|
|
||||||
GuiMusicPlayerScrubber.setActive( false );
|
|
||||||
GuiMusicPlayerPlayButton.setText( "Play" );
|
|
||||||
GuiMusicPlayerPlayButton.Command = "GuiMusicPlayer.play();";
|
|
||||||
%this.status = "Stopped";
|
|
||||||
|
|
||||||
GuiMusicPlayerScrubber.setValue( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerClass::pause( %this )
|
|
||||||
{
|
|
||||||
if( %this.status $= "Playing" )
|
|
||||||
{
|
|
||||||
if( isObject( %this.sfxSource ) )
|
|
||||||
%this.sfxSource.pause( 0 );
|
|
||||||
|
|
||||||
GuiMusicPlayerPlayButton.setText( "Play" );
|
|
||||||
GuiMusicPlayerPlayButton.command = "GuiMusicPlayer.play();";
|
|
||||||
%this.status = "Paused";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerClass::seek( %this, %playtime )
|
|
||||||
{
|
|
||||||
if( ( %this.status $= "Playing"
|
|
||||||
|| %this.status $= "Paused" )
|
|
||||||
&& isObject( %this.sfxSource ) )
|
|
||||||
%this.sfxSource.setPosition( %playtime );
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayer::onWake( %this )
|
|
||||||
{
|
|
||||||
GuiMusicPlayerMusicList.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerMusicListClass::load( %this )
|
|
||||||
{
|
|
||||||
// Remove all the files currently in the list.
|
|
||||||
|
|
||||||
%this.clearItems();
|
|
||||||
|
|
||||||
// Find the file matching pattern we should use.
|
|
||||||
|
|
||||||
%filePattern = $pref::GuiMusicPlayer::filePattern;
|
|
||||||
%sfxProvider = getWord( sfxGetDeviceInfo(), 0 );
|
|
||||||
%filePatternVarName = "$pref::GuiMusicPlayer::filePattern" @ %sfxProvider;
|
|
||||||
if( isDefined( %filePatternVarName ) )
|
|
||||||
eval( "%filePattern = " @ %filePatternVarName @ ";" );
|
|
||||||
|
|
||||||
// Find all files matching the pattern.
|
|
||||||
|
|
||||||
for( %file = findFirstFileMultiExpr( %filePattern );
|
|
||||||
%file !$= "";
|
|
||||||
%file = findNextFileMultiExpr( %filePattern ) )
|
|
||||||
%this.addItem( makeRelativePath( %file, getMainDotCsDir() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerMusicList::onDoubleClick( %this )
|
|
||||||
{
|
|
||||||
GuiMusicPlayer.stop();
|
|
||||||
GuiMusicPlayer.play();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerScrubber::onMouseDragged( %this )
|
|
||||||
{
|
|
||||||
%this.isBeingDragged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerScrubberClass::setup( %this, %totalPlaytime )
|
|
||||||
{
|
|
||||||
%this.range = "0 " @ %totalPlaytime;
|
|
||||||
%this.ticks = %totalPlaytime / 5; // One tick per five seconds.
|
|
||||||
|
|
||||||
%this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerScrubberClass::update( %this )
|
|
||||||
{
|
|
||||||
if( GuiMusicPlayer.status $= "Playing"
|
|
||||||
&& !%this.isBeingDragged )
|
|
||||||
%this.setValue( GuiMusicPlayer.sfxSource.getPosition() );
|
|
||||||
|
|
||||||
if( GuiMusicPlayer.status $= "Playing"
|
|
||||||
|| GuiMusicPlayer.status $= "Paused" )
|
|
||||||
%this.schedule( 5, "update" );
|
|
||||||
}
|
|
||||||
|
|
||||||
function GuiMusicPlayerScrubberClass::onDragComplete( %this )
|
|
||||||
{
|
|
||||||
GuiMusicPlayer.seek( %this.getValue() );
|
|
||||||
%this.isBeingDragged = false;
|
|
||||||
}
|
|
||||||
|
|
@ -1,109 +1,130 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiControl(JoinServerMenu) {
|
$guiContent = new GuiControl(JoinServerMenu) {
|
||||||
extent = "1024 768";
|
extent = "1280 720";
|
||||||
profile = "GuiNonModalDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
canSaveDynamicFields = "0";
|
profile = "GuiMenuBackgroundProfile";
|
||||||
|
|
||||||
new GuiControl(JoinServerWindow) {
|
|
||||||
position = "48 56";
|
|
||||||
extent = "928 655";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
|
canSaveDynamicFields = "1";
|
||||||
|
|
||||||
new GuiBitmapBarCtrl() {
|
new GuiInputCtrl(JoinServerInputHandler) {
|
||||||
BitmapAsset = "UI:panel_image";
|
ignoreMouseEvents = "1";
|
||||||
extent = "927 40";
|
ActionMap = "JoinServerActionMap";
|
||||||
|
position = "-50 0";
|
||||||
|
extent = "50 50";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiDefaultProfile";
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
|
new GuiPanel(JoinServerTitlePanel) {
|
||||||
|
extent = "1281 60";
|
||||||
|
horizSizing = "width";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
new GuiTextCtrl() {
|
new GuiTextCtrl() {
|
||||||
text = "JOIN SERVER";
|
text = "JOIN SERVER";
|
||||||
position = "22 10";
|
position = "22 23";
|
||||||
extent = "207 28";
|
extent = "1281 28";
|
||||||
profile = "MenuHeaderText";
|
profile = "MenuHeaderText";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiBitmapBarCtrl() {
|
};
|
||||||
BitmapAsset = "UI:panel_low_image";
|
new GuiContainer() {
|
||||||
position = "0 40";
|
position = "190 61";
|
||||||
extent = "927 618";
|
extent = "900 30";
|
||||||
horizSizing = "width";
|
horizSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Player Name";
|
||||||
|
position = "0 5";
|
||||||
|
extent = "98 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl(JS_status) {
|
new GuiTextEditCtrl(JoinServerPlayerNameTxt) {
|
||||||
text = "No servers found.";
|
text = "Visitor";
|
||||||
maxLength = "255";
|
position = "606 7";
|
||||||
position = "392 47";
|
extent = "295 22";
|
||||||
extent = "148 18";
|
horizSizing = "left";
|
||||||
minExtent = "8 8";
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$pref::Player::Name";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "190 87";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Password";
|
||||||
|
position = "0 5";
|
||||||
|
extent = "78 23";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuMLSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiTextEditCtrl(JoinServerPasswordTxt) {
|
||||||
|
text = "Visitor";
|
||||||
|
position = "606 7";
|
||||||
|
extent = "295 22";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuTextEditprofile";
|
||||||
|
variable = "$Client::Password";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiContainer() {
|
||||||
|
position = "190 121";
|
||||||
|
extent = "900 30";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "Server Details";
|
||||||
|
extent = "700 30";
|
||||||
|
vertSizing = "center";
|
||||||
profile = "MenuSubHeaderText";
|
profile = "MenuSubHeaderText";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Players";
|
|
||||||
maxLength = "255";
|
|
||||||
position = "269 67";
|
|
||||||
extent = "36 18";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "GuiMLWhiteTextProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Version";
|
|
||||||
maxLength = "255";
|
|
||||||
position = "335 67";
|
|
||||||
extent = "38 18";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "GuiMLWhiteTextProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "Game";
|
|
||||||
maxLength = "255";
|
|
||||||
position = "412 67";
|
|
||||||
extent = "28 18";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "GuiMLWhiteTextProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "0";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
new GuiTextCtrl() {
|
||||||
text = "Ping";
|
text = "Ping";
|
||||||
maxLength = "255";
|
position = "700 0";
|
||||||
position = "212 67";
|
extent = "70 30";
|
||||||
extent = "20 18";
|
horizSizing = "left";
|
||||||
minExtent = "8 8";
|
vertSizing = "center";
|
||||||
profile = "GuiMLWhiteTextProfile";
|
profile = "MenuSubHeaderCenteredText";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "0";
|
|
||||||
};
|
};
|
||||||
new GuiTextCtrl() {
|
new GuiTextCtrl() {
|
||||||
text = "Server Name";
|
text = "Player Count";
|
||||||
maxLength = "255";
|
position = "770 0";
|
||||||
position = "12 67";
|
extent = "130 30";
|
||||||
extent = "63 18";
|
horizSizing = "left";
|
||||||
minExtent = "8 8";
|
vertSizing = "center";
|
||||||
profile = "GuiMLWhiteTextProfile";
|
profile = "MenuSubHeaderCenteredText";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "0";
|
};
|
||||||
};
|
};
|
||||||
new GuiScrollCtrl() {
|
new GuiScrollCtrl() {
|
||||||
hScrollBar = "dynamic";
|
hScrollBar = "alwaysOff";
|
||||||
vScrollBar = "dynamic";
|
vScrollBar = "dynamic";
|
||||||
position = "19 98";
|
position = "190 151";
|
||||||
extent = "890 501";
|
extent = "900 532";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
|
horizSizing = "center";
|
||||||
|
vertSizing = "height";
|
||||||
profile = "GuiMenuScrollProfile";
|
profile = "GuiMenuScrollProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
|
@ -114,46 +135,73 @@ $guiContent = new GuiControl(JoinServerMenu) {
|
||||||
extent = "888 16";
|
extent = "888 16";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiMenuDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
superClass = "MenuList";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiControl(JS_queryStatus) {
|
new GuiPanel(JoinServerButtonPanel) {
|
||||||
position = "16 615";
|
position = "0 683";
|
||||||
extent = "900 35";
|
extent = "1281 40";
|
||||||
profile = "GuiDefaultProfile";
|
horizSizing = "width";
|
||||||
visible = "0";
|
vertSizing = "top";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
|
||||||
hidden = "1";
|
|
||||||
|
|
||||||
new GuiProgressCtrl(JS_statusBar) {
|
new GuiIconButtonCtrl(JoinServerJoinBtn) {
|
||||||
position = "84 0";
|
BitmapAsset = "UI:Keyboard_Black_Space_image";
|
||||||
extent = "695 35";
|
sizeIconToButton = "1";
|
||||||
minExtent = "8 8";
|
makeIconSquare = "1";
|
||||||
profile = "GuiProgressProfile";
|
textLocation = "Center";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
text = "Join";
|
||||||
isContainer = "0";
|
position = "1115 0";
|
||||||
};
|
extent = "140 40";
|
||||||
new GuiButtonCtrl(JS_cancelQuery) {
|
horizSizing = "left";
|
||||||
text = "Cancel!";
|
vertSizing = "center";
|
||||||
extent = "84 35";
|
|
||||||
minExtent = "8 8";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "JoinServerDlg.cancel();";
|
active = "0";
|
||||||
|
command = "JoinServerMenu.join();";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl(JS_statusText) {
|
new GuiIconButtonCtrl(JoinServerQLanBtn) {
|
||||||
text = "Querying master server";
|
BitmapAsset = "UI:Keyboard_Black_E_image";
|
||||||
maxLength = "255";
|
sizeIconToButton = "1";
|
||||||
position = "84 0";
|
makeIconSquare = "1";
|
||||||
extent = "695 35";
|
textLocation = "Center";
|
||||||
minExtent = "8 8";
|
text = "Query Lan";
|
||||||
|
position = "965 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "JoinServerMenu.queryLan();";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "0";
|
|
||||||
};
|
};
|
||||||
|
new GuiIconButtonCtrl(JoinServerQServerBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Q_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Query Server";
|
||||||
|
position = "800 0";
|
||||||
|
extent = "160 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "JoinServerMenu.query();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(JoinServerBackBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Escape_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Back";
|
||||||
|
position = "16 0";
|
||||||
|
extent = "140 40";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "Canvas.popDialog();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,41 @@
|
||||||
|
|
||||||
function JoinServerMenu::onWake(%this)
|
function JoinServerMenu::onWake(%this)
|
||||||
{
|
{
|
||||||
|
$MenuList = JoinServerList;
|
||||||
|
$MenuList.clear();
|
||||||
|
$Client::Password = "";
|
||||||
|
JoinServerList.listPosition = 0;
|
||||||
|
|
||||||
|
JoinServerList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
function JoinServerMenu::onOpen(%this)
|
function JoinServerMenu::onSleep(%this)
|
||||||
{
|
{
|
||||||
JoinServerList.setAsActiveMenuList();
|
echo("Exporting client prefs");
|
||||||
|
%prefPath = getPrefpath();
|
||||||
|
export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
|
||||||
|
}
|
||||||
|
|
||||||
$activeMenuButtonContainer-->button1.set("btn_y", "R", "Refresh", "JoinServerMenu.refresh();");
|
if(!isObject( JoinServerActionMap ) )
|
||||||
$activeMenuButtonContainer-->button2.set("btn_a", "Q", "Query LAN", "JoinServerMenu.queryLan();");
|
{
|
||||||
$activeMenuButtonContainer-->button3.set("btn_x", "E", "Query Online", "JoinServerMenu.query();");
|
new ActionMap(JoinServerActionMap){};
|
||||||
$activeMenuButtonContainer-->button4.set("btn_start", "Return", "Join", "JoinServerMenu.join();");
|
|
||||||
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "cancelServerQuery(); " @ %this @ ".navigation.popPage();");
|
JoinServerActionMap.bindCmd( keyboard, q, "JoinServerMenu.query();" );
|
||||||
|
JoinServerActionMap.bindCmd( gamepad, btn_x, "JoinServerMenu.query();" );
|
||||||
|
|
||||||
|
JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" );
|
||||||
|
JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" );
|
||||||
|
|
||||||
|
JoinServerActionMap.bindCmd( keyboard, Space, "JoinServerMenu::join();" );
|
||||||
|
JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
function JoinServerMenu::query(%this)
|
function JoinServerMenu::query(%this)
|
||||||
{
|
{
|
||||||
|
//Nuke the current list and indicate we're working on a query...
|
||||||
|
JoinServerList.clear();
|
||||||
|
|
||||||
queryMasterServer(
|
queryMasterServer(
|
||||||
0, // Query flags
|
0, // Query flags
|
||||||
$Client::GameTypeQuery, // gameTypes
|
$Client::GameTypeQuery, // gameTypes
|
||||||
|
|
@ -34,6 +53,9 @@ function JoinServerMenu::query(%this)
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
function JoinServerMenu::queryLan(%this)
|
function JoinServerMenu::queryLan(%this)
|
||||||
{
|
{
|
||||||
|
//Nuke the current list and indicate we're working on a query...
|
||||||
|
JoinServerList.clear();
|
||||||
|
|
||||||
queryLANServers(
|
queryLANServers(
|
||||||
$pref::Net::Port, // lanPort for local queries
|
$pref::Net::Port, // lanPort for local queries
|
||||||
0, // Query flags
|
0, // Query flags
|
||||||
|
|
@ -61,16 +83,14 @@ function JoinServerMenu::cancel(%this)
|
||||||
function JoinServerMenu::join(%this)
|
function JoinServerMenu::join(%this)
|
||||||
{
|
{
|
||||||
cancelServerQuery();
|
cancelServerQuery();
|
||||||
%index = JS_serverList.getSelectedId();
|
JoinGame(JoinServerList.listPosition);
|
||||||
|
|
||||||
JoinGame(%index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
function JoinServerMenu::refresh(%this)
|
function JoinServerMenu::refresh(%this)
|
||||||
{
|
{
|
||||||
cancelServerQuery();
|
cancelServerQuery();
|
||||||
%index= JoinServerList.getActiveRow();
|
%index = JoinServerList.listPosition;
|
||||||
|
|
||||||
// The server info index is stored in the row along with the
|
// The server info index is stored in the row along with the
|
||||||
// rest of displayed info.
|
// rest of displayed info.
|
||||||
|
|
@ -93,19 +113,19 @@ function JoinServerMenu::update(%this)
|
||||||
%sc = getServerCount();
|
%sc = getServerCount();
|
||||||
for( %i = 0; %i < %sc; %i ++ ) {
|
for( %i = 0; %i < %sc; %i ++ ) {
|
||||||
setServerInfo(%i);
|
setServerInfo(%i);
|
||||||
%serverBtn = new GuiButtonCtrl(){
|
|
||||||
text = $ServerInfo::Name TAB
|
%serverEntry = %this.addServerEntry();
|
||||||
$ServerInfo::Ping TAB
|
%serverEntry-->serverNameTxt.text = $ServerInfo::Name;
|
||||||
$ServerInfo::PlayerCount @ "/" @ $ServerInfo::MaxPlayers TAB
|
%serverEntry-->serverDetailsTxt.text = $ServerInfo::MissionName @ " | v" @ $ServerInfo::Version @ " | " @ $ServerInfo::MissionType @ " | " @ $ServerInfo::Info;
|
||||||
$ServerInfo::Version TAB
|
%serverEntry-->pingTxt.text = $ServerInfo::Ping @ " ms";
|
||||||
$ServerInfo::MissionName;
|
%serverEntry-->playerCountTxt.text = $ServerInfo::PlayerCount @ "|" @ $ServerInfo::MaxPlayers;
|
||||||
profile = GuiJoinServerButtonProfile;
|
|
||||||
extent = JoinServerList.extent.x SPC 30;
|
%serverEntry.resize(0, 0, JoinServerList.extent.x, %serverEntry.extent.y);
|
||||||
};
|
|
||||||
JoinServerList.add(%serverBtn);
|
JoinServerList.add(%serverEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
$activeMenuButtonContainer-->button4.setActive(JoinServerList.getCount() > 0);
|
JoinServerList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
@ -115,26 +135,148 @@ function onServerQueryStatus(%status, %msg, %value)
|
||||||
// Update query status
|
// Update query status
|
||||||
// States: start, update, ping, query, done
|
// States: start, update, ping, query, done
|
||||||
// value = % (0-1) done for ping and query states
|
// value = % (0-1) done for ping and query states
|
||||||
if (!JS_queryStatus.isVisible())
|
//if (!JS_queryStatus.isVisible())
|
||||||
JS_queryStatus.setVisible(true);
|
// JS_queryStatus.setVisible(true);
|
||||||
|
|
||||||
switch$ (%status) {
|
switch$ (%status) {
|
||||||
case "start":
|
case "start":
|
||||||
JS_statusText.setText(%msg);
|
MessagePopup("", %msg, 5000);
|
||||||
JS_statusBar.setValue(0);
|
|
||||||
JoinServerList.clear();
|
JoinServerList.clear();
|
||||||
|
|
||||||
case "ping":
|
case "ping":
|
||||||
JS_statusText.setText("Ping Servers");
|
MessagePopup("", "Pinging Servers", 5000);
|
||||||
JS_statusBar.setValue(%value);
|
|
||||||
|
|
||||||
case "query":
|
case "query":
|
||||||
JS_statusText.setText("Query Servers");
|
MessagePopup("", "Querying Servers", 5000);
|
||||||
JS_statusBar.setValue(%value);
|
|
||||||
|
|
||||||
case "done":
|
case "done":
|
||||||
JS_queryStatus.setVisible(false);
|
MessagePopup("", %msg, 1000);
|
||||||
JS_status.setText(%msg);
|
|
||||||
JoinServerMenu.update();
|
JoinServerMenu.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function JoinServerMenu::addServerEntry(%this)
|
||||||
|
{
|
||||||
|
%entry = new GuiContainer() {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "900 40";
|
||||||
|
profile = GuiMenuDefaultProfile;
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
class = "JoinServerServerEntry";
|
||||||
|
canSave = false;
|
||||||
|
|
||||||
|
new GuiButtonCtrl() {
|
||||||
|
profile = GuiMenuButtonProfile;
|
||||||
|
position = "0 0";
|
||||||
|
extent = "900 40";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
internalName = "button";
|
||||||
|
class = "JoinServerEntryButton";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "700 20";
|
||||||
|
profile = "MenuSubHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "serverNameTxt";
|
||||||
|
};
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
position = $optionsEntryPad SPC 17;
|
||||||
|
extent = "700 18";
|
||||||
|
profile = "GuiMLTextProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "serverDetailsTxt";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
position = "700 0";
|
||||||
|
extent = "70 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuSubHeaderCenteredText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "pingTxt";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
position = "770 0";
|
||||||
|
extent = "130 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "MenuSubHeaderCenteredText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "playerCountTxt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return %entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
function JoinServerEntryButton::onHighlighted(%this, %highlighted)
|
||||||
|
{
|
||||||
|
%container = %this.getParent();
|
||||||
|
|
||||||
|
%container-->serverNameTxt.profile = %highlighted ? MenuSubHeaderTextHighlighted : MenuSubHeaderText;
|
||||||
|
%container-->serverDetailsTxt.profile = %highlighted ? GuiMLTextProfileHighlighted : GuiMLTextProfile;
|
||||||
|
%container-->pingTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText;
|
||||||
|
%container-->playerCountTxt.profile = %highlighted ? MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText;
|
||||||
|
}
|
||||||
|
|
||||||
|
function JoinServerMenu::addStatusEntry(%this)
|
||||||
|
{
|
||||||
|
%entry = new GuiContainer() {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "900 40";
|
||||||
|
profile = GuiMenuDefaultProfile;
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
class = "JoinServerStatusEntry";
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
position = "0 0";
|
||||||
|
extent = "730 20";
|
||||||
|
profile = "MenuSubHeaderCenteredText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
internalName = "statusTxt";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return %entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
function JoinServerStatusEntry::updateProgress(%this)
|
||||||
|
{
|
||||||
|
%this-->statusText.text = %this-->statusText.text @ "."; //ellipses.......
|
||||||
|
|
||||||
|
%this.schedule(500, "updateProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
function JoinServerList::syncGui(%this)
|
||||||
|
{
|
||||||
|
%this.callOnChildren("setHighlighted", false);
|
||||||
|
|
||||||
|
if(%this.listPosition < %this.getCount())
|
||||||
|
{
|
||||||
|
%btn = %this.getObject(%this.listPosition);
|
||||||
|
%btn-->button.setHighlighted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
JoinServerBackBtn.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIBackOut"));
|
||||||
|
JoinServerJoinBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu::join();"));
|
||||||
|
JoinServerQLanBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.queryLan();"));
|
||||||
|
JoinServerQServerBtn.setBitmap(JoinServerActionMap.getCommandButtonBitmap(%device, "JoinServerMenu.query();"));
|
||||||
|
|
||||||
|
|
||||||
|
JoinServerJoinBtn.setActive(JoinServerList.getCount() > 0);
|
||||||
|
}
|
||||||
|
|
@ -1,40 +1,38 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
|
$guiContent = new GuiControl(MainMenuGui) {
|
||||||
BitmapAsset = "UI:backgrounddark_image";
|
extent = "1280 720";
|
||||||
extent = "1024 768";
|
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiMenuBackgroundProfile";
|
||||||
|
category = "BaseUI";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
superClass = "UINavigation";
|
canSaveDynamicFields = "1";
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
|
new GuiInputCtrl(MainMenuInputHandler) {
|
||||||
|
ignoreMouseEvents = "1";
|
||||||
|
ActionMap = "BaseUIActionMap";
|
||||||
|
position = "-50 0";
|
||||||
|
extent = "2186 851";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
new GuiBitmapCtrl(SideBackgroundImage) {
|
new GuiBitmapCtrl(SideBackgroundImage) {
|
||||||
bitmapAsset = "UI:menu_side_background_image";
|
BitmapAsset = "UI:menu_side_background_image";
|
||||||
color = "255 255 255 255";
|
position = "0 -48";
|
||||||
wrap = "0";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "900 600";
|
extent = "900 600";
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "top";
|
vertSizing = "top";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
new GuiBitmapCtrl(MainMenuAppLogo) {
|
new GuiBitmapCtrl(MainMenuAppLogo) {
|
||||||
BitmapAsset = "UI:Torque_3D_logo_image";
|
BitmapAsset = "UI:Torque_3D_logo_image";
|
||||||
position = "550 30";
|
position = "460 78";
|
||||||
extent = "360 100";
|
extent = "360 100";
|
||||||
horizSizing = "left";
|
horizSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
canSaveDynamicFields = "1";
|
canSaveDynamicFields = "1";
|
||||||
|
|
@ -46,98 +44,108 @@ $guiContent = new GuiChunkedBitmapCtrl(MainMenuGui) {
|
||||||
useModifiers = "0";
|
useModifiers = "0";
|
||||||
useStates = "1";
|
useStates = "1";
|
||||||
};
|
};
|
||||||
new GuiControl(MainMenuButtonHolder) {
|
new GuiPanel(MainMenuButtonPanel) {
|
||||||
position = "143 711";
|
position = "0 683";
|
||||||
extent = "736 40";
|
extent = "1281 40";
|
||||||
horizSizing = "center";
|
horizSizing = "width";
|
||||||
vertSizing = "top";
|
vertSizing = "top";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiIconButtonCtrl(MainMenuGoButton) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Go";
|
||||||
|
position = "1115 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "activateSelected();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiStackControl(MainMenuButtonList) {
|
||||||
|
padding = "5";
|
||||||
|
dynamicSize = "0";
|
||||||
|
position = "440 199";
|
||||||
|
extent = "400 322";
|
||||||
|
horizSizing = "center";
|
||||||
|
vertSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
|
||||||
class = "MenuInputButtonContainer";
|
|
||||||
|
|
||||||
new GuiIconButtonCtrl() {
|
new GuiButtonCtrl(MainMenuSinglePlayerBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
text = "Single Player";
|
||||||
sizeIconToButton = "1";
|
extent = "400 40";
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
text = "Go";
|
|
||||||
position = "11 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "MainMenuButtonList.activate();";
|
command = "$pref::HostMultiPlayer=false;\nCanvas.pushDialog(ChooseLevelMenu);";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
internalName = "button1";
|
class="MainMenuButton";
|
||||||
class = "MenuInputButton";
|
groupNum = 1;
|
||||||
};
|
};
|
||||||
new GuiIconButtonCtrl() {
|
new GuiButtonCtrl(MainMenuCreateSrvrBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
text = "Create Server";
|
||||||
sizeIconToButton = "1";
|
position = "0 45";
|
||||||
makeIconSquare = "1";
|
extent = "400 40";
|
||||||
textLocation = "Right";
|
|
||||||
text = "Go";
|
|
||||||
position = "155 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "MainMenuButtonList.activate();";
|
command = "$pref::HostMultiPlayer=true;Canvas.pushDialog(ChooseLevelMenu);";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
internalName = "button2";
|
class="MainMenuButton";
|
||||||
class = "MenuInputButton";
|
groupNum = 1;
|
||||||
};
|
};
|
||||||
new GuiIconButtonCtrl() {
|
new GuiButtonCtrl(MainMenuJoinSrvrBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
text = "Join Server";
|
||||||
sizeIconToButton = "1";
|
position = "0 90";
|
||||||
makeIconSquare = "1";
|
extent = "400 40";
|
||||||
textLocation = "Right";
|
|
||||||
text = "Go";
|
|
||||||
position = "299 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "MainMenuButtonList.activate();";
|
command = "Canvas.pushDialog(JoinServerMenu);";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
internalName = "button3";
|
class="MainMenuButton";
|
||||||
class = "MenuInputButton";
|
groupNum = 1;
|
||||||
};
|
};
|
||||||
new GuiIconButtonCtrl() {
|
new GuiButtonCtrl(MainMenuOptionBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
text = "Options";
|
||||||
sizeIconToButton = "1";
|
position = "0 135";
|
||||||
makeIconSquare = "1";
|
extent = "400 40";
|
||||||
textLocation = "Right";
|
|
||||||
text = "Go";
|
|
||||||
position = "443 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "MainMenuButtonList.activate();";
|
command = "Canvas.pushDialog(OptionsMenu);";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
internalName = "button4";
|
class="MainMenuButton";
|
||||||
class = "MenuInputButton";
|
groupNum = 1;
|
||||||
};
|
};
|
||||||
new GuiIconButtonCtrl() {
|
new GuiButtonCtrl(MainMenuWorldEditBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
text = "Open World Editor (F11)";
|
||||||
sizeIconToButton = "1";
|
position = "0 180";
|
||||||
makeIconSquare = "1";
|
extent = "400 40";
|
||||||
textLocation = "Right";
|
|
||||||
text = "Go";
|
|
||||||
position = "587 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "MainMenuButtonList.activate();";
|
command = "fastLoadWorldEdit(1);";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
internalName = "button5";
|
class="MainMenuButton";
|
||||||
class = "MenuInputButton";
|
groupNum = 1;
|
||||||
};
|
};
|
||||||
};
|
new GuiButtonCtrl(MainMenuGuiEditBtn) {
|
||||||
new GuiInputCtrl(MainMenuInputHandler) {
|
text = "Open GUI Editor (F10)";
|
||||||
sendAxisEvents = "1";
|
position = "0 225";
|
||||||
sendBreakEvents = "1";
|
extent = "400 40";
|
||||||
ignoreMouseEvents = "1";
|
profile = "GuiMenuButtonProfile";
|
||||||
position = "-50 0";
|
command = "fastLoadGUIEdit(1);";
|
||||||
extent = "10 10";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiInputCtrlProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuInputHandler";
|
class="MainMenuButton";
|
||||||
|
groupNum = 1;
|
||||||
|
};
|
||||||
|
new GuiButtonCtrl(MainMenuExitBtn) {
|
||||||
|
text = "Exit";
|
||||||
|
position = "0 270";
|
||||||
|
extent = "400 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "quit();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class="MainMenuButton";
|
||||||
|
groupNum = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
//--- OBJECT WRITE END ---
|
//--- OBJECT WRITE END ---
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,130 @@
|
||||||
|
$BaseUI::scrollSpeedTimeMs = 250;
|
||||||
|
$BaseUI::scrollSchedule = 0;
|
||||||
|
|
||||||
function MainMenuGui::onAdd(%this)
|
function MainMenuGui::onAdd(%this)
|
||||||
{
|
{
|
||||||
$activeControllerName = "K&M"; //default input type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function MainMenuGui::onWake(%this)
|
function MainMenuGui::onWake(%this)
|
||||||
{
|
{
|
||||||
//In the BaseUI example case, the MainMenuGUI acts as our background
|
$MenuList = MainMenuButtonList;
|
||||||
//So it's a logical control to set as our UINavigation as well. So we
|
$MenuList.listPosition = 0;
|
||||||
//set the MainMenuGUI's superClass to UINavigation to integrate it into
|
|
||||||
//that namespace to open up page navigation
|
|
||||||
|
|
||||||
//At the same time, the MainMenuGUI control has the button holder, set to
|
$MenuList.syncGui();
|
||||||
//the MenuInputButtonContainer class, allowing us to set it as the active button
|
|
||||||
//holder here, prepping it for catching any button inputs to active commands
|
|
||||||
//Specifically, it sets the $activeMenuButtonContainer to be this, which allows
|
|
||||||
//other controls to manage what the behavior of the buttons is consistently
|
|
||||||
//without needing to worry about hardcoded names
|
|
||||||
MainMenuButtonHolder.setActive();
|
|
||||||
|
|
||||||
//We also have the MainMenuInputHandler, a GuiInputCtrl with the MenuInputHandler class
|
|
||||||
//This allows us to catch any input/axis event and pass it along to the active menuList
|
|
||||||
//or button containers to navigate the menus
|
|
||||||
//We set up this catch by making said control our first responder, here
|
|
||||||
MainMenuInputHandler.setFirstResponder();
|
|
||||||
|
|
||||||
//We also go ahead and mark for any future pages being added to the UINavigation's page stack
|
|
||||||
//to be prompted to resize when added. This isn't required, but helps keep pages formated to
|
|
||||||
//the current size of the UINavigation, which is useful when dealing with aspect ratio or resolution
|
|
||||||
//changes.
|
|
||||||
%this.resizePages = true;
|
|
||||||
//Lastly, we go ahead and display some actual navigable content up on our main menu here
|
|
||||||
//In this case, we set the MainMenuButtons as our root page, so we always come back
|
|
||||||
//to having the main menu buttons on screen if every other page is closed.
|
|
||||||
//This will ultimately call MainMenuButtons::onOpen(), so to see where the navigation
|
|
||||||
//chain continues, see that function.
|
|
||||||
%this.setRootPage(MainMenuButtons);
|
|
||||||
|
|
||||||
%this.refreshPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function MainMenuButtonHolder::onWake(%this)
|
function MainMenuGui::onSleep(%this)
|
||||||
{
|
{
|
||||||
//Because the blan slate MainMenuGUI doesn't have anything we need to bother with inputs on
|
}
|
||||||
//we just go ahead and disable all the buttons in our MainMenuButtonHolder to have
|
|
||||||
// a clean slate
|
if(!isObject( BaseUIActionMap ) )
|
||||||
%this-->button1.disable();
|
{
|
||||||
%this-->button2.disable();
|
new ActionMap(BaseUIActionMap){};
|
||||||
%this-->button3.disable();
|
|
||||||
%this-->button4.disable();
|
BaseUIActionMap.bind( keyboard, w, BaseUINavigatePrev );
|
||||||
%this-->button5.disable();
|
BaseUIActionMap.bind( keyboard, s, BaseUINavigateNext );
|
||||||
|
BaseUIActionMap.bind( gamepad, yaxis, "D", "-0.23 0.23", BaseUIStickNavigate );
|
||||||
|
BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
||||||
|
BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
||||||
|
|
||||||
|
BaseUIActionMap.bind( keyboard, Space, BaseUIActivateSelected );
|
||||||
|
BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
||||||
|
|
||||||
|
BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut );
|
||||||
|
BaseUIActionMap.bind( gamepad, btn_b, BaseUIBackOut );
|
||||||
|
}
|
||||||
|
|
||||||
|
function BaseUINavigatePrev(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
$MenuList.listPosition -= 1;
|
||||||
|
if($MenuList.listPosition < 0)
|
||||||
|
$MenuList.listPosition = 0;
|
||||||
|
|
||||||
|
$MenuList.syncGUI();
|
||||||
|
|
||||||
|
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigatePrev", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function BaseUINavigateNext(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
{
|
||||||
|
$MenuList.listPosition += 1;
|
||||||
|
if($MenuList.listPosition >= $MenuList.getCount())
|
||||||
|
$MenuList.listPosition = $MenuList.getCount()-1;
|
||||||
|
|
||||||
|
$MenuList.syncGUI();
|
||||||
|
|
||||||
|
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "BaseUINavigateNext", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function BaseUIStickNavigate(%val)
|
||||||
|
{
|
||||||
|
if(%val == 1)
|
||||||
|
BaseUINavigateNext(1);
|
||||||
|
else if(%val == -1)
|
||||||
|
BaseUINavigatePrev(1);
|
||||||
|
else
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BaseUIBackOut(%val)
|
||||||
|
{
|
||||||
|
//we can't navigate further back than the MainMenuGui
|
||||||
|
if(%val && Canvas.getObject(Canvas.getCount()-1).getId() != MainMenuGui.getId())
|
||||||
|
{
|
||||||
|
Canvas.popDialog();
|
||||||
|
%topMenu = Canvas.getObject(Canvas.getCount()-1);
|
||||||
|
if(isObject(%topMenu))
|
||||||
|
{
|
||||||
|
//re-kick the on-wake so we can be fully up to date and relevently
|
||||||
|
//contexted
|
||||||
|
%topMenu.onWake();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function MainMenuButtonList::syncGUI(%this)
|
||||||
|
{
|
||||||
|
//%this.callOnChildren("setHighlighted", false);
|
||||||
|
|
||||||
|
%btn = %this.getObject(%this.listPosition);
|
||||||
|
%btn.setHighlighted(true);
|
||||||
|
|
||||||
|
//
|
||||||
|
//Update the button imagery to comply to the last input device we'd used
|
||||||
|
%device = Canvas.getLastInputDevice();
|
||||||
|
if(%device $= "mouse")
|
||||||
|
%device = "keyboard";
|
||||||
|
|
||||||
|
MainMenuGoButton.setBitmap(BaseUIActionMap.getCommandButtonBitmap(%device, "BaseUIActivateSelected"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function MainMenuButton::onHighlighted(%this, %highlighted)
|
||||||
|
{
|
||||||
|
if(%highlighted)
|
||||||
|
$MenuList.listPosition = MainMenuButtonList.getObjectIndex(%this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BaseUIActivateSelected()
|
||||||
|
{
|
||||||
|
if($MenuList.getCount() == 0 || $MenuList.listPosition >= $MenuList.getCount() || $MenuList.listPosition < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
%btn = $MenuList.getObject($MenuList.listPosition);
|
||||||
|
|
||||||
|
if(%btn.isMethod("performClick"))
|
||||||
|
%btn.performClick();
|
||||||
}
|
}
|
||||||
|
|
@ -1,347 +1,75 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiControl(MessageBoxDlg) {
|
$guiContent = new GuiControl(MessageBoxDlg) {
|
||||||
position = "0 0";
|
extent = "1280 720";
|
||||||
extent = "1024 768";
|
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiOverlayProfile";
|
profile = "GuiOverlayProfile";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
canSaveDynamicFields = "1";
|
||||||
helpTag = "0";
|
helpTag = "0";
|
||||||
|
|
||||||
new GuiControl(MessageBoxCtrl) {
|
new GuiInputCtrl(MessageBoxInputHandler) {
|
||||||
position = "192 197";
|
ignoreMouseEvents = "1";
|
||||||
extent = "641 381";
|
ActionMap = "MessageBoxActionMap";
|
||||||
minExtent = "8 2";
|
position = "-50 0";
|
||||||
|
extent = "2186 851";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiBitmapCtrl() {
|
||||||
|
BitmapAsset = "UI:backdrop_image";
|
||||||
|
position = "272 128";
|
||||||
|
extent = "735 463";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
};
|
||||||
isContainer = "1";
|
new GuiControl(MessageBoxCtrl) {
|
||||||
canSave = "1";
|
position = "319 169";
|
||||||
canSaveDynamicFields = "0";
|
extent = "641 381";
|
||||||
|
horizSizing = "center";
|
||||||
new GuiBitmapBarCtrl() {
|
vertSizing = "center";
|
||||||
percent = "100";
|
|
||||||
vertical = "0";
|
|
||||||
flipClip = "0";
|
|
||||||
bitmapAsset = "UI:panel_image";
|
|
||||||
color = "255 255 255 255";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "641 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
isContainer = "1";
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
new GuiPanel() {
|
||||||
canSaveDynamicFields = "0";
|
extent = "641 381";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuBasePanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl(MessageBoxTitleText) {
|
new GuiTextCtrl(MessageBoxTitleText) {
|
||||||
text = "OPTIONS";
|
|
||||||
maxLength = "1024";
|
|
||||||
margin = "0 0 0 0";
|
|
||||||
padding = "0 0 0 0";
|
|
||||||
anchorTop = "1";
|
|
||||||
anchorBottom = "0";
|
|
||||||
anchorLeft = "1";
|
|
||||||
anchorRight = "0";
|
|
||||||
position = "32 7";
|
position = "32 7";
|
||||||
extent = "577 28";
|
extent = "577 28";
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "MenuHeaderText";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiBitmapBarCtrl() {
|
|
||||||
percent = "100";
|
|
||||||
vertical = "0";
|
|
||||||
flipClip = "0";
|
|
||||||
bitmapAsset = "UI:panel_low_image";
|
|
||||||
color = "255 255 255 255";
|
|
||||||
position = "0 40";
|
|
||||||
extent = "641 341";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "bottom";
|
profile = "MenuHeaderText";
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
};
|
||||||
new GuiMLTextCtrl(MessageBoxText) {
|
new GuiMLTextCtrl(MessageBoxText) {
|
||||||
lineSpacing = "2";
|
|
||||||
allowColorChars = "0";
|
|
||||||
maxChars = "-1";
|
|
||||||
useURLMouseCursor = "0";
|
|
||||||
position = "81 83";
|
position = "81 83";
|
||||||
extent = "481 19";
|
extent = "481 19";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "MenuMLSubHeaderText";
|
profile = "MenuMLSubHeaderText";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
};
|
||||||
new GuiControl(MessageBoxOKButtonHolder) {
|
new GuiStackControl(MessageBoxButtonHolder) {
|
||||||
position = "0 285";
|
stackingType = "Horizontal";
|
||||||
extent = "642 40";
|
position = "250 285";
|
||||||
minExtent = "8 2";
|
extent = "140 40";
|
||||||
horizSizing = "center";
|
horizSizing = "width";
|
||||||
vertSizing = "top";
|
vertSizing = "top";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
class = "MenuInputButtonContainer";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "251 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "OKButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiControl(MessageBoxOCButtonHolder) {
|
|
||||||
position = "0 285";
|
|
||||||
extent = "642 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
class = "MenuInputButtonContainer";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "171 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "OKButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "323 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "CancelButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiControl(MessageBoxYNCButtonHolder) {
|
|
||||||
position = "0 285";
|
|
||||||
extent = "642 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "1";
|
|
||||||
class = "MenuInputButtonContainer";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "99 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "yesButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "251 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "noButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
buttonMargin = "4 4";
|
|
||||||
iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter";
|
|
||||||
iconLocation = "Left";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
textMargin = "4";
|
|
||||||
autoSize = "0";
|
|
||||||
text = "Go";
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "403 0";
|
|
||||||
extent = "140 40";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = "MainMenuButtonList.activateRow();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
internalName = "CancelButton";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
220
Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript
Normal file
220
Templates/BaseGame/game/data/UI/guis/messageBoxDlg.tscript
Normal file
|
|
@ -0,0 +1,220 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
%this.callback = "";
|
||||||
|
%this.cancelCallback = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
// Various message box display functions. Each one takes a window title, a message, and a
|
||||||
|
// callback for each button.
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
function MessageBoxCtrl::createButton(%this, %text, %command, %bitmap)
|
||||||
|
{
|
||||||
|
%btn = new GuiIconButtonCtrl() {
|
||||||
|
BitmapAsset = %bitmap;
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
iconLocation = "Left";
|
||||||
|
text = %text;
|
||||||
|
position = "251 0";
|
||||||
|
extent = "140 40";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = %command;
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
|
||||||
|
MessageBoxButtonHolder.add(%btn);
|
||||||
|
|
||||||
|
//update positioning of the holder to be centered
|
||||||
|
MessageBoxButtonHolder.position.x = MessageBoxCtrl.extent.x/2 - MessageBoxButtonHolder.extent.x/2;
|
||||||
|
|
||||||
|
return %btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MessageBoxDlg::onWake(%this)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isObject( MessageBoxActionMap ) )
|
||||||
|
{
|
||||||
|
new ActionMap(MessageBoxActionMap){};
|
||||||
|
|
||||||
|
MessageBoxActionMap.bind( keyboard, Space, messageBoxYesClicked );
|
||||||
|
MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked );
|
||||||
|
|
||||||
|
MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked );
|
||||||
|
MessageBoxActionMap.bind( gamepad, btn_b, messageBoxNoClicked );
|
||||||
|
}
|
||||||
|
|
||||||
|
function MessageBoxCtrl::syncGui(%this)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function messageBoxYesClicked(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
MessageCallback(MessageBoxDlg, MessageBoxDlg.callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
function messageBoxNoClicked(%val)
|
||||||
|
{
|
||||||
|
if(%val)
|
||||||
|
MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\"");
|
||||||
|
function MessageBoxOK(%title, %message, %callback)
|
||||||
|
{
|
||||||
|
MessageBoxButtonHolder.clear();
|
||||||
|
|
||||||
|
Canvas.pushDialog(MessageBoxDlg);
|
||||||
|
MessageBoxTitleText.text = %title;
|
||||||
|
|
||||||
|
%okButton = MessageBoxCtrl.createButton("OK", "messageBoxYesClicked(1);");
|
||||||
|
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
|
||||||
|
%okButton.setBitmap(%bitmapAssetId);
|
||||||
|
|
||||||
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
||||||
|
MessageBoxDlg.callback = %callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride)
|
||||||
|
{
|
||||||
|
MessageBoxButtonHolder.clear();
|
||||||
|
|
||||||
|
Canvas.pushDialog(MessageBoxDlg);
|
||||||
|
MessageBoxTitleText.text = %title;
|
||||||
|
|
||||||
|
if(%okLabelOverride $= "")
|
||||||
|
%okLabel = "OK";
|
||||||
|
else
|
||||||
|
%okLabel = %okLabelOverride;
|
||||||
|
|
||||||
|
if(%cancelLabelOverride $= "")
|
||||||
|
%cancelLabel = "Cancel";
|
||||||
|
else
|
||||||
|
%cancelLabel = %cancelLabelOverride;
|
||||||
|
|
||||||
|
%okButton = MessageBoxCtrl.createButton(%okLabel, "messageBoxYesClicked(1);");
|
||||||
|
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxYesClicked");
|
||||||
|
%okButton.setBitmap(%bitmapAssetId);
|
||||||
|
|
||||||
|
%cancelButton = MessageBoxCtrl.createButton(%cancelLabel, "messageBoxNoClicked(1);");
|
||||||
|
%bitmapAssetId = MessageBoxActionMap.getCommandButtonBitmap(Canvas.getLastInputDevice(), "messageBoxNoClicked");
|
||||||
|
%cancelButton.setBitmap(%bitmapAssetId);
|
||||||
|
|
||||||
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
||||||
|
MessageBoxDlg.callback = %callback;
|
||||||
|
MessageBoxDlg.cancelCallback = %cancelCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback)
|
||||||
|
{
|
||||||
|
MessageBoxOKCancel(%title, %message, %yesCallback, %noCallback, "Yes", "No");
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
@ -1,226 +1,242 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiControl(OptionsMenu) {
|
$guiContent = new GuiControl(OptionsMenu) {
|
||||||
extent = "1024 768";
|
extent = "1280 720";
|
||||||
profile = "GuiNonModalDefaultProfile";
|
minExtent = "8 8";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuBackgroundProfile";
|
||||||
|
category = "BaseUI";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
new GuiControl(OptionsMenuContainer) {
|
new GuiInputCtrl(OptionsMenuInputHandler) {
|
||||||
position = "48 56";
|
ignoreMouseEvents = "1";
|
||||||
extent = "928 655";
|
ActionMap = "OptionsMenuActionMap";
|
||||||
horizSizing = "aspectCenter";
|
position = "-50 0";
|
||||||
|
extent = "2186 851";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = "GuiInputCtrlProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
new GuiControl(OptionsMenuCategoryContainer) {
|
||||||
|
position = "0 60";
|
||||||
|
extent = "1280 49";
|
||||||
|
horizSizing = "center";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
isContainer = "1";
|
||||||
|
|
||||||
|
new GuiStackControl(OptionsMenuCategoryList) {
|
||||||
|
stackingType = "Horizontal";
|
||||||
|
padding = "10";
|
||||||
|
dynamicSize = "0";
|
||||||
|
position = "330 0";
|
||||||
|
extent = "650 40";
|
||||||
|
horizSizing = "center";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
|
||||||
|
|
||||||
new GuiBitmapBarCtrl() {
|
|
||||||
BitmapAsset = "UI:panel_low_image";
|
|
||||||
position = "0 40";
|
|
||||||
extent = "927 618";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiBitmapBarCtrl() {
|
|
||||||
BitmapAsset = "UI:panel_image";
|
|
||||||
extent = "927 40";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl() {
|
|
||||||
text = "OPTIONS";
|
|
||||||
position = "22 7";
|
|
||||||
extent = "220 28";
|
|
||||||
profile = "MenuHeaderText";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiTextCtrl(OptionName) {
|
|
||||||
position = "3 606";
|
|
||||||
extent = "293 17";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "MenuSubHeaderText";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiMLTextCtrl(OptionDescription) {
|
|
||||||
text = "This is a placeholder text for an option.";
|
|
||||||
position = "3 625";
|
|
||||||
extent = "293 14";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiMLTextProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiSplitContainer() {
|
|
||||||
splitPoint = "250 100";
|
|
||||||
fixedPanel = "FirstPanel";
|
|
||||||
fixedSize = "250";
|
|
||||||
position = "0 48";
|
|
||||||
extent = "928 555";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiMenuScrollProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
|
|
||||||
new GuiPanel() {
|
|
||||||
docking = "Client";
|
|
||||||
extent = "248 555";
|
|
||||||
profile = "GuiOverlayProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "Panel1";
|
|
||||||
|
|
||||||
new GuiStackControl(OptionsMenuCategoryList) {
|
|
||||||
padding = "10";
|
|
||||||
dynamicSize = "0";
|
|
||||||
extent = "248 555";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
superClass = "MenuList";
|
|
||||||
|
|
||||||
new GuiButtonCtrl() {
|
new GuiButtonCtrl() {
|
||||||
text = "Display";
|
text = "Video";
|
||||||
extent = "248 35";
|
extent = "120 40";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "populateDisplaySettingsList();";
|
command = "OptionsMenu.openOptionsCategory(\"Video\");";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Graphics";
|
|
||||||
position = "0 45";
|
|
||||||
extent = "248 35";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "populateGraphicsSettingsList();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiButtonCtrl() {
|
new GuiButtonCtrl() {
|
||||||
text = "Audio";
|
text = "Audio";
|
||||||
position = "0 90";
|
position = "130 0";
|
||||||
extent = "248 35";
|
extent = "120 40";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "populateAudioSettingsList();";
|
command = "OptionsMenu.openOptionsCategory(\"Audio\");";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiButtonCtrl() {
|
new GuiButtonCtrl() {
|
||||||
text = "Keyboard & Mouse";
|
text = "Keyboard/Mouse";
|
||||||
position = "0 135";
|
position = "260 0";
|
||||||
extent = "248 35";
|
extent = "220 40";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "populateKeyboardMouseSettingsList();";
|
command = "OptionsMenu.openOptionsCategory(\"KBM\");";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiButtonCtrl() {
|
new GuiButtonCtrl() {
|
||||||
text = "Gamepad";
|
text = "Controller";
|
||||||
position = "0 180";
|
position = "480 0";
|
||||||
extent = "248 35";
|
extent = "160 40";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuButtonProfile";
|
||||||
command = "populateGamepadSettingsList();";
|
command = "OptionsMenu.openOptionsCategory(\"Controller\");";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Example Options";
|
|
||||||
position = "0 225";
|
|
||||||
extent = "248 35";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "testExampleOptions();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
new GuiPanel() {
|
|
||||||
docking = "Client";
|
|
||||||
position = "252 0";
|
|
||||||
extent = "676 555";
|
|
||||||
profile = "GuiOverlayProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "panel2";
|
|
||||||
|
|
||||||
|
new GuiControl(OptionsMenuNavButtonOverlay) {
|
||||||
|
extent = "1281 40";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(OptionsMenuPrevNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Q_image";
|
||||||
|
position = "0 10";
|
||||||
|
extent = "40 40";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
vertSizing = "top";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiBitmapCtrl(OptionsMenuNextNavIcon) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_E_image";
|
||||||
|
position = "0 10";
|
||||||
|
extent = "40 40";
|
||||||
|
profile = GuiNonModalDefaultProfile;
|
||||||
|
vertSizing = "top";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
new GuiScrollCtrl(OptionsMenuSettingsScroll) {
|
new GuiScrollCtrl(OptionsMenuSettingsScroll) {
|
||||||
hScrollBar = "alwaysOff";
|
hScrollBar = "alwaysOff";
|
||||||
vScrollBar = "dynamic";
|
vScrollBar = "dynamic";
|
||||||
extent = "676 554";
|
position = "240 110";
|
||||||
horizSizing = "width";
|
extent = "800 573";
|
||||||
|
horizSizing = "center";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiMenuScrollProfile";
|
profile = "GuiMenuScrollProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
new GuiStackControl(OptionsMenuSettingsList) {
|
new GuiStackControl(VideoSettingsList) {
|
||||||
|
class = "OptionsMenuList";
|
||||||
padding = "5";
|
padding = "5";
|
||||||
changeChildSizeToFit = "0";
|
changeChildSizeToFit = "0";
|
||||||
position = "1 1";
|
position = "0 1";
|
||||||
extent = "661 170";
|
extent = "800 200";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
superClass = "MenuList";
|
};
|
||||||
new GuiGameSettingsCtrl() {
|
new GuiStackControl(AudioSettingsList) {
|
||||||
PreviousBitmapAsset = "UI:previousOption_n_image";
|
class = "OptionsMenuList";
|
||||||
NextBitmapAsset = "UI:nextOption_n_image";
|
padding = "5";
|
||||||
columnSplit = "198";
|
changeChildSizeToFit = "0";
|
||||||
useMouseEvents = "1";
|
position = "0 1";
|
||||||
extent = "661 30";
|
extent = "800 200";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiMenuButtonProfile";
|
vertSizing = "height";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuOptionsButton";
|
hidden = "1";
|
||||||
};
|
};
|
||||||
new GuiGameSettingsCtrl() {
|
new GuiStackControl(KBMControlsList) {
|
||||||
PreviousBitmapAsset = "UI:previousOption_n_image";
|
class = "OptionsMenuList";
|
||||||
NextBitmapAsset = "UI:nextOption_n_image";
|
padding = "5";
|
||||||
columnSplit = "198";
|
changeChildSizeToFit = "0";
|
||||||
useMouseEvents = "1";
|
position = "0 1";
|
||||||
position = "0 35";
|
extent = "800 200";
|
||||||
extent = "661 30";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiMenuButtonProfile";
|
vertSizing = "height";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuOptionsButton";
|
hidden = "1";
|
||||||
};
|
};
|
||||||
new GuiGameSettingsCtrl() {
|
new GuiStackControl(GamepadControlsList) {
|
||||||
PreviousBitmapAsset = "UI:previousOption_n_image";
|
class = "OptionsMenuList";
|
||||||
NextBitmapAsset = "UI:nextOption_n_image";
|
padding = "5";
|
||||||
columnSplit = "198";
|
changeChildSizeToFit = "0";
|
||||||
useMouseEvents = "1";
|
position = "0 1";
|
||||||
position = "0 70";
|
extent = "800 200";
|
||||||
extent = "661 30";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiMenuButtonProfile";
|
vertSizing = "height";
|
||||||
|
profile = "GuiDefaultProfile";
|
||||||
|
visible = "0";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuOptionsButton";
|
hidden = "1";
|
||||||
};
|
};
|
||||||
new GuiGameSettingsCtrl() {
|
};
|
||||||
PreviousBitmapAsset = "UI:previousOption_n_image";
|
new GuiPanel(OptionMenuTitlePanel) {
|
||||||
NextBitmapAsset = "UI:nextOption_n_image";
|
extent = "1281 60";
|
||||||
columnSplit = "198";
|
|
||||||
useMouseEvents = "1";
|
|
||||||
position = "0 105";
|
|
||||||
extent = "661 30";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiMenuButtonProfile";
|
profile = "GuiMenuPanelProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuOptionsButton";
|
|
||||||
};
|
|
||||||
new GuiGameSettingsCtrl() {
|
|
||||||
PreviousBitmapAsset = "UI:previousOption_n_image";
|
|
||||||
NextBitmapAsset = "UI:nextOption_n_image";
|
|
||||||
columnSplit = "198";
|
|
||||||
useMouseEvents = "1";
|
|
||||||
position = "0 140";
|
|
||||||
extent = "661 30";
|
|
||||||
horizSizing = "width";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
class = "MenuOptionsButton";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
new GuiTextCtrl() {
|
||||||
|
text = "OPTIONS";
|
||||||
|
position = "22 23";
|
||||||
|
extent = "1281 28";
|
||||||
|
profile = "MenuHeaderText";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
new GuiPanel(OptionsMenuButtonPanel) {
|
||||||
|
position = "0 683";
|
||||||
|
extent = "1281 40";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "top";
|
||||||
|
profile = "GuiMenuPanelProfile";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuBackBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Escape_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Back";
|
||||||
|
position = "16 0";
|
||||||
|
extent = "140 40";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "tryCloseOptionsMenu(1);";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuRemapBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Space_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Remap";
|
||||||
|
position = "850 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "OptionsMenuActivateOption(1)";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuApplyBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Apply";
|
||||||
|
position = "990 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "OptionsMenu.applyChangedOptions();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuResetBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_R_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Reset";
|
||||||
|
position = "1135 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "OptionsMenu.resetSettings();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
//--- OBJECT WRITE END ---
|
//--- OBJECT WRITE END ---
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,163 +0,0 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
|
||||||
$guiContent = new GuiControl(PauseMenu) {
|
|
||||||
extent = "1024 768";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
superClass = "UINavigation";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
|
|
||||||
new GuiChunkedBitmapCtrl(PauseMenuBG) {
|
|
||||||
BitmapAsset = "UI:hudfill_image";
|
|
||||||
extent = "1024 768";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
canSaveDynamicFields = "1";
|
|
||||||
};
|
|
||||||
new GuiInputCtrl(PauseMenuInputHandler) {
|
|
||||||
sendAxisEvents = "1";
|
|
||||||
sendBreakEvents = "1";
|
|
||||||
ignoreMouseEvents = "1";
|
|
||||||
position = "-50 0";
|
|
||||||
extent = "10 10";
|
|
||||||
horizSizing = "width";
|
|
||||||
vertSizing = "height";
|
|
||||||
profile = "GuiInputCtrlProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
class = "MenuInputHandler";
|
|
||||||
};
|
|
||||||
new GuiControl(PauseMenuButtons) {
|
|
||||||
position = "162 125";
|
|
||||||
extent = "700 518";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
|
|
||||||
new GuiStackControl(PauseMenuList) {
|
|
||||||
padding = "15";
|
|
||||||
dynamicSize = "0";
|
|
||||||
extent = "700 320";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "center";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
superClass = "MenuList";
|
|
||||||
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Options";
|
|
||||||
extent = "700 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "openPauseMenuOptions();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Exit to Menu";
|
|
||||||
position = "0 70";
|
|
||||||
extent = "700 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "pauseMenuExitToMenu();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
new GuiButtonCtrl() {
|
|
||||||
text = "Exit to Desktop";
|
|
||||||
position = "0 140";
|
|
||||||
extent = "700 55";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
command = "pauseMenuExitToDesktop();";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
new GuiControl(PauseButtonHolder) {
|
|
||||||
position = "144 711";
|
|
||||||
extent = "736 40";
|
|
||||||
horizSizing = "center";
|
|
||||||
vertSizing = "top";
|
|
||||||
profile = "GuiDefaultProfile";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
isContainer = "1";
|
|
||||||
class = "MenuInputButtonContainer";
|
|
||||||
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
position = "11 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "0";
|
|
||||||
active = "0";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "button1";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
hidden = "1";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
position = "155 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "0";
|
|
||||||
active = "0";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "button2";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
hidden = "1";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
position = "299 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "0";
|
|
||||||
active = "0";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "button3";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
hidden = "1";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
position = "443 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "0";
|
|
||||||
active = "0";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "button4";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
hidden = "1";
|
|
||||||
};
|
|
||||||
new GuiIconButtonCtrl() {
|
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
|
||||||
sizeIconToButton = "1";
|
|
||||||
makeIconSquare = "1";
|
|
||||||
textLocation = "Right";
|
|
||||||
position = "587 0";
|
|
||||||
extent = "140 40";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "0";
|
|
||||||
active = "0";
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
internalName = "button5";
|
|
||||||
class = "MenuInputButton";
|
|
||||||
hidden = "1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
//--- OBJECT WRITE END ---
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
function PauseMenu::onWake(%this)
|
|
||||||
{
|
|
||||||
if($Server::ServerType $= "SinglePlayer")
|
|
||||||
{
|
|
||||||
$timescale = 0;
|
|
||||||
|
|
||||||
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
PauseButtonHolder.setActive();
|
|
||||||
PauseMenuInputHandler.setFirstResponder();
|
|
||||||
|
|
||||||
%this.resizePages = true;
|
|
||||||
|
|
||||||
%this.setRootPage(PauseMenuButtons);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PauseMenuButtons::onOpen(%this)
|
|
||||||
{
|
|
||||||
PauseMenuList.clear();
|
|
||||||
|
|
||||||
if($Tools::loaded && EditorIsActive())
|
|
||||||
{
|
|
||||||
%this.addPauseMenuButton("Exit Editor", "fastLoadWorldEdit();");
|
|
||||||
}
|
|
||||||
|
|
||||||
%this.addPauseMenuButton("Options", "openPauseMenuOptions();");
|
|
||||||
%this.addPauseMenuButton("Exit to Menu", "pauseMenuExitToMenu();");
|
|
||||||
%this.addPauseMenuButton("Exit to Desktop", "pauseMenuExitToDesktop();");
|
|
||||||
|
|
||||||
PauseMenuList.setAsActiveMenuList();
|
|
||||||
|
|
||||||
$activeMenuButtonContainer-->button1.disable();
|
|
||||||
$activeMenuButtonContainer-->button2.disable();
|
|
||||||
$activeMenuButtonContainer-->button3.disable();
|
|
||||||
$activeMenuButtonContainer-->button4.set("btn_a", "", "OK", "PauseMenuList.activate();");
|
|
||||||
$activeMenuButtonContainer-->button5.set("btn_b", "Escape", "Back", "Canvas.popDialog();");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PauseMenuButtons::addPauseMenuButton(%this, %buttonText, %buttonCallback)
|
|
||||||
{
|
|
||||||
%newButton = new GuiButtonCtrl() {
|
|
||||||
text = %buttonText;
|
|
||||||
groupNum = "-1";
|
|
||||||
buttonType = "PushButton";
|
|
||||||
useMouseEvents = "0";
|
|
||||||
position = "0 0";
|
|
||||||
extent = "400 55";
|
|
||||||
minExtent = "8 2";
|
|
||||||
horizSizing = "right";
|
|
||||||
vertSizing = "bottom";
|
|
||||||
profile = "GuiMenuButtonProfile";
|
|
||||||
visible = "1";
|
|
||||||
active = "1";
|
|
||||||
command = %buttonCallback;
|
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
|
||||||
hovertime = "1000";
|
|
||||||
isContainer = "0";
|
|
||||||
canSave = "1";
|
|
||||||
canSaveDynamicFields = "0";
|
|
||||||
};
|
|
||||||
|
|
||||||
PauseMenuList.add(%newButton);
|
|
||||||
}
|
|
||||||
function PauseMenu::onSleep(%this)
|
|
||||||
{
|
|
||||||
if($Server::ServerType $= "SinglePlayer")
|
|
||||||
{
|
|
||||||
$timescale = 1;
|
|
||||||
sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openPauseMenuOptions()
|
|
||||||
{
|
|
||||||
PauseMenu.pushPage(OptionsMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pauseMenuExitToMenu()
|
|
||||||
{
|
|
||||||
MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function pauseMenuExitToDesktop()
|
|
||||||
{
|
|
||||||
MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function PauseButtonHolder::onWake(%this)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<GUIAsset
|
|
||||||
AssetName="recordingsDlg"
|
|
||||||
GUIFile="@assetFile=RecordingsDlg.gui"
|
|
||||||
VersionId="1"/>
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//--- OBJECT WRITE BEGIN ---
|
//--- OBJECT WRITE BEGIN ---
|
||||||
$guiContent = new GuiControl(RemapDlg) {
|
$guiContent = new GuiControl(RemapDlg) {
|
||||||
extent = "1024 768";
|
extent = "1280 720";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
@ -9,7 +9,7 @@ $guiContent = new GuiControl(RemapDlg) {
|
||||||
helpTag = "0";
|
helpTag = "0";
|
||||||
|
|
||||||
new GuiContainer(RemapPanel) {
|
new GuiContainer(RemapPanel) {
|
||||||
position = "162 332";
|
position = "290 308";
|
||||||
extent = "700 104";
|
extent = "700 104";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
|
|
@ -24,6 +24,7 @@ $guiContent = new GuiControl(RemapDlg) {
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiInputCtrlProfile";
|
profile = "GuiInputCtrlProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
sendAxisEvents = "0";
|
||||||
};
|
};
|
||||||
new GuiControl(RemapBoxCtrl) {
|
new GuiControl(RemapBoxCtrl) {
|
||||||
position = "-1 1";
|
position = "-1 1";
|
||||||
|
|
@ -34,26 +35,28 @@ $guiContent = new GuiControl(RemapDlg) {
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
|
|
||||||
new GuiBitmapBarCtrl() {
|
new GuiBitmapCtrl() {
|
||||||
BitmapAsset = "UI:panel_image";
|
BitmapAsset = "UI:backdrop_image";
|
||||||
extent = "701 40";
|
position = "1 1";
|
||||||
|
extent = "701 100";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
|
vertSizing = "height";
|
||||||
profile = "GuiDefaultProfile";
|
profile = "GuiDefaultProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiBitmapBarCtrl() {
|
new GuiPanel() {
|
||||||
BitmapAsset = "UI:panel_low_image";
|
position = "38 12";
|
||||||
position = "0 40";
|
extent = "625 80";
|
||||||
extent = "701 341";
|
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
profile = "GuiDefaultProfile";
|
vertSizing = "height";
|
||||||
|
profile = "GuiMenuBasePanelProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl() {
|
new GuiTextCtrl() {
|
||||||
text = "Press escape to cancel";
|
text = "Press escape or start to cancel";
|
||||||
maxLength = "255";
|
maxLength = "255";
|
||||||
position = "260 67";
|
position = "252 51";
|
||||||
extent = "181 23";
|
extent = "245 23";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
|
|
@ -61,9 +64,9 @@ $guiContent = new GuiControl(RemapDlg) {
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
new GuiTextCtrl() {
|
new GuiTextCtrl() {
|
||||||
text = "Re-bind \"Forward\" to...";
|
text = "Re-bind \"\" to...";
|
||||||
maxLength = "255";
|
maxLength = "255";
|
||||||
position = "259 40";
|
position = "251 24";
|
||||||
extent = "184 23";
|
extent = "184 23";
|
||||||
minExtent = "8 8";
|
minExtent = "8 8";
|
||||||
horizSizing = "center";
|
horizSizing = "center";
|
||||||
|
|
|
||||||
112
Templates/BaseGame/game/data/UI/guis/remapDlg.tscript
Normal file
112
Templates/BaseGame/game/data/UI/guis/remapDlg.tscript
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
function OptRemapInputCtrl::onAxisEvent( %this, %device, %action, %axisVal)
|
||||||
|
{
|
||||||
|
if(%device $= "mouse")
|
||||||
|
return;
|
||||||
|
if(!startsWith(%device,$remapListDevice))
|
||||||
|
return;
|
||||||
|
if(%axisVal != 1 && %axisVal != -1) //we want full presses on sticks to be sure
|
||||||
|
return;
|
||||||
|
|
||||||
|
Canvas.popDialog( RemapDlg );
|
||||||
|
|
||||||
|
%this.doRemap(%device, %action, %axisVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||||
|
{
|
||||||
|
if(!startsWith(%device,$remapListDevice) && %action !$= "escape" && %action !$= "btn_start")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Canvas.popDialog( RemapDlg );
|
||||||
|
|
||||||
|
if(%action $= "escape" || %action $= "btn_start")
|
||||||
|
return;
|
||||||
|
|
||||||
|
%this.doRemap(%device, %action, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function OptRemapInputCtrl::doRemap(%this, %device, %action, %axisVal)
|
||||||
|
{
|
||||||
|
%cmd = $RemapCmd[%this.index];
|
||||||
|
%name = $RemapName[%this.index];
|
||||||
|
%actionMap = $RemapActionMap[%this.index];
|
||||||
|
|
||||||
|
echo("OptRemapInputCtrl::onInputEvent() - remapping details: " @ %cmd @ ", " @ %name @ ", " @ %actionMap @ " remapped to: " @ %device @ ", " @ %action);
|
||||||
|
|
||||||
|
// 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, %device, 0 );
|
||||||
|
unbindExtraActions( %cmd, %actionMap, %device, 1 );
|
||||||
|
|
||||||
|
// If nothing was mapped to the previous command
|
||||||
|
// mapping then it's easy... just bind it.
|
||||||
|
// If the previous command is the same as the
|
||||||
|
// current then they hit the same input as what
|
||||||
|
// was already assigned.
|
||||||
|
if ( %prevMap $= "" || %prevMap $= %cmd )
|
||||||
|
{
|
||||||
|
//unbindExtraActions( %cmd, %actionMap, 1 );
|
||||||
|
%actionMap.bind( %device, %action, %cmd );
|
||||||
|
|
||||||
|
OptionsMenu.populateKBMControls();
|
||||||
|
OptionsMenu.populateGamepadControls();
|
||||||
|
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 );
|
||||||
|
|
||||||
|
%remapWarnText = "\"" @ %mapName @ "\" is already bound to \"" @ %prevCmdName @ "\"! Do you wish to replace this mapping?";
|
||||||
|
%doRemapCommand = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @
|
||||||
|
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
|
||||||
|
%cancelCommand = "";
|
||||||
|
|
||||||
|
MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This unbinds actions beyond %count associated to the
|
||||||
|
/// particular actionMap %commmand.
|
||||||
|
function unbindExtraActions( %command, %actionMap, %device, %count )
|
||||||
|
{
|
||||||
|
%temp = %actionMap.getBinding( %command );
|
||||||
|
if ( %temp $= "" )
|
||||||
|
return;
|
||||||
|
|
||||||
|
%count = getFieldCount( %temp ) - ( %count * 2 );
|
||||||
|
for ( %i = 0; %i < %count; %i += 2 )
|
||||||
|
{
|
||||||
|
%amDevice = getField( %temp, %i + 0 );
|
||||||
|
%action = getField( %temp, %i + 1 );
|
||||||
|
|
||||||
|
if(%device !$= "" || %device $= %amDevice)
|
||||||
|
%actionMap.unbind( %device, %action );
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Templates/BaseGame/game/data/UI/images/backdrop.png
Normal file
BIN
Templates/BaseGame/game/data/UI/images/backdrop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
|
|
@ -0,0 +1,3 @@
|
||||||
|
<ImageAsset
|
||||||
|
AssetName="backdrop_image"
|
||||||
|
imageFile="@assetFile=backdrop.png"/>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<ImageAsset
|
||||||
|
AssetName="textEditFrame_image"
|
||||||
|
imageFile="@assetFile=textEditFrame.png"/>
|
||||||
|
|
@ -205,21 +205,6 @@ function controlSetChanged()
|
||||||
fillRemapList();
|
fillRemapList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function doKeyRemap( %row )
|
|
||||||
{
|
|
||||||
%rowIndex = %row.remapIndex;
|
|
||||||
%name = $RemapName[%rowIndex];
|
|
||||||
|
|
||||||
RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ;
|
|
||||||
OptRemapInputCtrl.index = %rowIndex;
|
|
||||||
Canvas.pushDialog( RemapDlg );
|
|
||||||
|
|
||||||
//Let the options menu know
|
|
||||||
%actionMap = $RemapActionMap[%rowIndex];
|
|
||||||
|
|
||||||
OptionsMenu.onKeybindChanged(%actionMap, %name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ControlsMenuRebindButton::onClick(%this)
|
function ControlsMenuRebindButton::onClick(%this)
|
||||||
{
|
{
|
||||||
%name = $RemapName[%this.keybindIndex];
|
%name = $RemapName[%this.keybindIndex];
|
||||||
|
|
@ -230,89 +215,6 @@ function ControlsMenuRebindButton::onClick(%this)
|
||||||
Canvas.pushDialog( RemapDlg );
|
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 );
|
|
||||||
|
|
||||||
%remapWarnText = "\"" @ %mapName @ "\" is already bound to \"" @ %prevCmdName @ "\"! Do you wish to replace this mapping?";
|
|
||||||
%doRemapCommand = "redoMapping(" @ %device @ ", " @ %actionMap @ ", \"" @ %action @ "\", \"" @
|
|
||||||
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ "); Canvas.popDialog();";
|
|
||||||
%cancelCommand = "Canvas.popDialog();";
|
|
||||||
|
|
||||||
MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );
|
|
||||||
}
|
|
||||||
|
|
||||||
function findRemapCmdIndex( %command )
|
function findRemapCmdIndex( %command )
|
||||||
{
|
{
|
||||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||||
|
|
@ -323,23 +225,6 @@ function findRemapCmdIndex( %command )
|
||||||
return( -1 );
|
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 )
|
function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -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);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
@ -1,557 +1,229 @@
|
||||||
$TextMediumEmphasisColor = "200 200 200";
|
$TextMediumEmphasisColor = "200 200 200";
|
||||||
|
$TextMediumEmphasisColorHL = "0 0 0";
|
||||||
$TextHighEmphasisColor = "224 224 224";
|
$TextHighEmphasisColor = "224 224 224";
|
||||||
|
$TextHighEmphasisColorHL = "0 0 0";
|
||||||
$TextDisabledColor = "108 108 108";
|
$TextDisabledColor = "108 108 108";
|
||||||
|
|
||||||
new GuiGameListMenuProfile(DefaultListMenuProfile)
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// Defaults
|
||||||
fontType = "Arial Bold";
|
// ---------------------------------------------------------------------------
|
||||||
fontSize = 20;
|
singleton GuiControlProfile( GuiMenuDefaultProfile )
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
new GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText)
|
|
||||||
{
|
|
||||||
justify = "center";
|
|
||||||
};
|
|
||||||
|
|
||||||
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 = "49 34 37";
|
|
||||||
fillColorNA = "40 40 40";
|
|
||||||
borderColor = "87 87 87";
|
|
||||||
borderColorNA = "0 0 0";
|
|
||||||
borderColorHL = "194 64 64";
|
|
||||||
fixedExtent = false;
|
|
||||||
justify = "center";
|
|
||||||
canKeyFocus = false;
|
|
||||||
//bitmapAsset = "UI:menu_button_image";
|
|
||||||
hasBitmapArray = false;
|
|
||||||
soundButtonDown = "UI:buttonClick";
|
|
||||||
soundButtonOver = "UI:buttonHover";
|
|
||||||
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( GuiJoinServerButtonProfile ) )
|
|
||||||
new GuiControlProfile( GuiJoinServerButtonProfile : GuiMenuButtonProfile )
|
|
||||||
{
|
|
||||||
justify = "left";
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
opaque = false;
|
||||||
border = false;
|
fillColor = "0 0 0 0";
|
||||||
category = "Core";
|
category = "BaseUI";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiGroupBorderProfile ) )
|
singleton GuiControlProfile( GuiModelessDialogProfile : GuiMenuDefaultProfile )
|
||||||
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;
|
modal = false;
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiFrameSetProfile ) )
|
singleton GuiControlProfile(GuiMenuBackgroundProfile)
|
||||||
new GuiControlProfile (GuiFrameSetProfile)
|
|
||||||
{
|
{
|
||||||
fillcolor = "255 255 255";
|
category = "BaseUI";
|
||||||
borderColor = "246 245 244";
|
|
||||||
border = 1;
|
|
||||||
opaque = true;
|
opaque = true;
|
||||||
border = true;
|
fillcolor = "34 34 34 255";
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiInputCtrlProfile ) )
|
singleton GuiControlProfile(GuiMenuPanelProfile)
|
||||||
new GuiControlProfile( GuiInputCtrlProfile )
|
|
||||||
{
|
{
|
||||||
tab = true;
|
category = "BaseUI";
|
||||||
canKeyFocus = true;
|
opaque = true;
|
||||||
category = "Core";
|
fillcolor = "15 15 15 255";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiTextProfile ) )
|
singleton GuiControlProfile(GuiMenuBasePanelProfile)
|
||||||
new GuiControlProfile (GuiTextProfile)
|
|
||||||
{
|
{
|
||||||
|
category = "BaseUI";
|
||||||
|
opaque = true;
|
||||||
|
fillcolor = "40 40 40 255";
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Text
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
singleton GuiControlProfile(MenuHeaderText)
|
||||||
|
{
|
||||||
|
fontType = "Arial Bold";
|
||||||
|
fontSize = 36;
|
||||||
|
fontColor = $TextHighEmphasisColor;
|
||||||
justify = "left";
|
justify = "left";
|
||||||
fontColor = "20 20 20";
|
modal = false;
|
||||||
category = "Core";
|
category = "BaseUI";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiTextRightProfile ) )
|
singleton GuiControlProfile(MenuHeaderTextHighlighted : MenuHeaderText)
|
||||||
new GuiControlProfile (GuiTextRightProfile : GuiTextProfile)
|
|
||||||
{
|
{
|
||||||
justify = "right";
|
fontColor = $TextHighEmphasisColorHL;
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiAutoSizeTextProfile ) )
|
singleton GuiControlProfile(MenuHeaderTextCenter : MenuHeaderText)
|
||||||
new GuiControlProfile (GuiAutoSizeTextProfile)
|
|
||||||
{
|
{
|
||||||
fontColor = "0 0 0";
|
justify = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile(MenuSubHeaderText)
|
||||||
|
{
|
||||||
|
fontType = "Arial Bold";
|
||||||
|
fontSize = 24;
|
||||||
|
fontColor = $TextMediumEmphasisColor;
|
||||||
|
justify = "left";
|
||||||
|
modal = false;
|
||||||
|
category = "BaseUI";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile(MenuSubHeaderTextHighlighted : MenuSubHeaderText)
|
||||||
|
{
|
||||||
|
fontColor = $TextMediumEmphasisColorHL;
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile(MenuSubHeaderCenteredText : MenuSubHeaderText)
|
||||||
|
{
|
||||||
|
justify = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile(MenuSubHeaderCenteredTextHighlighted : MenuSubHeaderCenteredText)
|
||||||
|
{
|
||||||
|
fontColor = $TextMediumEmphasisColorHL;
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile(MenuMLSubHeaderText)
|
||||||
|
{
|
||||||
|
fontType = "Arial Bold";
|
||||||
|
fontSize = 20;
|
||||||
|
fontColor = $TextMediumEmphasisColor;
|
||||||
|
justify = "left";
|
||||||
autoSizeWidth = true;
|
autoSizeWidth = true;
|
||||||
autoSizeHeight = true;
|
autoSizeHeight = true;
|
||||||
category = "Core";
|
modal = false;
|
||||||
|
category = "BaseUI";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiMediumTextProfile ) )
|
singleton GuiControlProfile(MenuMLSubHeaderTextCenter : MenuMLSubHeaderText)
|
||||||
new GuiControlProfile( GuiMediumTextProfile : GuiTextProfile )
|
|
||||||
{
|
{
|
||||||
fontSize = 24;
|
justify = "center";
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiBigTextProfile ) )
|
singleton GuiControlProfile( GuiMenuTextProfile )
|
||||||
new GuiControlProfile( GuiBigTextProfile : GuiTextProfile )
|
|
||||||
{
|
{
|
||||||
fontSize = 36;
|
opaque = true;
|
||||||
category = "Core";
|
border = false;
|
||||||
|
fontSize = 18;
|
||||||
|
fontType = "Arial Bold";
|
||||||
|
fontColor = "240 240 240";
|
||||||
|
fontColorHL = "0 0 0";
|
||||||
|
fontColorNA = "125 125 125";
|
||||||
|
fixedExtent = false;
|
||||||
|
justify = "center";
|
||||||
|
category = "BaseUI";
|
||||||
|
modal = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiMLTextProfile ) )
|
singleton GuiControlProfile( GuiMenuTextProfileHL : GuiMenuTextProfile )
|
||||||
new GuiControlProfile( GuiMLTextProfile )
|
{
|
||||||
|
fontColor = "0 0 0";
|
||||||
|
};
|
||||||
|
|
||||||
|
singleton GuiControlProfile( GuiMLTextProfile )
|
||||||
{
|
{
|
||||||
fontColor = $TextMediumEmphasisColor;
|
fontColor = $TextMediumEmphasisColor;
|
||||||
fontColorHL = $TextMediumEmphasisColor;
|
fontColorHL = $TextMediumEmphasisColor;
|
||||||
fontColorSEL = $TextMediumEmphasisColor;
|
fontColorSEL = $TextMediumEmphasisColor;
|
||||||
fontColorNA = $TextDisabledColor;
|
fontColorNA = $TextDisabledColor;
|
||||||
|
|
||||||
|
fontSize = 20;
|
||||||
fontColorLink = "100 100 100";
|
fontColorLink = "100 100 100";
|
||||||
fontColorLinkHL = $TextMediumEmphasisColor;
|
fontColorLinkHL = $TextMediumEmphasisColor;
|
||||||
autoSizeWidth = true;
|
autoSizeWidth = true;
|
||||||
autoSizeHeight = true;
|
autoSizeHeight = true;
|
||||||
border = false;
|
border = false;
|
||||||
category = "Core";
|
modal = false;
|
||||||
|
category = "BaseUI";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiMLWhiteTextProfile ) )
|
singleton GuiControlProfile( GuiMLTextProfileHighlighted : GuiMLTextProfile )
|
||||||
new GuiControlProfile( GuiMLWhiteTextProfile )
|
|
||||||
{
|
{
|
||||||
fontColor = "220 220 220";
|
fontColor = $TextMediumEmphasisColorHL;
|
||||||
fontColorHL = $TextMediumEmphasisColor;
|
|
||||||
autoSizeWidth = true;
|
|
||||||
autoSizeHeight = true;
|
|
||||||
border = false;
|
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiTextArrayProfile ) )
|
// ---------------------------------------------------------------------------
|
||||||
new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile )
|
// Interactive Controls
|
||||||
{
|
// ---------------------------------------------------------------------------
|
||||||
fontColor = $TextMediumEmphasisColor;
|
singleton GuiControlProfile( GuiMenuButtonProfile )
|
||||||
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;
|
opaque = true;
|
||||||
border = true;
|
border = false;
|
||||||
fontColor = "0 0 0";
|
fontSize = 24;
|
||||||
fontColorHL = "0 0 0";
|
fontType = "Arial Bold";
|
||||||
fontColorNA = "255 255 255";
|
fontColor = "200 200 200 255";
|
||||||
fixedExtent = false;
|
fontColorHL = "0 0 0 255";
|
||||||
|
fontColorNA = "108 108 108 255";
|
||||||
|
fontColorSEL = "200 200 200 255";
|
||||||
|
fillColor = "0 0 0 0";
|
||||||
|
fillColorHL = "255 255 255 255";
|
||||||
|
fillColorNA = "40 40 40";
|
||||||
|
borderColor = "87 87 87";
|
||||||
|
borderColorNA = "0 0 0";
|
||||||
|
borderColorHL = "194 64 64";
|
||||||
|
fixedExtent = 0;
|
||||||
justify = "center";
|
justify = "center";
|
||||||
canKeyFocus = false;
|
canKeyFocus = false;
|
||||||
bitmapAsset = "UI:menubutton_image";
|
hasBitmapArray = false;
|
||||||
category = "Core";
|
soundButtonDown = "UI:buttonClick";
|
||||||
|
soundButtonOver = "UI:buttonHover";
|
||||||
|
category = "BaseUI";
|
||||||
|
fontColors[0] = "200 200 200 255";
|
||||||
|
fontColors[2] = "108 108 108 255";
|
||||||
|
fontColors[3] = "200 200 200 255";
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiPopUpMenuDefault ) )
|
singleton GuiControlProfile( GuiMenuButtonLeftJustProfile : GuiMenuButtonProfile )
|
||||||
new GuiControlProfile( GuiPopUpMenuDefault : GuiDefaultProfile )
|
|
||||||
{
|
{
|
||||||
opaque = true;
|
justify = "Left";
|
||||||
mouseOverSelected = true;
|
|
||||||
textOffset = "3 3";
|
|
||||||
border = 0;
|
|
||||||
borderThickness = 0;
|
|
||||||
fixedExtent = true;
|
|
||||||
hasBitmapArray = true;
|
|
||||||
|
|
||||||
fillColor = EditorSettings.value("Theme/fieldBGColor");//"255 255 255";//100
|
|
||||||
fillColorHL = EditorSettings.value("Theme/fieldBGHLColor");//"91 101 116";
|
|
||||||
fillColorSEL = EditorSettings.value("Theme/fieldBGSELColor");//"91 101 116";
|
|
||||||
fontColor = EditorSettings.value("Theme/fieldTextColor");//"215 215 215";
|
|
||||||
fontColorHL = EditorSettings.value("Theme/fieldTextHLColor");//"215 215 215";
|
|
||||||
fontColorSEL = EditorSettings.value("Theme/fieldTextSELColor");//"215 215 215";
|
|
||||||
fontColorNA = EditorSettings.value("Theme/fieldTextColor");//"215 215 215";
|
|
||||||
borderColor = EditorSettings.value("Theme/dividerDarkColor");
|
|
||||||
profileForChildren = GuiPopupMenuItemBorder;
|
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiPopUpMenuProfile ) )
|
singleton GuiControlProfile( GuiRemapActionMapButtonProfile : GuiMenuButtonProfile )
|
||||||
new GuiControlProfile( GuiPopUpMenuProfile : GuiPopUpMenuDefault )
|
|
||||||
{
|
{
|
||||||
textOffset = "6 4";
|
fillColor = "18 18 18 255";
|
||||||
bitmapAsset = "UI:dropDown_image";
|
fillColorHL = "0 0 0 255";
|
||||||
hasBitmapArray = true;
|
modal = false;
|
||||||
border = 1;
|
|
||||||
profileForChildren = GuiPopUpMenuDefault;
|
|
||||||
category = "Core";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !isObject( GuiTabBookProfile ) )
|
singleton GuiControlProfile(GuiMenuScrollProfile)
|
||||||
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;
|
opaque = false;
|
||||||
fillColor = "128 128 128";
|
fillcolor = "0 0 0 0";
|
||||||
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";
|
fontColor = "200 200 200";
|
||||||
fontColorHL = "250 250 250";
|
fontColorHL = "250 250 250";
|
||||||
border = false;
|
border = false;
|
||||||
bitmapAsset = "UI:scrollBar_image";
|
bitmapAsset = "UI:scrollBar_image";
|
||||||
hasBitmapArray = true;
|
hasBitmapArray = true;
|
||||||
category = "Core";
|
category = "BaseUI";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Scroll
|
new GuiControlProfile(MenuTextEditprofile)
|
||||||
if(!isObject(GuiMenuScrollProfile))
|
|
||||||
new GuiControlProfile(GuiMenuScrollProfile)
|
|
||||||
{
|
{
|
||||||
opaque = true;
|
opaque = true;
|
||||||
fillcolor = "128 128 128";
|
fillColor = "10 10 10 255";
|
||||||
fontColor = "0 0 0";
|
fillColorHL = "10 10 10 255";
|
||||||
fontColorHL = "150 150 150";
|
fontColor = "240 240 240";
|
||||||
border = true;
|
fontColorHL = "10 10 10 255";
|
||||||
bitmapAsset = "UI:scrollBar_image";
|
fontColorSEL = "255 255 255 255";
|
||||||
hasBitmapArray = true;
|
fontColorNA = "200 200 200";
|
||||||
category = "Core";
|
textOffset = "4 2";
|
||||||
};
|
autoSizeWidth = false;
|
||||||
|
autoSizeHeight = true;
|
||||||
singleton GuiControlProfile(SliderBitmapGUIProfile)
|
justify = "left";
|
||||||
{
|
tab = true;
|
||||||
bitmapAsset = "UI:optionsMenuSliderBitmapArray_image";
|
canKeyFocus = true;
|
||||||
hasBitmapArray = true;
|
category = "BaseUI";
|
||||||
opaque = false;
|
borderColorSEL = "0 0 0 0";
|
||||||
borderColor = "0 0 0 255";
|
fontColors[0] = "240 240 240 255";
|
||||||
|
fontColors[1] = "10 10 10 255";
|
||||||
|
fontColors[2] = "200 200 200 255";
|
||||||
|
fontColors[3] = "255 255 255 255";
|
||||||
|
fillColorSEL = "10 10 10 255";
|
||||||
|
fontSize = "18";
|
||||||
|
cursorColor = "255 255 255 255";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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)
|
function getButtonBitmap(%device, %button)
|
||||||
{
|
{
|
||||||
if(%device $= "gamepad")
|
if(%device $= "gamepad")
|
||||||
|
|
@ -23,13 +45,13 @@ function getButtonBitmap(%device, %button)
|
||||||
%assetId = %assetId @ "Square";
|
%assetId = %assetId @ "Square";
|
||||||
else if(%button $= "Y" || %button $= "btn_y")
|
else if(%button $= "Y" || %button $= "btn_y")
|
||||||
%assetId = %assetId @ "Triangle";
|
%assetId = %assetId @ "Triangle";
|
||||||
else if(%button $= "LB")
|
else if(%button $= "LB" || %button $= "btn_l")
|
||||||
%assetId = %assetId @ "L1";
|
%assetId = %assetId @ "L1";
|
||||||
else if(%button $= "LT")
|
else if(%button $= "LT" || %button $= "btn_lt")
|
||||||
%assetId = %assetId @ "L2";
|
%assetId = %assetId @ "L2";
|
||||||
else if(%button $= "RB")
|
else if(%button $= "RB" || %button $= "btn_r")
|
||||||
%assetId = %assetId @ "R1";
|
%assetId = %assetId @ "R1";
|
||||||
else if(%button $= "RT")
|
else if(%button $= "RT" || %button $= "btn_rt")
|
||||||
%assetId = %assetId @ "R2";
|
%assetId = %assetId @ "R2";
|
||||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||||
%assetId = %assetId @ "Right_Stick";
|
%assetId = %assetId @ "Right_Stick";
|
||||||
|
|
@ -62,13 +84,13 @@ function getButtonBitmap(%device, %button)
|
||||||
%assetId = %assetId @ "Y";
|
%assetId = %assetId @ "Y";
|
||||||
else if(%button $= "Y" || %button $= "btn_y")
|
else if(%button $= "Y" || %button $= "btn_y")
|
||||||
%assetId = %assetId @ "X";
|
%assetId = %assetId @ "X";
|
||||||
else if(%button $= "LB")
|
else if(%button $= "LB" || %button $= "btn_l")
|
||||||
%assetId = %assetId @ "LB";
|
%assetId = %assetId @ "LB";
|
||||||
else if(%button $= "LT")
|
else if(%button $= "LT" || %button $= "btn_lt")
|
||||||
%assetId = %assetId @ "LT";
|
%assetId = %assetId @ "LT";
|
||||||
else if(%button $= "RB")
|
else if(%button $= "RB" || %button $= "btn_r")
|
||||||
%assetId = %assetId @ "RB";
|
%assetId = %assetId @ "RB";
|
||||||
else if(%button $= "RT")
|
else if(%button $= "RT" || %button $= "btn_rt")
|
||||||
%assetId = %assetId @ "RT";
|
%assetId = %assetId @ "RT";
|
||||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||||
%assetId = %assetId @ "Right_Stick";
|
%assetId = %assetId @ "Right_Stick";
|
||||||
|
|
@ -91,6 +113,9 @@ function getButtonBitmap(%device, %button)
|
||||||
}
|
}
|
||||||
else if(%device $= "Keyboard" || %device $= "Mouse")
|
else if(%device $= "Keyboard" || %device $= "Mouse")
|
||||||
{
|
{
|
||||||
|
if(%button $= "lshift" || %button $= "rshift")
|
||||||
|
%button = "shift";
|
||||||
|
|
||||||
%assetId = "UI:Keyboard_Black_" @ %button @ "_image";
|
%assetId = "UI:Keyboard_Black_" @ %button @ "_image";
|
||||||
}
|
}
|
||||||
else if(%device !$= "")
|
else if(%device !$= "")
|
||||||
|
|
@ -98,13 +123,21 @@ function getButtonBitmap(%device, %button)
|
||||||
%assetId = "UI:Xbox_";
|
%assetId = "UI:Xbox_";
|
||||||
|
|
||||||
if(%button $= "btn_a")
|
if(%button $= "btn_a")
|
||||||
%assetId = %assetId @ "B";
|
|
||||||
else if(%button $= "btn_b")
|
|
||||||
%assetId = %assetId @ "A";
|
%assetId = %assetId @ "A";
|
||||||
|
else if(%button $= "btn_b")
|
||||||
|
%assetId = %assetId @ "B";
|
||||||
else if(%button $= "btn_x")
|
else if(%button $= "btn_x")
|
||||||
%assetId = %assetId @ "Y";
|
|
||||||
else if(%button $= "btn_y")
|
|
||||||
%assetId = %assetId @ "X";
|
%assetId = %assetId @ "X";
|
||||||
|
else if(%button $= "btn_y")
|
||||||
|
%assetId = %assetId @ "Y";
|
||||||
|
else if(%button $= "LB" || %button $= "btn_l")
|
||||||
|
%assetId = %assetId @ "LB";
|
||||||
|
else if(%button $= "LT" || %button $= "btn_lt")
|
||||||
|
%assetId = %assetId @ "LT";
|
||||||
|
else if(%button $= "RB" || %button $= "btn_r")
|
||||||
|
%assetId = %assetId @ "RB";
|
||||||
|
else if(%button $= "RT" || %button $= "btn_rt")
|
||||||
|
%assetId = %assetId @ "RT";
|
||||||
else if(%button $= "thumbrx" || %button $= "thumbry")
|
else if(%button $= "thumbrx" || %button $= "thumbry")
|
||||||
%assetId = %assetId @ "Right_Stick";
|
%assetId = %assetId @ "Right_Stick";
|
||||||
else if(%button $= "thumblx" || %button $= "thumbly")
|
else if(%button $= "thumblx" || %button $= "thumbly")
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ new VPathEditor(EVPathEditor) {
|
||||||
};
|
};
|
||||||
new GuiPopUpMenuCtrl(EPathEditorNodeOrientationMode){
|
new GuiPopUpMenuCtrl(EPathEditorNodeOrientationMode){
|
||||||
internalName = "weight";
|
internalName = "weight";
|
||||||
Profile = "GuiPopUpMenuProfile";
|
Profile = "ToolsGuiPopUpMenuProfile";
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = "57 84";
|
Position = "57 84";
|
||||||
|
|
@ -385,7 +385,7 @@ new VPathEditor(EVPathEditor) {
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
Enabled = "1";
|
Enabled = "1";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
Profile = "GuiTransparentProfile";
|
Profile = "ToolsGuiTransparentProfile";
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = "1 1";
|
Position = "1 1";
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ $guiContent = new GuiControl(VPathEditorToolbar)
|
||||||
new GuiTextCtrl()
|
new GuiTextCtrl()
|
||||||
{
|
{
|
||||||
internalName = "ToolbarLabel";
|
internalName = "ToolbarLabel";
|
||||||
profile = "GuiTextProfile";
|
profile = "ToolsGuiTextProfile";
|
||||||
horizSizing = "right";
|
horizSizing = "right";
|
||||||
vertSizing = "bottom";
|
vertSizing = "bottom";
|
||||||
position = "2 7";
|
position = "2 7";
|
||||||
|
|
@ -48,7 +48,7 @@ $guiContent = new GuiControl(VPathEditorToolbar)
|
||||||
internalName = "PathTypeMenu";
|
internalName = "PathTypeMenu";
|
||||||
Enabled = "1";
|
Enabled = "1";
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
Profile = "GuiPopUpMenuProfile";
|
Profile = "ToolsGuiPopUpMenuProfile";
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = "85 7";
|
Position = "85 7";
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ singleton GuiControlProfile( VEditorTextEditProfile : VEditorDefaultProfile )
|
||||||
canKeyFocus = true;
|
canKeyFocus = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
singleton GuiControlProfile( VEditorPopupMenuProfile : GuiPopUpMenuProfile )
|
singleton GuiControlProfile( VEditorPopupMenuProfile : ToolsGuiPopUpMenuProfile )
|
||||||
{
|
{
|
||||||
FillColorHL = "90 90 90";
|
FillColorHL = "90 90 90";
|
||||||
FillColorSEL = "0 0 0";
|
FillColorSEL = "0 0 0";
|
||||||
|
|
@ -204,7 +204,7 @@ singleton GuiControlProfile( VEditorPropertyLabelProfile : VEditorTextProfile )
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
singleton GuiControlProfile( VEditorPreferenceLabelProfile : GuiTextProfile )
|
singleton GuiControlProfile( VEditorPreferenceLabelProfile : ToolsGuiTextProfile )
|
||||||
{
|
{
|
||||||
opaque = true;
|
opaque = true;
|
||||||
fillColor = "242 241 240";
|
fillColor = "242 241 240";
|
||||||
|
|
|
||||||
|
|
@ -2420,7 +2420,7 @@ function AssetBrowserPreviewButton::onMouseDragged(%this)
|
||||||
%ctrl = new GuiDragAndDropControl()
|
%ctrl = new GuiDragAndDropControl()
|
||||||
{
|
{
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
Profile = "GuiSolidDefaultProfile";
|
Profile = "ToolsGuiSolidDefaultProfile";
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = %xPos SPC %yPos;
|
Position = %xPos SPC %yPos;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ $guiContent = new GuiControl(IODropdownDlg) {
|
||||||
};
|
};
|
||||||
new GuiBitmapBorderCtrl() {
|
new GuiBitmapBorderCtrl() {
|
||||||
isContainer = "0";
|
isContainer = "0";
|
||||||
profile = "GuiGroupBorderProfile";
|
profile = "ToolsGuiGroupBorderProfile";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "bottom";
|
vertSizing = "bottom";
|
||||||
position = "7 51";
|
position = "7 51";
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ $guiContent = new GuiControl(RenderTargetVisualizer) {
|
||||||
minExtent = "8 2";
|
minExtent = "8 2";
|
||||||
horizSizing = "right";
|
horizSizing = "right";
|
||||||
vertSizing = "bottom";
|
vertSizing = "bottom";
|
||||||
profile = "GuiModelessDialogProfile";
|
profile = "ToolsGuiModelessDialogProfile";
|
||||||
visible = "1";
|
visible = "1";
|
||||||
active = "1";
|
active = "1";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
@ -79,7 +79,7 @@ $guiContent = new GuiControl(RenderTargetVisualizer) {
|
||||||
minExtent = "8 2";
|
minExtent = "8 2";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "bottom";
|
vertSizing = "bottom";
|
||||||
profile = "GuiPopUpMenuProfile";
|
profile = "ToolsGuiPopUpMenuProfile";
|
||||||
visible = "1";
|
visible = "1";
|
||||||
active = "1";
|
active = "1";
|
||||||
command = "RenderTargetsList.updateTarget();";
|
command = "RenderTargetsList.updateTarget();";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
<LevelAsset
|
<LevelAsset
|
||||||
canSave="true"
|
|
||||||
canSaveDynamicFields="true"
|
|
||||||
AssetName="DefaultEditorLevel"
|
AssetName="DefaultEditorLevel"
|
||||||
LevelFile="@assetFile=DefaultEditorLevel.mis"
|
LevelFile="@assetFile=DefaultEditorLevel.mis"
|
||||||
LevelName="DefaultEditorLevel"
|
LevelName="DefaultEditorLevel"
|
||||||
isSubScene="false"
|
|
||||||
description="An empty room"
|
description="An empty room"
|
||||||
previewImageAsset0="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
previewImageAsset0="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
||||||
previewImageAsset1="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
previewImageAsset1="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
||||||
|
|
@ -14,5 +11,4 @@
|
||||||
previewImageAsset5="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
previewImageAsset5="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
||||||
previewImageAsset6="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
previewImageAsset6="@asset=ToolsModule:DefaultEditorLevel_preview_image"
|
||||||
staticObjectAssetDependency0="@asset=Prototyping:FloorGray"
|
staticObjectAssetDependency0="@asset=Prototyping:FloorGray"
|
||||||
staticObjectAssetDependency1="@asset=FPSGameplay:soldier_rigged"
|
|
||||||
VersionId="1"/>
|
VersionId="1"/>
|
||||||
|
|
|
||||||
|
|
@ -2619,7 +2619,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
hovertime = "1000";
|
hovertime = "1000";
|
||||||
|
|
||||||
new GuiContainer(){ // enable/disable
|
new GuiContainer(){ // enable/disable
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -2652,7 +2652,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
|
|
||||||
new GuiContainer(){ // scale
|
new GuiContainer(){ // scale
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -2735,7 +2735,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
|
|
||||||
new GuiContainer(){ // direction
|
new GuiContainer(){ // direction
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -2817,7 +2817,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer(){ // strength
|
new GuiContainer(){ // strength
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -2899,7 +2899,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer(){ // coverage
|
new GuiContainer(){ // coverage
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -2981,7 +2981,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer(){ // specular
|
new GuiContainer(){ // specular
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 24";
|
Extent = "300 24";
|
||||||
|
|
@ -3063,7 +3063,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
new GuiContainer(){ // empty space
|
new GuiContainer(){ // empty space
|
||||||
profile="GuiTransparentProfile";
|
profile="ToolsGuiTransparentProfile";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
position = "0 0";
|
position = "0 0";
|
||||||
Extent = "300 10";
|
Extent = "300 10";
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
Enabled = "1";
|
Enabled = "1";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
Profile = "GuiTransparentProfile";
|
Profile = "ToolsGuiTransparentProfile";
|
||||||
HorizSizing = "width";
|
HorizSizing = "width";
|
||||||
VertSizing = "height";
|
VertSizing = "height";
|
||||||
Position = "1 1";
|
Position = "1 1";
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ $guiContent = new GuiTabPageCtrl(ENavEditorSettingsPage) {
|
||||||
minExtent = "8 2";
|
minExtent = "8 2";
|
||||||
horizSizing = "width";
|
horizSizing = "width";
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiSolidDefaultProfile";
|
profile = "ToolsGuiSolidDefaultProfile";
|
||||||
visible = "1";
|
visible = "1";
|
||||||
active = "1";
|
active = "1";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
<Setting
|
<Setting
|
||||||
name="doubleClickAction">Edit Asset</Setting>
|
name="doubleClickAction">Edit Asset</Setting>
|
||||||
<Setting
|
<Setting
|
||||||
name="LastPosExt">0 1047 2200 360</Setting>
|
name="LastPosExt">0 976 2200 360</Setting>
|
||||||
<Setting
|
<Setting
|
||||||
name="previewTileSize">1</Setting>
|
name="previewTileSize">1</Setting>
|
||||||
<Setting
|
<Setting
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
<Setting
|
<Setting
|
||||||
name="lastPath">tools/RPGDialogEditor/gui</Setting>
|
name="lastPath">tools/RPGDialogEditor/gui</Setting>
|
||||||
<Setting
|
<Setting
|
||||||
name="previewResolution">1024 768</Setting>
|
name="previewResolution">1280 720</Setting>
|
||||||
<Group
|
<Group
|
||||||
name="EngineDevelopment">
|
name="EngineDevelopment">
|
||||||
<Setting
|
<Setting
|
||||||
|
|
@ -125,11 +125,6 @@
|
||||||
<Setting
|
<Setting
|
||||||
name="documentationURL">https://docs.torque3d.org</Setting>
|
name="documentationURL">https://docs.torque3d.org</Setting>
|
||||||
</Group>
|
</Group>
|
||||||
<Group
|
|
||||||
name="Library">
|
|
||||||
<Setting
|
|
||||||
name="viewType">Categorized</Setting>
|
|
||||||
</Group>
|
|
||||||
<Group
|
<Group
|
||||||
name="Rendering">
|
name="Rendering">
|
||||||
<Setting
|
<Setting
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
$guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) {
|
$guiContent = new GuiControl(AL_ShadowVizOverlayCtrl) {
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
Profile = "GuiModelessDialogProfile";
|
Profile = "ToolsGuiModelessDialogProfile";
|
||||||
HorizSizing = "right";
|
HorizSizing = "right";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = "0 0";
|
Position = "0 0";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue