TribesReplay/base/scripts/commonDialogs.cs
Robert MacGregor 116be1648d v22460 (04/13/01):
**Tweak, Spider Clamp turrets need more Surface area for legal deploy space now**:

*Minor tweak to improve long-term server stability.
*A new voice Codec, 'GSM' was added to allow voice communication between Linux and Windows users.
*Minor Sound system tweaks and fixes.
*Minor BOT navigation and seeking improvements.
*Fix removing BOTs counting toward the Vote Meter representation.
*Improvement for Vehicle Physics, particularly instances when Vehicles would get stuck on their edge.
*Fix for BOT's skins not dynamically updating to correct team skin, when Admin team changed them.
*Fixed bug where certain cases would cause Cursor to vanish when it should not.
*Minor Server query improvements.
*Fix Players can be added to the 'Admin List'.
*No more voting to BAN, only Super ADMIN may now BAN.
*Various GUI improvements, notably the Voice Com. elements in the Lobby, and some minor pointer Icon improvements for certain cases.
*Linux 'Penguin' Symbol added for Server List Screen when joining, so users may identify Windows and Linux servers at a glance.
2017-07-17 23:10:36 -04:00

195 lines
6.8 KiB
C#

//------------------------------------------------------------------------------
//
// commonDialogs.cs
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// MessageBox OK dialog:
//------------------------------------------------------------------------------
function MessageBoxOK( %title, %message, %callback )
{
MBOKFrame.setTitle( %title );
MBOKText.setText( "<just:center>" @ %message );
MessageBoxOKDlg.callback = %callback;
Canvas.pushDialog( MessageBoxOKDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox OK/Cancel dialog:
//------------------------------------------------------------------------------
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
{
MBOKCancelFrame.setTitle( %title );
MBOKCancelText.setText( "<just:center>" @ %message );
MessageBoxOKCancelDlg.callback = %callback;
MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
Canvas.pushDialog( MessageBoxOKCancelDlg );
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxOKCancelDlg::onSleep( %this )
{
%this.callback = "";
}
//------------------------------------------------------------------------------
// MessageBox Yes/No dialog:
//------------------------------------------------------------------------------
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
{
MBYesNoFrame.setTitle( %title );
MBYesNoText.setText( "<just:center>" @ %message );
MessageBoxYesNoDlg.yesCallBack = %yesCallback;
MessageBoxYesNoDlg.noCallback = %noCallBack;
Canvas.pushDialog( MessageBoxYesNoDlg );
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function MessageBoxYesNoDlg::onSleep( %this )
{
%this.yesCallback = "";
%this.noCallback = "";
}
//------------------------------------------------------------------------------
// Message popup dialog:
//------------------------------------------------------------------------------
function MessagePopup( %title, %message, %delay )
{
// Currently two lines max.
MessagePopFrame.setTitle( %title );
MessagePopText.setText( "<just:center>" @ %message );
Canvas.pushDialog( MessagePopupDlg );
if ( %delay !$= "" )
schedule( %delay, 0, CloseMessagePopup );
}
//------------------------------------------------------------------------------
function CloseMessagePopup()
{
Canvas.popDialog( MessagePopupDlg );
}
//------------------------------------------------------------------------------
// Pick Team dialog:
//------------------------------------------------------------------------------
function PickTeamDlg::onWake( %this )
{
}
//------------------------------------------------------------------------------
function PickTeamDlg::onSleep( %this )
{
}
//------------------------------------------------------------------------------
// ex: ShellGetLoadFilename( "stuff\*.*", isLoadable, loadStuff );
// -- only adds files that pass isLoadable
// -- calls 'loadStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetLoadFilename( %title, %fileSpec, %validate, %callback )
{
$loadFileCommand = %callback @ "( getField( LOAD_FileList.getValue(), 0 ) );";
if ( %title $= "" )
LOAD_Title.setTitle( "LOAD FILE" );
else
LOAD_Title.setTitle( %title );
LOAD_LoadBtn.setActive( false );
Canvas.pushDialog( ShellLoadFileDlg );
fillLoadSaveList( LOAD_FileList, %fileSpec, %validate, false );
}
//------------------------------------------------------------------------------
function fillLoadSaveList( %ctrl, %fileSpec, %validate, %isSave )
{
%ctrl.clear();
%id = 0;
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
{
if ( %validate $= "" || call( %validate, %file ) )
{
%ctrl.addRow( %id, fileBase( %file ) TAB %file );
if ( %isSave )
{
if ( !isWriteableFileName( "base/" @ %file ) )
%ctrl.setRowActive( %id, false );
}
%id++;
}
}
%ctrl.sort( 0 );
}
//------------------------------------------------------------------------------
function LOAD_FileList::onSelect( %this, %id, %text )
{
LOAD_LoadBtn.setActive( true );
}
//------------------------------------------------------------------------------
// ex: ShellGetSaveFilename( "stuff\*.*", isLoadable, saveStuff, currentName );
// -- only adds files to list that pass isLoadable
// -- calls 'saveStuff(%filename)' on dblclick or ok
//------------------------------------------------------------------------------
function ShellGetSaveFilename( %title, %fileSpec, %validate, %callback, %current )
{
SAVE_FileName.setValue( %current );
$saveFileCommand = "if ( SAVE_FileName.getValue() !$= \"\" ) " @ %callback @ "( SAVE_FileName.getValue() );";
if ( %title $= "" )
SAVE_Title.setTitle( "SAVE FILE" );
else
SAVE_Title.setTitle( %title );
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %current @ $loadSaveExt ) );
Canvas.pushDialog( ShellSaveFileDlg );
fillLoadSaveList( SAVE_FileList, %fileSpec, %validate, true );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onSelect( %this, %id, %text )
{
if ( %this.isRowActive( %id ) )
SAVE_FileName.setValue( getField( %this.getValue(), 0 ) );
}
//------------------------------------------------------------------------------
function SAVE_FileList::onDoubleClick( %this )
{
%id = %this.getSelectedId();
if ( %this.isRowActive( %id ) )
{
eval( $saveFileCommand );
Canvas.popDialog( ShellSaveFileDlg );
}
}
//------------------------------------------------------------------------------
function SAVE_FileName::checkValid( %this )
{
// Right now this validation stuff is worthless...
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %this.getValue() @ $loadSaveExt ) );
}