Variable name refactor.
This commit is contained in:
parent
5080deed02
commit
04ec3cd793
@ -98,7 +98,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
|
|||||||
page.camera = camera;
|
page.camera = camera;
|
||||||
page.Initialize(assets, skin);
|
page.Initialize(assets, skin);
|
||||||
orderedPages.Add(page);
|
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>
|
/// <param name="page">Page to remove.</param>
|
||||||
public void RemovePage(Page page)
|
public void RemovePage(Page page)
|
||||||
{
|
{
|
||||||
RemovePage(page.Name);
|
RemovePage(page.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,7 +25,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
|
|||||||
this.pageX = pageX;
|
this.pageX = pageX;
|
||||||
this.pageY = pageY;
|
this.pageY = pageY;
|
||||||
requiresSizeUpdate = true;
|
requiresSizeUpdate = true;
|
||||||
Name = ToString();
|
name = ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -37,12 +37,12 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The parent of this module. May be null.
|
/// The parent of this module. May be null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UIModuleGroup Parent;
|
public UIModuleGroup parent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of this module. For organizational/referencial purposes mostly.
|
/// Name of this module. For organizational/referencial purposes mostly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name;
|
public string name;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The color tint of this module.
|
/// The color tint of this module.
|
||||||
@ -73,9 +73,9 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Rectangle ConvertToParentCoordinates(Rectangle rectangle)
|
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 tX = rectangle.X + parentHitbox.X;
|
||||||
int tY = rectangle.Y + parentHitbox.Y;
|
int tY = rectangle.Y + parentHitbox.Y;
|
||||||
return new Rectangle(tX, tY, rectangle.Width, rectangle.Height);
|
return new Rectangle(tX, tY, rectangle.Width, rectangle.Height);
|
||||||
@ -91,8 +91,8 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void RemoveFromParent()
|
public void RemoveFromParent()
|
||||||
{
|
{
|
||||||
if (Parent == null) throw new InvalidOperationException("Parent is null.");
|
if (parent == null) throw new InvalidOperationException("Parent is null.");
|
||||||
Parent.RemoveModule(this);
|
parent.RemoveModule(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -125,32 +125,38 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="rectangle">The rectangle to center it in.</param>
|
|
||||||
/// <returns>True if possible and false if not.</returns>
|
/// <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)
|
||||||
|
{
|
||||||
|
Rectangle rectangle = parent.Boundaries;
|
||||||
|
if (parent != null && rectangle.Width >= Boundaries.Width)
|
||||||
{
|
{
|
||||||
situation.X = rectangle.Width / 2 + situation.X;
|
situation.X = rectangle.Width / 2 + situation.X;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="rectangle">The rectangle to center in.</param>
|
|
||||||
/// <returns>True if possible.</returns>
|
/// <returns>True if possible.</returns>
|
||||||
public bool CenterVertically(Rectangle rectangle)
|
public bool CenterVertically()
|
||||||
{
|
{
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
Rectangle rectangle = parent.Boundaries;
|
||||||
if (rectangle.Height >= Boundaries.Height)
|
if (rectangle.Height >= Boundaries.Height)
|
||||||
{
|
{
|
||||||
situation.Y = rectangle.Height / 2 + situation.Y;
|
situation.Y = rectangle.Height / 2 + situation.Y;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using RecrownedAthenaeum.Camera;
|
using RecrownedAthenaeum.Camera;
|
||||||
|
using RecrownedAthenaeum.Render;
|
||||||
using RecrownedAthenaeum.ScreenSystem;
|
using RecrownedAthenaeum.ScreenSystem;
|
||||||
|
|
||||||
namespace RecrownedAthenaeum.UI.Modular
|
namespace RecrownedAthenaeum.UI.Modular
|
||||||
@ -17,7 +18,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
List<UIModule> modules = new List<UIModule>();
|
List<UIModule> modules = new List<UIModule>();
|
||||||
Rectangle scissorBounds;
|
Rectangle scissorBounds;
|
||||||
RasterizerState scissorRasterizer;
|
RasterizerState scissorRasterizer;
|
||||||
BeginBatch beginBatch;
|
SpriteBatchSettings spriteBatchSettings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Camera used by the module for cropping.
|
/// Camera used by the module for cropping.
|
||||||
@ -29,12 +30,12 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="crop">Whether or not to crop out of bounds. Default is false.</param>
|
/// <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="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>
|
/// <param name="spriteBatchSettings">The settings to be used that begins the batch.</param>
|
||||||
public UIModuleGroup(bool crop = false, Camera2D camera = null, BeginBatch beginBatchFunction = null)
|
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;
|
if (crop && camera == null) camera = Configuration.Camera2D;
|
||||||
this.beginBatch = beginBatchFunction;
|
this.spriteBatchSettings = spriteBatchSettings.Value;
|
||||||
this.camera = camera;
|
this.camera = camera;
|
||||||
if (crop)
|
if (crop)
|
||||||
{
|
{
|
||||||
@ -53,7 +54,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
if (scissorBounds != null)
|
if (scissorBounds != null)
|
||||||
{
|
{
|
||||||
batch.End();
|
batch.End();
|
||||||
beginBatch(batch);
|
spriteBatchSettings.BeginSpriteBatch(batch);
|
||||||
scissorBounds.Width = situation.Width;
|
scissorBounds.Width = situation.Width;
|
||||||
scissorBounds.Height = situation.Height;
|
scissorBounds.Height = situation.Height;
|
||||||
scissorBounds.X = situation.X;
|
scissorBounds.X = situation.X;
|
||||||
@ -78,7 +79,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
{
|
{
|
||||||
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
|
batch.GraphicsDevice.ScissorRectangle = scissorBounds;
|
||||||
batch.End();
|
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());
|
throw new InvalidOperationException(module.ToString() + " already exists in " + this.ToString());
|
||||||
}
|
}
|
||||||
module.Parent = this;
|
module.parent = this;
|
||||||
modules.Add(module);
|
modules.Add(module);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +118,7 @@ namespace RecrownedAthenaeum.UI.Modular
|
|||||||
/// <param name="module">module to remove.</param>
|
/// <param name="module">module to remove.</param>
|
||||||
public void RemoveModule(UIModule module)
|
public void RemoveModule(UIModule module)
|
||||||
{
|
{
|
||||||
module.Parent = null;
|
module.parent = null;
|
||||||
modules.Remove(module);
|
modules.Remove(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user