I added some Costum Controls to j3o objects using the SDK’s Scene Explorer. Because some of these Controls have dependencies to other services, I get the Control after loading it with the AssetManager and resolve those with Setters. However, I’d like to use Guice (DI container) to resolve dependencies, but therefore, I’ve to create all objects (with dependencies) with Guice’s Injector.
So (a): In general, is it a bad idea to use Guice in games?
(b): Can I somehow change the way j3o’s AssetLoader instantiates Controls?
Solutions I thought about:
i) Like unregister the loader, extend it and override a magic cool method, then register the extending class as AssetLoader for j3o? Is this possible?
ii) I could remove the Controls in the Scene Explorer and add their class names as UserData. Then, again, I could(?) unregister the AssetLoader, extend it, call super in the loading method and create the Controls after the real loader finished its work, then register the new loader for j3o? (What’s the name of j3o’s AssetLoader class? Couldn’t find it).
iii) Don’t use the Scene Explorer to add Controls but use a second file that defines the Controls. (Negative: more files)
iv) Instantiate and add the controls in the code (Negative: more lines to load the object)
Which solutions are possible / not too dirty / good (why)?
With best regards