Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
37
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ButtonPlus.cs
Normal file
37
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ButtonPlus.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class ButtonPlus : GumpButton
|
||||
{
|
||||
private string c_Name;
|
||||
private object c_Callback;
|
||||
private object c_Param;
|
||||
|
||||
public string Name{ get{ return c_Name; } }
|
||||
|
||||
public ButtonPlus( int x, int y, int normalID, int pressedID, int buttonID, string name, TimerCallback back ) : base( x, y, normalID, pressedID, buttonID, GumpButtonType.Reply, 0 )
|
||||
{
|
||||
c_Name = name;
|
||||
c_Callback = back;
|
||||
c_Param = "";
|
||||
}
|
||||
|
||||
public ButtonPlus( int x, int y, int normalID, int pressedID, int buttonID, string name, TimerStateCallback back, object param ) : base( x, y, normalID, pressedID, buttonID, GumpButtonType.Reply, 0 )
|
||||
{
|
||||
c_Name = name;
|
||||
c_Callback = back;
|
||||
c_Param = param;
|
||||
}
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
if ( c_Callback is TimerCallback )
|
||||
((TimerCallback)c_Callback).Invoke();
|
||||
else if ( c_Callback is TimerStateCallback )
|
||||
((TimerStateCallback)c_Callback).Invoke( c_Param );
|
||||
}
|
||||
}
|
||||
}
|
||||
75
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ChoiceGump.cs
Normal file
75
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ChoiceGump.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class ChoiceGump : GumpPlus
|
||||
{
|
||||
public static void SendTo( Mobile m, string title, int width, TimerStateCallback callback, Hashtable table )
|
||||
{
|
||||
new ChoiceGump( m, title, width, callback, table );
|
||||
}
|
||||
|
||||
private string c_Title;
|
||||
private int c_Width;
|
||||
private TimerStateCallback c_Callback;
|
||||
private Hashtable c_Table;
|
||||
|
||||
public ChoiceGump( Mobile m, string title, int width, TimerStateCallback callback, Hashtable table ) : base( m, 100, 100 )
|
||||
{
|
||||
c_Title = title;
|
||||
c_Width = width;
|
||||
c_Callback = callback;
|
||||
c_Table = table;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{try{
|
||||
|
||||
int height = 50+(25*c_Table.Count);
|
||||
|
||||
if ( c_Title == "" )
|
||||
height-=20;
|
||||
|
||||
AddBackground( 0, 0, c_Width, height, 0x13BE );
|
||||
|
||||
int y = 10;
|
||||
|
||||
if ( c_Title != "" )
|
||||
AddHtml( 0, 10, c_Width, 25, HTML.White + "<CENTER>" + c_Title, false, false );
|
||||
else
|
||||
y = -10;
|
||||
|
||||
ArrayList list = new ArrayList( c_Table.Values );
|
||||
|
||||
for( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
AddHtml( 40, y+=25, c_Width, 20, HTML.White + list[i].ToString(), false, false );
|
||||
AddButton( 15, y+2, 0x93A, 0x93A, "Respond", new TimerStateCallback( Respond ), i );
|
||||
}
|
||||
|
||||
}catch{ Errors.Report( "ChoiceGump-> BuildGump" ); } }
|
||||
|
||||
private void Respond( object obj )
|
||||
{
|
||||
if ( !(obj is int))
|
||||
return;
|
||||
|
||||
ArrayList list = new ArrayList( c_Table.Keys );
|
||||
|
||||
if ( list[(int)obj] != null )
|
||||
c_Callback.Invoke( list[(int)obj] );
|
||||
else
|
||||
c_Callback.Invoke( -1 );
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
c_Callback.Invoke( -1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
311
Scripts/SubSystem/Utilities v1.03/Gumps Plus/GumpInfo.cs
Normal file
311
Scripts/SubSystem/Utilities v1.03/Gumps Plus/GumpInfo.cs
Normal file
@@ -0,0 +1,311 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class GumpInfo
|
||||
{
|
||||
private static Hashtable s_Infos = new Hashtable();
|
||||
private static ArrayList s_Backgrounds = new ArrayList();
|
||||
private static ArrayList s_TextColors = new ArrayList();
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
EventSink.WorldLoad += new WorldLoadEventHandler( OnLoad );
|
||||
EventSink.WorldSave += new WorldSaveEventHandler( OnSave );
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
s_Backgrounds.Add( 0xA3C );
|
||||
s_Backgrounds.Add( 0x53 );
|
||||
s_Backgrounds.Add( 0x2486 );
|
||||
s_Backgrounds.Add( 0xDAC );
|
||||
s_Backgrounds.Add( 0xE10 );
|
||||
s_Backgrounds.Add( 0x13EC );
|
||||
s_Backgrounds.Add( 0x1400 );
|
||||
s_Backgrounds.Add( 0x2422 );
|
||||
s_Backgrounds.Add( 0x242C );
|
||||
s_Backgrounds.Add( 0x13BE );
|
||||
s_Backgrounds.Add( 0x2436 );
|
||||
s_Backgrounds.Add( 0x2454 );
|
||||
s_Backgrounds.Add( 0x251C );
|
||||
s_Backgrounds.Add( 0x254E );
|
||||
s_Backgrounds.Add( 0x24A4 );
|
||||
s_Backgrounds.Add( 0x24AE );
|
||||
|
||||
s_TextColors.Add("FFFFFF");
|
||||
s_TextColors.Add("111111");
|
||||
s_TextColors.Add("FF0000");
|
||||
s_TextColors.Add("FF9999");
|
||||
s_TextColors.Add("00FF00");
|
||||
s_TextColors.Add("0000FF");
|
||||
s_TextColors.Add("999999");
|
||||
s_TextColors.Add("333333");
|
||||
s_TextColors.Add("FFFF00");
|
||||
s_TextColors.Add("990099");
|
||||
s_TextColors.Add("CC00FF");
|
||||
}
|
||||
|
||||
private static void OnSave( WorldSaveEventArgs e )
|
||||
{try{
|
||||
|
||||
if ( !Directory.Exists( "Saves/Gumps/" ) )
|
||||
Directory.CreateDirectory( "Saves/Gumps/" );
|
||||
|
||||
GenericWriter writer = new BinaryFileWriter( Path.Combine( "Saves/Gumps/", "Gumps.bin" ), true );
|
||||
|
||||
writer.Write( 0 ); // version
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
GumpInfo info;
|
||||
|
||||
foreach( object o in new ArrayList( s_Infos.Values ) )
|
||||
{
|
||||
if ( !(o is Hashtable) )
|
||||
continue;
|
||||
|
||||
foreach( object ob in new ArrayList( ((Hashtable)o).Values ) )
|
||||
{
|
||||
if ( !(ob is GumpInfo ) )
|
||||
continue;
|
||||
|
||||
info = (GumpInfo)ob;
|
||||
|
||||
if ( info.Mobile != null
|
||||
&& info.Mobile.Player
|
||||
&& !info.Mobile.Deleted
|
||||
&& info.Mobile.Account != null
|
||||
&& ((Account)info.Mobile.Account).LastLogin > DateTime.Now - TimeSpan.FromDays( 30 ) )
|
||||
list.Add( ob );
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write( list.Count );
|
||||
|
||||
foreach( GumpInfo ginfo in list )
|
||||
ginfo.Save( writer );
|
||||
|
||||
writer.Close();
|
||||
|
||||
}catch{ Errors.Report( "GumpInfo-> OnSave" ); } }
|
||||
|
||||
private static void OnLoad()
|
||||
{try{
|
||||
|
||||
if ( !File.Exists( Path.Combine( "Saves/Gumps/", "Gumps.bin" ) ) )
|
||||
return;
|
||||
|
||||
using ( FileStream bin = new FileStream( Path.Combine( "Saves/Gumps/", "Gumps.bin" ), FileMode.Open, FileAccess.Read, FileShare.Read ) )
|
||||
{
|
||||
GenericReader reader = new BinaryFileReader( new BinaryReader( bin ) );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version >= 0 )
|
||||
{
|
||||
int count = reader.ReadInt();
|
||||
GumpInfo info;
|
||||
|
||||
for( int i = 0; i < count; ++i )
|
||||
{
|
||||
info = new GumpInfo();
|
||||
info.Load( reader );
|
||||
|
||||
if ( info.Mobile == null || info.Type == null )
|
||||
continue;
|
||||
|
||||
if ( s_Infos[info.Mobile] == null )
|
||||
s_Infos[info.Mobile] = new Hashtable();
|
||||
|
||||
((Hashtable)s_Infos[info.Mobile])[info.Type] = info;
|
||||
}
|
||||
}
|
||||
|
||||
reader.End();
|
||||
}
|
||||
|
||||
}catch{ Errors.Report( "GumpInfo-> OnLoad" ); } }
|
||||
|
||||
public static GumpInfo GetInfo( Mobile m, Type type )
|
||||
{
|
||||
if ( s_Infos[m] == null )
|
||||
s_Infos[m] = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)s_Infos[m];
|
||||
|
||||
if ( table[type] == null )
|
||||
table[type] = new GumpInfo( m, type );
|
||||
|
||||
return (GumpInfo)table[type];
|
||||
}
|
||||
|
||||
public static bool HasMods( Mobile m, Type type )
|
||||
{
|
||||
if ( s_Infos[m] == null )
|
||||
s_Infos[m] = new Hashtable();
|
||||
|
||||
if ( ((Hashtable)s_Infos[m])[type] == null )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Mobile c_Mobile;
|
||||
private Type c_Type;
|
||||
private bool c_Transparent, c_DefaultTrans;
|
||||
private string c_TextColorRGB;
|
||||
private int c_Background;
|
||||
|
||||
public Mobile Mobile{ get{ return c_Mobile; } }
|
||||
public Type Type{ get{ return c_Type; } }
|
||||
public bool Transparent { get { return c_Transparent; } set { c_Transparent = value; c_DefaultTrans = false; } }
|
||||
public bool DefaultTrans{ get{ return c_DefaultTrans; } set{ c_DefaultTrans = value; } }
|
||||
public string TextColorRGB{ get{ return c_TextColorRGB; } set{ c_TextColorRGB = value; } }
|
||||
public string TextColor{ get{ return String.Format( "<BASEFONT COLOR=#{0}>", c_TextColorRGB ); } }
|
||||
public int Background{ get{ return c_Background; } }
|
||||
|
||||
public GumpInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public GumpInfo( Mobile m, Type type )
|
||||
{
|
||||
c_Mobile = m;
|
||||
c_Type = type;
|
||||
c_TextColorRGB = "";
|
||||
c_Background = -1;
|
||||
c_DefaultTrans = true;
|
||||
}
|
||||
|
||||
public void BackgroundUp()
|
||||
{
|
||||
if (c_Background == -1)
|
||||
{
|
||||
c_Background = (int)s_Backgrounds[0];
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s_Backgrounds.Count; ++i)
|
||||
if (c_Background == (int)s_Backgrounds[i])
|
||||
{
|
||||
if (i == s_Backgrounds.Count - 1)
|
||||
{
|
||||
c_Background = (int)s_Backgrounds[0];
|
||||
return;
|
||||
}
|
||||
|
||||
c_Background = (int)s_Backgrounds[i + 1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void BackgroundDown()
|
||||
{
|
||||
if (c_Background == -1)
|
||||
{
|
||||
c_Background = (int)s_Backgrounds[s_Backgrounds.Count - 1];
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s_Backgrounds.Count; ++i)
|
||||
if (c_Background == (int)s_Backgrounds[i])
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
c_Background = (int)s_Backgrounds[s_Backgrounds.Count - 1];
|
||||
return;
|
||||
}
|
||||
|
||||
c_Background = (int)s_Backgrounds[i - 1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void TextColorUp()
|
||||
{
|
||||
if (c_TextColorRGB == "")
|
||||
{
|
||||
c_TextColorRGB = s_TextColors[0].ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s_TextColors.Count; ++i)
|
||||
if (c_TextColorRGB == s_TextColors[i].ToString())
|
||||
{
|
||||
if (i == s_TextColors.Count - 1)
|
||||
{
|
||||
c_TextColorRGB = s_TextColors[0].ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
c_TextColorRGB = s_TextColors[i + 1].ToString();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void TextColorDown()
|
||||
{
|
||||
if (c_TextColorRGB == "")
|
||||
{
|
||||
c_TextColorRGB = s_TextColors[s_TextColors.Count - 1].ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s_TextColors.Count; ++i)
|
||||
if (c_TextColorRGB == s_TextColors[i].ToString())
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
c_TextColorRGB = s_TextColors[s_TextColors.Count - 1].ToString();
|
||||
return;
|
||||
}
|
||||
|
||||
c_TextColorRGB = s_TextColors[i - 1].ToString();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void Default()
|
||||
{
|
||||
if (c_Mobile == null || s_Infos[c_Mobile] == null)
|
||||
return;
|
||||
|
||||
((Hashtable)s_Infos[c_Mobile]).Remove(c_Type);
|
||||
}
|
||||
|
||||
private void Save(GenericWriter writer)
|
||||
{try{
|
||||
|
||||
writer.Write( 0 ); // version
|
||||
|
||||
// Version 0
|
||||
writer.Write( c_Mobile );
|
||||
writer.Write( c_Type.ToString() );
|
||||
writer.Write( c_Transparent );
|
||||
writer.Write( c_DefaultTrans );
|
||||
writer.Write( c_TextColorRGB );
|
||||
writer.Write( c_Background );
|
||||
|
||||
}catch{ Errors.Report( "GumpInfo -> Save" ); } }
|
||||
|
||||
private void Load( GenericReader reader )
|
||||
{try{
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version >= 0 )
|
||||
{
|
||||
c_Mobile = reader.ReadMobile();
|
||||
c_Type = ScriptCompiler.FindTypeByFullName( reader.ReadString() );
|
||||
c_Transparent = reader.ReadBool();
|
||||
c_DefaultTrans = reader.ReadBool();
|
||||
c_TextColorRGB = reader.ReadString();
|
||||
c_Background = reader.ReadInt();
|
||||
}
|
||||
|
||||
}catch{ Errors.Report( "GumpInfo -> Load" ); } }
|
||||
}
|
||||
}
|
||||
324
Scripts/SubSystem/Utilities v1.03/Gumps Plus/GumpPlus.cs
Normal file
324
Scripts/SubSystem/Utilities v1.03/Gumps Plus/GumpPlus.cs
Normal file
@@ -0,0 +1,324 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class GumpPlus : Gump
|
||||
{
|
||||
private Mobile c_Owner;
|
||||
private Hashtable c_Buttons, c_Fields;
|
||||
private bool c_Override;
|
||||
|
||||
public Mobile Owner{ get{ return c_Owner; } }
|
||||
public GumpInfo Info { get { return GumpInfo.GetInfo(c_Owner, this.GetType()); } }
|
||||
public bool Override{ get{ return c_Override; } set{ c_Override = value; } }
|
||||
|
||||
public GumpPlus( Mobile m, int x, int y ) : base( x, y )
|
||||
{
|
||||
c_Owner = m;
|
||||
|
||||
c_Buttons = new Hashtable();
|
||||
c_Fields = new Hashtable();
|
||||
c_Override = true;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Entries.Clear();
|
||||
c_Buttons.Clear();
|
||||
c_Fields.Clear();
|
||||
}
|
||||
|
||||
public void NewGump()
|
||||
{
|
||||
NewGump( true );
|
||||
}
|
||||
|
||||
public void NewGump( bool clear )
|
||||
{
|
||||
if ( clear )
|
||||
Clear();
|
||||
|
||||
BuildGump();
|
||||
|
||||
if ( c_Override )
|
||||
ModifyGump();
|
||||
|
||||
c_Owner.SendGump( this );
|
||||
}
|
||||
|
||||
public void SameGump()
|
||||
{
|
||||
c_Owner.SendGump( this );
|
||||
}
|
||||
|
||||
protected virtual void BuildGump()
|
||||
{
|
||||
}
|
||||
|
||||
private void ModifyGump()
|
||||
{try{
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
int maxWidth = 0;
|
||||
int maxHeight = 0;
|
||||
GumpBackground bg;
|
||||
|
||||
foreach( GumpEntry entry in Entries )
|
||||
if ( entry is GumpBackground )
|
||||
{
|
||||
bg = (GumpBackground)entry;
|
||||
|
||||
if ( bg.X + bg.Width > maxWidth )
|
||||
maxWidth = bg.X + bg.Width;
|
||||
if ( bg.Y + bg.Height > maxHeight )
|
||||
maxHeight = bg.Y + bg.Height;
|
||||
}
|
||||
|
||||
AddImage( maxWidth, maxHeight, 0x28DC, 0x387 );
|
||||
AddButton(maxWidth + 10, maxHeight + 4, 0x93A, 0x93A, "Transparency", new TimerCallback(Trans));
|
||||
AddButton(maxWidth + 10, maxHeight + 15, 0x938, 0x938, "Default", new TimerCallback(Default));
|
||||
AddButton(maxWidth - 5, maxHeight + 2, 0x2626, 0x2627, "BackgroundDown", new TimerCallback(BackDown));
|
||||
AddButton(maxWidth + 19, maxHeight + 2, 0x2622, 0x2623, "BackgroundUp", new TimerCallback(BackUp));
|
||||
AddButton(maxWidth - 5, maxHeight + 13, 0x2626, 0x2627, "TextColorDown", new TimerCallback(TextDown));
|
||||
AddButton(maxWidth + 19, maxHeight + 13, 0x2622, 0x2623, "TextColorUp", new TimerCallback(TextUp));
|
||||
|
||||
if ( !GumpInfo.HasMods( c_Owner, GetType() ) )
|
||||
return;
|
||||
|
||||
ArrayList backs = new ArrayList();
|
||||
|
||||
foreach( GumpEntry entry in new ArrayList( Entries ) )
|
||||
{
|
||||
if ( entry is GumpBackground )
|
||||
{
|
||||
if ( Info.Background != -1 )
|
||||
((GumpBackground)entry).GumpID = Info.Background;
|
||||
|
||||
backs.Add( entry );
|
||||
}
|
||||
else if ( entry is GumpAlphaRegion && !Info.DefaultTrans && !Info.Transparent )
|
||||
{
|
||||
((GumpAlphaRegion)entry).Width = 0;
|
||||
((GumpAlphaRegion)entry).Height = 0;
|
||||
}
|
||||
else if ( entry is HtmlPlus )
|
||||
{
|
||||
if ( !((HtmlPlus)entry).Override || Info.TextColorRGB == "" )
|
||||
continue;
|
||||
|
||||
string text = ((HtmlPlus)entry).Text;
|
||||
int num = 0;
|
||||
int length = 0;
|
||||
char[] chars;
|
||||
|
||||
if ( text == null )
|
||||
continue;
|
||||
|
||||
while( (num = text.ToLower().IndexOf( "<basefont" )) != -1 || (num = text.ToLower().IndexOf( "</font" )) != -1 )
|
||||
{
|
||||
length = 0;
|
||||
chars = text.ToCharArray();
|
||||
|
||||
for( int i = num; i < chars.Length; ++i )
|
||||
if ( chars[i] == '>' )
|
||||
{
|
||||
length = i-num+1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( length == 0 )
|
||||
break;
|
||||
|
||||
text = text.Substring( 0, num ) + text.Substring( num+length, text.Length-num-length );
|
||||
}
|
||||
|
||||
((HtmlPlus)entry).Text = Info.TextColor + text;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Info.DefaultTrans && Info.Transparent )
|
||||
foreach( GumpBackground back in backs )
|
||||
AddAlphaRegion( back.X, back.Y, back.Width, back.Height );
|
||||
|
||||
SortEntries();
|
||||
|
||||
}catch{ Errors.Report( "GumpPlus-> ModifyGump-> " + GetType() ); } }
|
||||
|
||||
private void SortEntries()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
foreach( GumpEntry entry in new ArrayList( Entries ) )
|
||||
if ( entry is GumpBackground )
|
||||
{
|
||||
list.Add( entry );
|
||||
Entries.Remove( entry );
|
||||
}
|
||||
|
||||
foreach( GumpEntry entry in new ArrayList( Entries ) )
|
||||
if ( entry is GumpAlphaRegion )
|
||||
{
|
||||
list.Add( entry );
|
||||
Entries.Remove( entry );
|
||||
}
|
||||
|
||||
list.AddRange( Entries );
|
||||
|
||||
Entries.Clear();
|
||||
|
||||
foreach (GumpEntry entry in list)
|
||||
Entries.Add(entry);
|
||||
//Entries.AddRange( list );
|
||||
}
|
||||
|
||||
private int UniqueButton()
|
||||
{
|
||||
int random = 0;
|
||||
|
||||
do
|
||||
{
|
||||
random = Utility.Random( 20000 );
|
||||
|
||||
}while( c_Buttons[random] != null );
|
||||
|
||||
return random;
|
||||
}
|
||||
|
||||
public void AddButton( int x, int y, int up, int down, TimerCallback callback )
|
||||
{
|
||||
AddButton( x, y, up, down, "None", callback );
|
||||
}
|
||||
|
||||
public void AddButton( int x, int y, int up, int down, string name, TimerCallback callback )
|
||||
{
|
||||
int id = UniqueButton();
|
||||
|
||||
ButtonPlus button = new ButtonPlus( x, y, up, down, id, name, callback );
|
||||
|
||||
Add( button );
|
||||
|
||||
c_Buttons[id] = button;
|
||||
}
|
||||
|
||||
public void AddButton( int x, int y, int up, int down, TimerStateCallback callback, object arg )
|
||||
{
|
||||
AddButton( x, y, up, down, "None", callback, arg );
|
||||
}
|
||||
|
||||
public void AddButton( int x, int y, int up, int down, string name, TimerStateCallback callback, object arg )
|
||||
{
|
||||
int id = UniqueButton();
|
||||
|
||||
ButtonPlus button = new ButtonPlus( x, y, up, down, id, name, callback, arg );
|
||||
|
||||
Add( button );
|
||||
|
||||
c_Buttons[id] = button;
|
||||
}
|
||||
|
||||
public new void AddHtml( int x, int y, int width, int height, string text, bool back, bool scroll )
|
||||
{
|
||||
AddHtml( x, y, width, height, text, back, scroll, true );
|
||||
}
|
||||
|
||||
public void AddHtml( int x, int y, int width, int height, string text, bool back, bool scroll, bool over )
|
||||
{
|
||||
HtmlPlus html = new HtmlPlus( x, y, width, height, text, back, scroll, over );
|
||||
|
||||
Add( html );
|
||||
}
|
||||
|
||||
public void AddTextField( int x, int y, int width, int height, int color, int id, string text )
|
||||
{
|
||||
base.AddTextEntry( x, y, width, height, color, id, text );
|
||||
|
||||
c_Fields[id] = text;
|
||||
}
|
||||
|
||||
public string GetTextField( int id )
|
||||
{
|
||||
if ( c_Fields[id] == null )
|
||||
return "";
|
||||
|
||||
return c_Fields[id].ToString();
|
||||
}
|
||||
|
||||
protected virtual void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
string name = "";
|
||||
|
||||
try{
|
||||
|
||||
if ( info.ButtonID == -5 )
|
||||
{
|
||||
NewGump();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( TextRelay t in info.TextEntries )
|
||||
c_Fields[t.EntryID] = t.Text;
|
||||
|
||||
if ( info.ButtonID == 0 )
|
||||
OnClose();
|
||||
|
||||
if ( c_Buttons[info.ButtonID] == null || !(c_Buttons[info.ButtonID] is ButtonPlus) )
|
||||
return;
|
||||
|
||||
name = ((ButtonPlus)c_Buttons[info.ButtonID]).Name;
|
||||
|
||||
((ButtonPlus)c_Buttons[info.ButtonID]).Invoke();
|
||||
|
||||
}catch{ Errors.Report( String.Format( "GumpPlus-> OnResponse-> |{0}|-> {1}-> {2}", c_Owner, GetType(), name ) ); } }
|
||||
|
||||
private void Trans()
|
||||
{
|
||||
Info.Transparent = !Info.Transparent;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
private void BackUp()
|
||||
{
|
||||
Info.BackgroundUp();
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
private void BackDown()
|
||||
{
|
||||
Info.BackgroundDown();
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
private void TextUp()
|
||||
{
|
||||
Info.TextColorUp();
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
private void TextDown()
|
||||
{
|
||||
Info.TextColorDown();
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
private void Default()
|
||||
{
|
||||
Info.Default();
|
||||
|
||||
NewGump();
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Scripts/SubSystem/Utilities v1.03/Gumps Plus/HTML.cs
Normal file
20
Scripts/SubSystem/Utilities v1.03/Gumps Plus/HTML.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class HTML
|
||||
{
|
||||
public static string White{ get { return "<BASEFONT COLOR=#FFFFFF>"; } }
|
||||
public static string Red{ get { return "<BASEFONT COLOR=#FF0000>"; } }
|
||||
public static string AshRed{ get { return "<BASEFONT COLOR=#FF9999>"; } }
|
||||
public static string Green{ get { return "<BASEFONT COLOR=#00FF00>"; } }
|
||||
public static string Blue{ get { return "<BASEFONT COLOR=#0000FF>"; } }
|
||||
public static string Gray{ get { return "<BASEFONT COLOR=#999999>"; } }
|
||||
public static string DarkGray{ get { return "<BASEFONT COLOR=#222222>"; } }
|
||||
public static string Black{ get { return "<BASEFONT COLOR=#111111>"; } }
|
||||
public static string Yellow{ get { return "<BASEFONT COLOR=#FFFF00>"; } }
|
||||
public static string Purple{ get { return "<BASEFONT COLOR=#990099>"; } }
|
||||
public static string LightPurple{ get { return "<BASEFONT COLOR=#CC00FF>"; } }
|
||||
}
|
||||
}
|
||||
23
Scripts/SubSystem/Utilities v1.03/Gumps Plus/HtmlPlus.cs
Normal file
23
Scripts/SubSystem/Utilities v1.03/Gumps Plus/HtmlPlus.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class HtmlPlus : GumpHtml
|
||||
{
|
||||
private bool c_Override;
|
||||
|
||||
public bool Override{ get{ return c_Override; } set{ c_Override = value; } }
|
||||
|
||||
public HtmlPlus( int x, int y, int width, int height, string text, bool back, bool scroll ) : base( x, y, width, height, text, back, scroll )
|
||||
{
|
||||
c_Override = true;
|
||||
}
|
||||
|
||||
public HtmlPlus( int x, int y, int width, int height, string text, bool back, bool scroll, bool over ) : base( x, y, width, height, text, back, scroll )
|
||||
{
|
||||
c_Override = over;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Scripts/SubSystem/Utilities v1.03/Gumps Plus/InfoGump.cs
Normal file
35
Scripts/SubSystem/Utilities v1.03/Gumps Plus/InfoGump.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class InfoGump : GumpPlus
|
||||
{
|
||||
public static void SendTo( Mobile m, int width, int height, string text, bool scroll )
|
||||
{
|
||||
new InfoGump( m, width, height, text, scroll );
|
||||
}
|
||||
|
||||
private int c_Width, c_Height;
|
||||
private string c_Text;
|
||||
private bool c_Scroll;
|
||||
|
||||
public InfoGump( Mobile m, int width, int height, string text, bool scroll ) : base( m, 100, 100 )
|
||||
{
|
||||
c_Width = width;
|
||||
c_Height = height;
|
||||
c_Text= text;
|
||||
c_Scroll = scroll;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
AddBackground( 0, 0, c_Width, c_Height, 0x13BE );
|
||||
|
||||
AddHtml( 20, 20, c_Width-40, c_Height-40, HTML.White + c_Text, false, c_Scroll );
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ResponseGump.cs
Normal file
52
Scripts/SubSystem/Utilities v1.03/Gumps Plus/ResponseGump.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Knives.Utils
|
||||
{
|
||||
public class ResponseGump : GumpPlus
|
||||
{
|
||||
public static void SendTo( Mobile m, int width, int height, string text, string title, TimerStateCallback callback )
|
||||
{
|
||||
new ResponseGump( m, width, height, text, title, callback );
|
||||
}
|
||||
|
||||
private int c_Width, c_Height;
|
||||
private string c_Text, c_Title;
|
||||
private TimerStateCallback c_Callback;
|
||||
|
||||
public ResponseGump( Mobile m, int width, int height, string text, string title, TimerStateCallback callback ) : base( m, 100, 100 )
|
||||
{
|
||||
c_Width = width;
|
||||
c_Height = height;
|
||||
c_Text = text;
|
||||
c_Title = title;
|
||||
c_Callback = callback;
|
||||
|
||||
NewGump();
|
||||
}
|
||||
|
||||
protected override void BuildGump()
|
||||
{
|
||||
AddBackground( 0, 0, c_Width, c_Height, 0x13BE );
|
||||
|
||||
AddHtml( 0, 10, c_Width, 25, HTML.White + "<CENTER>" + c_Title, false, false );
|
||||
|
||||
AddImageTiled( 20, 40, c_Width-40, c_Height-90, 0xBBC );
|
||||
AddTextField( 20, 40, c_Width-40, c_Height-90, 0x480, 0, c_Text );
|
||||
|
||||
AddButton( c_Width/2-30, c_Height-35, 0x98B, 0x98B, "Respond", new TimerCallback( Respond ) );
|
||||
AddHtml( c_Width/2-23, c_Height-32, 51, 20, HTML.White + "<CENTER>Submit", false, false );
|
||||
}
|
||||
|
||||
private void Respond()
|
||||
{
|
||||
c_Callback.Invoke( GetTextField( 0 ) );
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
c_Callback.Invoke( c_Text );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user