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

@ -28,24 +28,20 @@ namespace Server.ContextMenus
/// </summary>
public class ContextMenu
{
private Mobile m_From;
private object m_Target;
private ContextMenuEntry[] m_Entries;
/// <summary>
/// Gets the <see cref="Mobile" /> who opened this ContextMenu.
/// </summary>
public Mobile From => m_From;
public Mobile From { get; }
/// <summary>
/// Gets an object of the <see cref="Mobile" /> or <see cref="Item" /> for which this ContextMenu is on.
/// </summary>
public object Target => m_Target;
public object Target { get; }
/// <summary>
/// Gets the list of <see cref="ContextMenuEntry">entries</see> contained in this ContextMenu.
/// </summary>
public ContextMenuEntry[] Entries => m_Entries;
public ContextMenuEntry[] Entries { get; }
/// <summary>
/// Instantiates a new ContextMenu instance.
@ -60,8 +56,8 @@ namespace Server.ContextMenus
/// </param>
public ContextMenu( Mobile from, object target )
{
m_From = from;
m_Target = target;
From = from;
Target = target;
List<ContextMenuEntry> list = new List<ContextMenuEntry>();
@ -76,11 +72,11 @@ namespace Server.ContextMenus
//m_Entries = (ContextMenuEntry[])list.ToArray( typeof( ContextMenuEntry ) );
m_Entries = list.ToArray();
Entries = list.ToArray();
for ( int i = 0; i < m_Entries.Length; ++i )
for ( int i = 0; i < Entries.Length; ++i )
{
m_Entries[i].Owner = this;
Entries[i].Owner = this;
}
}
@ -91,9 +87,9 @@ namespace Server.ContextMenus
{
get
{
for ( int i = 0; i < m_Entries.Length; ++i )
for ( int i = 0; i < Entries.Length; ++i )
{
if ( m_Entries[i].Number < 3000000 || m_Entries[i].Number > 3032767 )
if ( Entries[i].Number < 3000000 || Entries[i].Number > 3032767 )
return true;
}

View file

@ -28,66 +28,35 @@ namespace Server.ContextMenus
/// </summary>
public class ContextMenuEntry
{
private int m_Number;
private int m_Color;
private bool m_Enabled;
private int m_Range;
private CMEFlags m_Flags;
private ContextMenu m_Owner;
/// <summary>
/// Gets or sets additional <see cref="CMEFlags">flags</see> used in client communication.
/// </summary>
public CMEFlags Flags
{
get => m_Flags;
set => m_Flags = value;
}
public CMEFlags Flags { get; set; }
/// <summary>
/// Gets or sets the <see cref="ContextMenu" /> that owns this entry.
/// </summary>
public ContextMenu Owner
{
get => m_Owner;
set => m_Owner = value;
}
public ContextMenu Owner { get; set; }
/// <summary>
/// Gets or sets the localization number containing the name of this entry.
/// </summary>
public int Number
{
get => m_Number;
set => m_Number = value;
}
public int Number { get; set; }
/// <summary>
/// Gets or sets the maximum range at which this entry may be used, in tiles. A value of -1 signifies no maximum range.
/// </summary>
public int Range
{
get => m_Range;
set => m_Range = value;
}
public int Range { get; set; }
/// <summary>
/// Gets or sets the color for this entry. Format is A1-R5-G5-B5.
/// </summary>
public int Color
{
get => m_Color;
set => m_Color = value;
}
public int Color { get; set; }
/// <summary>
/// Gets or sets whether this entry is enabled. When false, the entry will appear in a gray hue and <see cref="OnClick" /> will never be invoked.
/// </summary>
public bool Enabled
{
get => m_Enabled;
set => m_Enabled = value;
}
public bool Enabled { get; set; }
/// <summary>
/// Gets a value indicating if non local use of this entry is permitted.
@ -119,13 +88,13 @@ namespace Server.ContextMenus
public ContextMenuEntry( int number, int range )
{
if ( number <= 0x7FFF ) // Legacy code support
m_Number = 3000000 + number;
Number = 3000000 + number;
else
m_Number = number;
Number = number;
m_Range = range;
m_Enabled = true;
m_Color = 0xFFFF;
Range = range;
Enabled = true;
Color = 0xFFFF;
}
/// <summary>