Variable name refactor.
This commit is contained in:
@@ -37,12 +37,12 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// <summary>
|
||||
/// The parent of this module. May be null.
|
||||
/// </summary>
|
||||
public UIModuleGroup Parent;
|
||||
public UIModuleGroup parent;
|
||||
|
||||
/// <summary>
|
||||
/// Name of this module. For organizational/referencial purposes mostly.
|
||||
/// </summary>
|
||||
public string Name;
|
||||
public string name;
|
||||
|
||||
/// <summary>
|
||||
/// The color tint of this module.
|
||||
@@ -73,9 +73,9 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// <returns></returns>
|
||||
public Rectangle ConvertToParentCoordinates(Rectangle rectangle)
|
||||
{
|
||||
if (Parent != null)
|
||||
if (parent != null)
|
||||
{
|
||||
Rectangle parentHitbox = Parent.ConvertToParentCoordinates(rectangle);
|
||||
Rectangle parentHitbox = parent.ConvertToParentCoordinates(rectangle);
|
||||
int tX = rectangle.X + parentHitbox.X;
|
||||
int tY = rectangle.Y + parentHitbox.Y;
|
||||
return new Rectangle(tX, tY, rectangle.Width, rectangle.Height);
|
||||
@@ -91,8 +91,8 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// </summary>
|
||||
public void RemoveFromParent()
|
||||
{
|
||||
if (Parent == null) throw new InvalidOperationException("Parent is null.");
|
||||
Parent.RemoveModule(this);
|
||||
if (parent == null) throw new InvalidOperationException("Parent is null.");
|
||||
parent.RemoveModule(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,31 +125,37 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Centers this module's origin on the horizontal axis relative to the given rectangle.
|
||||
/// Centers this module's origin on the horizontal axis relative to the parent <see cref="UIModuleGroup"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle to center it in.</param>
|
||||
/// <returns>True if possible and false if not.</returns>
|
||||
public bool CenterHorizontally(Rectangle rectangle)
|
||||
public bool CenterHorizontally()
|
||||
{
|
||||
if (rectangle.Width >= Boundaries.Width)
|
||||
if (parent != null)
|
||||
{
|
||||
situation.X = rectangle.Width / 2 + situation.X;
|
||||
return true;
|
||||
Rectangle rectangle = parent.Boundaries;
|
||||
if (parent != null && rectangle.Width >= Boundaries.Width)
|
||||
{
|
||||
situation.X = rectangle.Width / 2 + situation.X;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Center's this module's origin on the vertical axis relative to the given rectangle.
|
||||
/// Centers this module's origin on the vertical axis relative to the parent <see cref="UIModuleGroup"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle to center in.</param>
|
||||
/// <returns>True if possible.</returns>
|
||||
public bool CenterVertically(Rectangle rectangle)
|
||||
public bool CenterVertically()
|
||||
{
|
||||
if (rectangle.Height >= Boundaries.Height)
|
||||
if (parent != null)
|
||||
{
|
||||
situation.Y = rectangle.Height / 2 + situation.Y;
|
||||
return true;
|
||||
Rectangle rectangle = parent.Boundaries;
|
||||
if (rectangle.Height >= Boundaries.Height)
|
||||
{
|
||||
situation.Y = rectangle.Height / 2 + situation.Y;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user