Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ProjectInstaller : ScriptableObjectInstaller
- {
- public override void InstallBindings()
- {
- Container.BindFactory<AppStateMachine, Type, IExitableState, StatePlaceholderFactory>().FromFactory<StateFactory>();
- }
- }
- public class StatePlaceholderFactory : PlaceholderFactory<AppStateMachine, Type, IExitableState>
- {
- }
- public class StateFactory : IFactory<AppStateMachine, Type, IExitableState>
- {
- private readonly DiContainer diContainer;
- [Inject]
- private void Construct(/*Here some services*/)
- {
- }
- public StateFactory(DiContainer container)
- {
- diContainer = container;
- }
- public IExitableState Create(AppStateMachine param, Type type)
- {
- return (IExitableState)diContainer.Instantiate(type, new[] { param });
- }
- }
- public class Test : IExitableState
- {
- public Test(AppStateMachine stateMachine)
- {
- }
- }
- public interface IExitableState
- {
- }
- public class AppStateMachine
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement