progress on asset management system

This commit is contained in:
2018-09-12 01:32:05 -05:00
parent 8d80913fe2
commit 419fb6ab6b
76 changed files with 918 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
using RhythmBullet.Zer01HD.UI;
using RhythmBullet.Zer01HD.UI.Page;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game.MainScreen
{
public class MainPage : Page
class MainPage : Page
{
public MainPage(int pageX, int pageY) : base(pageX, pageY)
{

View File

@@ -6,9 +6,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.UI
namespace RhythmBullet.Zer01HD.UI.Page
{
public class Page
class Page
{
private readonly int pageX, pageY;
public readonly int xPos, yPos;

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.UI
namespace RhythmBullet.Zer01HD.UI.Page
{
class PageManager
{

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.UI.Screen
{
public class Screen
class Screen
{
public void Update(GameTime gameTime)
{

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
{
class ContentLoader
{
}
}

View File

@@ -0,0 +1,40 @@
using Microsoft.Xna.Framework.Content;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
{
class ContentSystem
{
private readonly ContentManager contentManager;
private readonly Queue<Dictionary<Type, string>> queue;
private Dictionary<string, IDisposable> assets;
readonly Dictionary<Type, IContentResolver> contentResolver;
public ContentSystem(ContentManager contentManager)
{
this.contentManager = contentManager;
assets = new Dictionary<string, IDisposable>();
queue = new Queue<Dictionary<Type, string>>();
contentResolver = new Dictionary<Type, IContentResolver>();
}
void Load(string assetName, Type type)
{
if (assets.ContainsKey(assetName))
{
IContentResolver handler = contentResolver[type];
string path = handler.Load(assetName);
assets.Add(assetName, contentManager.Load<IDisposable>(path));
}
}
T get<T> (string assetName)
{
return (T)assets[assetName];
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Utilities.ContentSystem
{
interface IContentResolver
{
string Load(string path);
}
}