Variable name refactor.
This commit is contained in:
parent
5080deed02
commit
04ec3cd793
@ -98,7 +98,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
|
||||
page.camera = camera;
|
||||
page.Initialize(assets, skin);
|
||||
orderedPages.Add(page);
|
||||
this.pages.Add(page.Name, page);
|
||||
this.pages.Add(page.name, page);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
|
||||
/// <param name="page">Page to remove.</param>
|
||||
public void RemovePage(Page page)
|
||||
{
|
||||
RemovePage(page.Name);
|
||||
RemovePage(page.name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -25,7 +25,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
|
||||
this.pageX = pageX;
|
||||
this.pageY = pageY;
|
||||
requiresSizeUpdate = true;
|
||||
Name = ToString();
|
||||
name = ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using RecrownedAthenaeum.Camera;
|
||||
using RecrownedAthenaeum.Render;
|
||||
using RecrownedAthenaeum.ScreenSystem;
|
||||
|
||||
namespace RecrownedAthenaeum.UI.Modular
|
||||
@ -17,7 +18,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
List<UIModule> modules = new List<UIModule>();
|
||||
Rectangle scissorBounds;
|
||||
RasterizerState scissorRasterizer;
|
||||
BeginBatch beginBatch;
|
||||
SpriteBatchSettings spriteBatchSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Camera used by the module for cropping.
|
||||
@ -29,12 +30,12 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// </summary>
|
||||
/// <param name="crop">Whether or not to crop out of bounds. Default is false.</param>
|
||||
/// <param name="camera">What camera to use for cropping. Default is null and will use <see cref="Configuration"/>'s camera if crop is enabled.</param>
|
||||
/// <param name="beginBatchFunction">The function to be called that begins the batch.</param>
|
||||
public UIModuleGroup(bool crop = false, Camera2D camera = null, BeginBatch beginBatchFunction = null)
|
||||
/// <param name="spriteBatchSettings">The settings to be used that begins the batch.</param>
|
||||
public UIModuleGroup(bool crop = false, Camera2D camera = null, SpriteBatchSettings? spriteBatchSettings = null)
|
||||
{
|
||||
if (beginBatchFunction == null) beginBatchFunction = Configuration.BeginBatchFunction;
|
||||
if (spriteBatchSettings == null) spriteBatchSettings = Configuration.spriteBatchSettings;
|
||||
if (crop && camera == null) camera = Configuration.Camera2D;
|
||||
this.beginBatch = beginBatchFunction;
|
||||
this.spriteBatchSettings = spriteBatchSettings.Value;
|
||||
this.camera = camera;
|
||||
if (crop)
|
||||
{
|
||||
@ -53,7 +54,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
if (scissorBounds != null)
|
||||
{
|
||||
batch.End();
|
||||
beginBatch(batch);
|
||||
spriteBatchSettings.BeginSpriteBatch(batch);
|
||||
scissorBounds.Width = situation.Width;
|
||||
scissorBounds.Height = situation.Height;
|
||||
scissorBounds.X = situation.X;
|
||||
@ -78,7 +79,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
{
|
||||
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
|
||||
batch.End();
|
||||
beginBatch(batch);
|
||||
spriteBatchSettings.BeginSpriteBatch(batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +107,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
{
|
||||
throw new InvalidOperationException(module.ToString() + " already exists in " + this.ToString());
|
||||
}
|
||||
module.Parent = this;
|
||||
module.parent = this;
|
||||
modules.Add(module);
|
||||
}
|
||||
}
|
||||
@ -117,7 +118,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
||||
/// <param name="module">module to remove.</param>
|
||||
public void RemoveModule(UIModule module)
|
||||
{
|
||||
module.Parent = null;
|
||||
module.parent = null;
|
||||
modules.Remove(module);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user