added default skin books can use for their pages.

This commit is contained in:
Harrison Deng 2019-01-27 17:43:17 -06:00
parent 9d84b641db
commit ac97cc64c0
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@
using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.Camera;
using RecrownedAthenaeum.ContentSystem;
using RecrownedAthenaeum.UI.SkinSystem;
using System.Collections.Generic;
using System.Linq;
@ -13,6 +14,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
public class Book
{
readonly ContentManagerController assets;
readonly Skin skin;
Camera2D camera;
Page targetPage;
Rectangle dimensions;
@ -22,7 +24,8 @@ namespace RecrownedAthenaeum.UI.BookSystem
/// Creates a book.
/// </summary>
/// <param name="assets"><see cref="ContentManagerController"/> that holds the assets that are to be used in the pages for this book during initialization.</param>
public Book(ContentManagerController assets)
/// <param name="skin">The skin that will be passed to pages during their initialization.</param>
public Book(ContentManagerController assets, Skin skin)
{
this.assets = assets;
}
@ -30,6 +33,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
/// <summary>
/// Should be called whenever a valid camera and dimensions for the book exist.
/// Initializes book with given parameters.
/// Generally used with a <see cref="ScreenSystem.Screen"/> and called in the <see cref="ScreenSystem.Screen.Initiate(Rectangle, Camera2D)"/> function.
/// </summary>
/// <param name="camera">Camera game is currently using.</param>
/// <param name="dimensions">Dimensions of the book and the dimensions the pages will use.</param>
@ -87,7 +91,7 @@ namespace RecrownedAthenaeum.UI.BookSystem
{
foreach (Page page in pages)
{
page.Initialize(assets);
page.Initialize(assets, skin);
this.pages.Add(page.Name, page);
}
}

View File

@ -1,5 +1,6 @@
using RecrownedAthenaeum.ContentSystem;
using RecrownedAthenaeum.UI.Modular;
using RecrownedAthenaeum.UI.SkinSystem;
namespace RecrownedAthenaeum.UI.BookSystem
{
@ -45,7 +46,8 @@ namespace RecrownedAthenaeum.UI.BookSystem
/// Called only once after a page is added to a <see cref="Book"/>. Generally used to instantiate the modules of the page.
/// </summary>
/// <param name="assets">The assets to be used during initialization passed by the book this page belongs to.</param>
protected internal virtual void Initialize(ContentManagerController assets)
/// <param name="skin">The skin the book containing this page is given that can be used by this page.</param>
protected internal virtual void Initialize(ContentManagerController assets, Skin skin)
{
}