progress on asset management system
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.UI.Screen
|
||||
{
|
||||
public class Screen
|
||||
class Screen
|
||||
{
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
|
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user