2019-11-24 20:49:53 +00:00
|
|
|
|
using RecrownedAthenaeum.Assets;
|
2019-12-28 20:35:01 +00:00
|
|
|
|
using RecrownedAthenaeum.Graphics.Render;
|
2019-12-28 21:41:06 +00:00
|
|
|
|
using RecrownedAthenaeum.Graphics.UI.Modular;
|
|
|
|
|
using RecrownedAthenaeum.Graphics.UI.SkinSystem;
|
2018-11-30 02:41:06 +00:00
|
|
|
|
|
2019-12-28 21:41:06 +00:00
|
|
|
|
namespace RecrownedAthenaeum.Graphics.UI.BookSystem
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
2019-01-14 07:26:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A page a part of a <see cref="Book"/>.
|
|
|
|
|
/// </summary>
|
2018-12-04 13:45:09 +00:00
|
|
|
|
public class Page : UIModuleGroup
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly int pageX, pageY;
|
2019-01-14 07:26:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether or not this book needs to be refreshed with new dimensions.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool requiresSizeUpdate;
|
2018-11-30 02:41:06 +00:00
|
|
|
|
|
2019-01-14 07:26:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructs a page.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pageX">The X position in the book.</param>
|
|
|
|
|
/// <param name="pageY">The Y position in the book.</param>
|
2019-03-24 00:04:43 +00:00
|
|
|
|
public Page(int pageX, int pageY) : base()
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
|
|
|
|
this.pageX = pageX;
|
|
|
|
|
this.pageY = pageY;
|
2019-01-14 07:26:46 +00:00
|
|
|
|
requiresSizeUpdate = true;
|
2019-03-10 06:49:25 +00:00
|
|
|
|
name = ToString();
|
2018-11-30 02:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-14 07:26:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Called when this page is flagged as needing a size update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="width">New width.</param>
|
|
|
|
|
/// <param name="height">New Height</param>
|
2018-11-30 02:41:06 +00:00
|
|
|
|
public virtual void ApplySize(int width, int height)
|
|
|
|
|
{
|
2019-04-09 04:58:27 +00:00
|
|
|
|
X = pageX * width;
|
|
|
|
|
Y = pageY * height;
|
|
|
|
|
Width = width;
|
|
|
|
|
Height = height;
|
2019-01-14 07:26:46 +00:00
|
|
|
|
requiresSizeUpdate = false;
|
2018-11-30 02:41:06 +00:00
|
|
|
|
}
|
2019-01-27 20:57:47 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Called only once after a page is added to a <see cref="Book"/>. Generally used to instantiate the modules of the page.
|
|
|
|
|
/// </summary>
|
2019-01-27 21:24:31 +00:00
|
|
|
|
/// <param name="assets">The assets to be used during initialization passed by the book this page belongs to.</param>
|
2019-01-27 23:43:17 +00:00
|
|
|
|
/// <param name="skin">The skin the book containing this page is given that can be used by this page.</param>
|
2019-03-27 07:35:20 +00:00
|
|
|
|
/// <param name="basicScissor">The scissor box to use for cropping.</param>
|
2019-11-24 05:17:21 +00:00
|
|
|
|
protected internal virtual void Initialize(AssetManager assets, ISkin skin, BasicScissor basicScissor)
|
2019-01-27 20:57:47 +00:00
|
|
|
|
{
|
2019-03-27 07:35:20 +00:00
|
|
|
|
this.basicScissor = basicScissor;
|
2019-01-27 20:57:47 +00:00
|
|
|
|
}
|
2018-11-30 02:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|