began implementing skin system.

This commit is contained in:
Harrison Deng 2019-01-20 23:32:51 -06:00
parent 549d30396e
commit 0e4fd611db

View File

@ -38,7 +38,8 @@ namespace RecrownedAthenaeum
private MainScreen mainScreen;
private Texture2D currentCursorTexture;
internal readonly MusicController musicController;
private Skin skin;
private SkinManager skinManager = new SkinManager();
private readonly ISkin skin;
public RhythmBulletGame()
{
@ -47,12 +48,13 @@ namespace RecrownedAthenaeum
assets = new ContentManagerController(Content);
musicController = new MusicController();
skin = skinManager.Skin;
resolutionContentResolver = new ResolutionContentResolver();
FontContentResolver fcr = new FontContentResolver(resolutionContentResolver);
assets.contentPathModifier.Add(typeof(Texture2D), resolutionContentResolver);
assets.contentPathModifier.Add(typeof(SpriteFont), fcr);
preferencesManager = new PreferencesManager(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet",
preferencesManager = new PreferencesManager(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/RhythmBullet",
new General(),
new Controls());
preferencesManager.Load();
@ -123,12 +125,10 @@ namespace RecrownedAthenaeum
else if (!initialLoadComplete)
{
Debug.WriteLine("Initial load complete.");
initialLoadComplete = true;
SetUpCursor();
mainScreen = new MainScreen(assets);
Initiate();
}
screenManager.UpdateCurrentScreen(gameTime, assets.Done && musicController.musicList.Searched);
screenManager.UpdateCurrentScreen(gameTime, CheckReadyForInitiate());
InputUtilities.Update();
Camera.Update();
@ -156,7 +156,7 @@ namespace RecrownedAthenaeum
assets.UnloadAll();
QueueContent();
screenManager.Resize(new LoadingScreen(this, Content.Load<Texture2D>("loading_ring"), 0.4f, true));
SetUpCursor();
UpdateCursor();
}
private void PostResize()
@ -174,9 +174,16 @@ namespace RecrownedAthenaeum
assets.Queue<TextureAtlas>("UI");
}
private void SetUpCursor()
private void Initiate()
{
Texture2D texture = assets.Get<Texture2D>("cursor");
initialLoadComplete = true;
UpdateCursor();
mainScreen = new MainScreen(assets);
}
private void UpdateCursor()
{
Texture2D texture = skin.CursorTexture;
int cursorSize = (int)(0.08f * graphics.PreferredBackBufferHeight);
Debug.WriteLine("Cursor size length: " + cursorSize);
RenderTarget2D renderTarget = new RenderTarget2D(GraphicsDevice, cursorSize, cursorSize);
@ -192,6 +199,11 @@ namespace RecrownedAthenaeum
Mouse.SetCursor(MouseCursor.FromTexture2D(currentCursorTexture, currentCursorTexture.Width / 2, currentCursorTexture.Height / 2));
}
private bool CheckReadyForInitiate()
{
return assets.Done && musicController.musicList.Searched && skinManager.ReadyForUse;
}
private void ShowFirstScreen(Screen Screen)
{
Screen.NextScreen = mainScreen;