Adding Managers in IGF 0.9.0.0

Dec 19, 2011 at 11:55 AM

I tried this with sunburn-indie v2.0.17.6 and igf v0.9.0.0-win-binaries; visual studio shows error when initializing LocalSessionManager and GuiManager

Error 1 The best overloaded method match for 'Indiefreaks.Xna.Sessions.Local.LocalSessionManager.LocalSessionManager(SynapseGaming.LightingSystem.Core.IManagerServiceProvider)' has some invalid arguments

Error 3 The best overloaded method match for 'Indiefreaks.Xna.Rendering.Gui.GuiManager.GuiManager(SynapseGaming.LightingSystem.Core.IManagerServiceProvider)' has some invalid arguments

 

What changes should I make in the code for adding managers.

I tried changing it from:

 SunBurn.AddManager(new LocalSessionManager(this));
 SunBurn.AddManager(new GuiManager(GraphicsDeviceManager));
to:
 SunBurn.AddManager(new LocalSessionManager(SunBurn));
 SunBurn.AddManager(new GuiManager(SunBurn));

but then i get a runtime error when i call

var sessionManager = Application.SunBurn.GetManager<SessionManager>(true);

Coordinator
Dec 19, 2011 at 3:49 PM

Based on a request from one other developer which made entirely sense, I changed the ManagerType returned by most managers to return an interface instead of a class so that you may implement your own managers yourself based on the IGF ones.

So in this case, you should now get the SessionManager instance using Application.SunBurn.GetManager<ISessionManager>(true).

This is one of the reasons why I'm reworking the Ace on Steroids game and video tutorials. If you happen to find such error getting a manager, simply try adding an "I" before the manager class name as this is how I named them.

Feb 2, 2012 at 6:16 AM
Edited Feb 2, 2012 at 6:21 AM

I'm going this tutorial and have put an I before the manager class and did the changes that raidenlolt wrote but am getting a runtime error that saying Service manager does not contain a service assigned to the 'GuiManager' type.. Do I need to put an I before GuiManager as well? or is there something else I need to change?

 

Just went and did what I just asked about and it worked lol.

Coordinator
Feb 2, 2012 at 9:11 AM

That's exactly how things should be done. Glad you find it out by yourself ;)

Apr 25, 2012 at 12:46 PM

Per above, changed

Application.SunBurn.GetManager<GuiManager>(true).AddScreen(pressStartScreen);

to

Application.SunBurn.GetManager<IGuiManager>(true).AddScreen(pressStartScreen);

and

var sessionManager = Application.SunBurn.GetManager<SessionManager>(true);

to

var sessionManager = Application.SunBurn.GetManager<ISessionManager>(true);

And everything works good.