remove IGameApp dependencies. game app code can use services as needed
This could perhaps backfire (regarding coupling), but I think in the end that this will have more 'pros' then 'cons' ...
This commit is contained in:
parent
9f929e8f12
commit
db4802beda
|
@ -10,16 +10,11 @@ namespace Blarg.GameFramework.Content
|
||||||
Dictionary<Type, IContentLoaderBase> _loaders;
|
Dictionary<Type, IContentLoaderBase> _loaders;
|
||||||
|
|
||||||
public bool IsLoaded { get; private set; }
|
public bool IsLoaded { get; private set; }
|
||||||
public readonly IGameApp GameApp;
|
|
||||||
|
|
||||||
public ContentManager(IGameApp gameApp)
|
public ContentManager()
|
||||||
{
|
{
|
||||||
if (gameApp == null)
|
|
||||||
throw new ArgumentNullException("gameApp");
|
|
||||||
|
|
||||||
_loaders = new Dictionary<Type, IContentLoaderBase>();
|
_loaders = new Dictionary<Type, IContentLoaderBase>();
|
||||||
IsLoaded = false;
|
IsLoaded = false;
|
||||||
GameApp = gameApp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterLoader(IContentLoaderBase loader)
|
public void RegisterLoader(IContentLoaderBase loader)
|
||||||
|
|
|
@ -6,7 +6,6 @@ namespace Blarg.GameFramework.Processes
|
||||||
{
|
{
|
||||||
public class GameProcess : EventListener, IDisposable
|
public class GameProcess : EventListener, IDisposable
|
||||||
{
|
{
|
||||||
public readonly IGameApp GameApp;
|
|
||||||
public readonly GameState GameState;
|
public readonly GameState GameState;
|
||||||
public readonly ProcessManager ProcessManager;
|
public readonly ProcessManager ProcessManager;
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ namespace Blarg.GameFramework.Processes
|
||||||
|
|
||||||
GameState = processManager.GameState;
|
GameState = processManager.GameState;
|
||||||
ProcessManager = processManager;
|
ProcessManager = processManager;
|
||||||
GameApp = GameState.GameApp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetFinished()
|
protected void SetFinished()
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace Blarg.GameFramework.States
|
||||||
{
|
{
|
||||||
public abstract class GameState : EventListener, IDisposable
|
public abstract class GameState : EventListener, IDisposable
|
||||||
{
|
{
|
||||||
public IGameApp GameApp { get; private set; }
|
|
||||||
public readonly ProcessManager ProcessManager;
|
public readonly ProcessManager ProcessManager;
|
||||||
public readonly ScreenEffectManager EffectManager;
|
public readonly ScreenEffectManager EffectManager;
|
||||||
public readonly StateManager StateManager;
|
public readonly StateManager StateManager;
|
||||||
|
@ -31,7 +30,6 @@ namespace Blarg.GameFramework.States
|
||||||
if (stateManager == null)
|
if (stateManager == null)
|
||||||
throw new ArgumentNullException("stateManager");
|
throw new ArgumentNullException("stateManager");
|
||||||
|
|
||||||
GameApp = stateManager.GameApp;
|
|
||||||
StateManager = stateManager;
|
StateManager = stateManager;
|
||||||
|
|
||||||
EffectManager = new ScreenEffectManager();
|
EffectManager = new ScreenEffectManager();
|
||||||
|
|
|
@ -16,19 +16,15 @@ namespace Blarg.GameFramework.States
|
||||||
bool _swapQueueHasOverlay;
|
bool _swapQueueHasOverlay;
|
||||||
bool _lastCleanedStatesWereAllOverlays;
|
bool _lastCleanedStatesWereAllOverlays;
|
||||||
|
|
||||||
public readonly IGameApp GameApp;
|
|
||||||
public readonly EventManager EventManager;
|
public readonly EventManager EventManager;
|
||||||
|
|
||||||
public int? LastReturnValue { get; private set; }
|
public int? LastReturnValue { get; private set; }
|
||||||
|
|
||||||
public StateManager(IGameApp gameApp, EventManager eventManager)
|
public StateManager(EventManager eventManager)
|
||||||
{
|
{
|
||||||
if (gameApp == null)
|
|
||||||
throw new ArgumentNullException("gameApp");
|
|
||||||
if (eventManager == null)
|
if (eventManager == null)
|
||||||
throw new ArgumentNullException("eventManager");
|
throw new ArgumentNullException("eventManager");
|
||||||
|
|
||||||
GameApp = gameApp;
|
|
||||||
EventManager = eventManager;
|
EventManager = eventManager;
|
||||||
|
|
||||||
_states = new LinkedList<StateInfo>();
|
_states = new LinkedList<StateInfo>();
|
||||||
|
|
Reference in a new issue