Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -1,25 +1,14 @@
using System;
namespace Server.Gumps
{
public delegate void WarningGumpCallback( Mobile from, bool okay, object state );
public delegate void WarningGumpCallback( bool okay );
public class WarningGump : Gump
{
private WarningGumpCallback m_Callback;
private object m_State;
private bool m_CancelButton;
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback, object state )
: this( header, headerColor, content, contentColor, width, height, callback, state, true )
{
}
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback, object state, bool cancelButton ) : base( (640 - width) / 2, (480 - height) / 2 )
public WarningGump( int header, int headerColor, object content, int contentColor, int width, int height, WarningGumpCallback callback = null, bool cancelButton = true) : base( (640 - width) / 2, (480 - height) / 2 )
{
m_Callback = callback;
m_State = state;
m_CancelButton = cancelButton;
Closable = false;
@ -45,7 +34,7 @@ namespace Server.Gumps
AddButton( 10, height - 30, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40, height - 30, 170, 20, 1011036, 32767, false, false ); // OKAY
if ( m_CancelButton )
if ( cancelButton )
{
AddButton( 10 + ((width - 20) / 2), height - 30, 4005, 4007, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40 + ((width - 20) / 2), height - 30, 170, 20, 1011012, 32767, false, false ); // CANCEL
@ -58,9 +47,9 @@ namespace Server.Gumps
return;
if ( info.ButtonID == 1)
m_Callback( sender.Mobile, true, m_State );
m_Callback( true );
else
m_Callback.Invoke( sender.Mobile, false, m_State );
m_Callback.Invoke( false );
}
}
}