Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -27,7 +27,6 @@ namespace Server.Gumps
{
public class Gump
{
private List<GumpEntry> m_Entries;
private List<string> m_Strings;
internal int m_TextEntries, m_Switches;
@ -35,7 +34,6 @@ namespace Server.Gumps
private static int m_NextSerial = 1;
private int m_Serial;
private int m_TypeID;
private int m_X, m_Y;
private bool m_Dragable = true;
@ -58,9 +56,9 @@ namespace Server.Gumps
m_X = x;
m_Y = y;
m_TypeID = GetTypeID( GetType() );
TypeID = GetTypeID( GetType() );
m_Entries = new List<GumpEntry>();
Entries = new List<GumpEntry>();
m_Strings = new List<string>();
}
@ -70,9 +68,9 @@ namespace Server.Gumps
// m_Strings.Clear();
}
public int TypeID => m_TypeID;
public int TypeID { get; }
public List<GumpEntry> Entries => m_Entries;
public List<GumpEntry> Entries { get; }
public int Serial
{
@ -289,20 +287,20 @@ namespace Server.Gumps
{
g.Parent = this;
}
else if ( !m_Entries.Contains( g ) )
else if ( !Entries.Contains( g ) )
{
Invalidate();
m_Entries.Add( g );
Entries.Add( g );
}
}
public void Remove( GumpEntry g )
{
if (g == null || !m_Entries.Contains(g))
if (g == null || !Entries.Contains(g))
return;
Invalidate();
m_Entries.Remove( g );
Entries.Remove( g );
g.Parent = null;
}
@ -365,12 +363,12 @@ namespace Server.Gumps
if ( !m_Resizable )
disp.AppendLayout( m_NoResize );
int count = m_Entries.Count;
int count = Entries.Count;
GumpEntry e;
for ( int i = 0; i < count; ++i )
{
e = m_Entries[i];
e = Entries[i];
disp.AppendLayout( m_BeginLayout );
e.AppendTo( ns, disp );

View file

@ -37,8 +37,6 @@ namespace Server.Gumps
private int m_Width;
private int m_Height;
private int m_LocalizedTooltip;
public GumpImageTileButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param, int itemID, int hue, int width, int height ) : this(x, y, normalID, pressedID, buttonID, type, param, itemID, hue, width, height, -1 )
{
}
@ -57,7 +55,7 @@ namespace Server.Gumps
m_Width = width;
m_Height = height;
m_LocalizedTooltip = localizedTooltip;
LocalizedTooltip = localizedTooltip;
}
public int X
@ -136,17 +134,13 @@ namespace Server.Gumps
set => Delta( ref m_Height, value );
}
public int LocalizedTooltip
{
get => m_LocalizedTooltip;
set => m_LocalizedTooltip = value;
}
public int LocalizedTooltip { get; set; }
public override string Compile( NetState ns )
{
if ( m_LocalizedTooltip > 0 )
if ( LocalizedTooltip > 0 )
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {m_LocalizedTooltip} }}";
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}{{ tooltip {LocalizedTooltip} }}";
return
$"{{ buttontileart {m_X} {m_Y} {m_ID1} {m_ID2} {(int) m_Type} {m_Param} {m_ButtonID} {m_ItemID} {m_Hue} {m_Width} {m_Height} }}";
}
@ -170,10 +164,10 @@ namespace Server.Gumps
disp.AppendLayout( m_Width );
disp.AppendLayout( m_Height );
if ( m_LocalizedTooltip > 0 )
if ( LocalizedTooltip > 0 )
{
disp.AppendLayout( m_LayoutTooltip );
disp.AppendLayout( m_LocalizedTooltip );
disp.AppendLayout( LocalizedTooltip );
}
}
}

View file

@ -22,44 +22,37 @@ namespace Server.Gumps
{
public class TextRelay
{
private int m_EntryID;
private string m_Text;
public TextRelay( int entryID, string text )
{
m_EntryID = entryID;
m_Text = text;
EntryID = entryID;
Text = text;
}
public int EntryID => m_EntryID;
public int EntryID { get; }
public string Text => m_Text;
public string Text { get; }
}
public class RelayInfo
{
private int m_ButtonID;
private int[] m_Switches;
private TextRelay[] m_TextEntries;
public RelayInfo( int buttonID, int[] switches, TextRelay[] textEntries )
{
m_ButtonID = buttonID;
m_Switches = switches;
m_TextEntries = textEntries;
ButtonID = buttonID;
Switches = switches;
TextEntries = textEntries;
}
public int ButtonID => m_ButtonID;
public int ButtonID { get; }
public int[] Switches => m_Switches;
public int[] Switches { get; }
public TextRelay[] TextEntries => m_TextEntries;
public TextRelay[] TextEntries { get; }
public bool IsSwitched( int switchID )
{
for ( int i = 0; i < m_Switches.Length; ++i )
for ( int i = 0; i < Switches.Length; ++i )
{
if ( m_Switches[i] == switchID )
if ( Switches[i] == switchID )
{
return true;
}
@ -70,11 +63,11 @@ namespace Server.Gumps
public TextRelay GetTextEntry( int entryID )
{
for ( int i = 0; i < m_TextEntries.Length; ++i )
for ( int i = 0; i < TextEntries.Length; ++i )
{
if ( m_TextEntries[i].EntryID == entryID )
if ( TextEntries[i].EntryID == entryID )
{
return m_TextEntries[i];
return TextEntries[i];
}
}