protected override void Configure(DynamicModelContainer <DebuggableValueModel> modelContainer,
                                      DynamicViewModelContainer <DebuggableValueViewModel>
                                      viewModelContainer,
                                      DebugViewContainer viewContainer,
                                      DebugService debugService,
                                      DebuggableValueViewFactory debuggableValueViewFactory)
    {
        viewModelContainer.BindContainer()
        .ToContainer(modelContainer,
                     model => ViewModelFactoryMethod(model, debugService));

        viewContainer.BindContainer().ToContainer(viewModelContainer,
                                                  vm => ViewFactoryMethod(
                                                      vm, debuggableValueViewFactory,
                                                      viewContainer.transform));
    }
    public override void InstallBindings()
    {
        Debug.Log("Configure " + nameof(ContainerConfiguration));
        DynamicModelContainer <TestModel> modelContainer = new DynamicModelContainer <TestModel>();

        modelContainer.Add(new TestModel()
        {
            Value = 0
        });
        modelContainer.Add(new TestModel()
        {
            Value = 1
        });


        Container.Bind <PrefabSettings>().FromInstance(prefabSettings);
        Container.Bind <DynamicModelContainer <TestModel> >().FromInstance(modelContainer).AsSingle();
        Container.BindPoolContainer <TestView, ITestViewModel, TestViewFactory>(prefabSettings.PrefabList);
    }
Exemplo n.º 3
0
    protected override void Configure(DynamicModelContainer <TestModel> mContainer,
                                      DynamicViewModelContainer <TestViewModel> vmContainer,
                                      TestViewContainer vContainer,
                                      TestViewFactory factory)
    {
        Debug.Log("Configure " + nameof(TestDynamicViewConfiguration));

        // DEBUG REFLECTION LISTENING START ------------------------------------------------------------------------------
        //var propertyInfo =
        //    typeof(DynamicModelContainer<TestModel>).GetField("MutableCollection",
        //                                                         BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
        //var fieldInfoVm = typeof(DynamicViewModelContainer<TestViewModel>).GetField("MutableCollection",
        //                                                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

        //if (fieldInfoVm == null || propertyInfo == null)
        //{
        //    Debug.LogError("PropertyInfo is null.");
        //}
        //else
        //{
        //    var mContainerProperty =
        //        (ObservableCollection<TestModel>)propertyInfo.GetValue(mContainer);

        //    var vmContainerProperty =
        //        (ObservableCollection<TestViewModel>)fieldInfoVm.GetValue(vmContainer);

        //    mContainerProperty.CollectionChanged += MockListenerModel;

        //    vmContainerProperty.CollectionChanged += MockListenerViewModel;
        //}

        //Debug.Log("MC Listeners: " + mContainer.Listeners.Count + " | Subscriptions: " + mContainer.Subscriptions.Count);
        //Debug.Log("VMC Listeners: " + vmContainer.Listeners.Count + " | Subscriptions: " + vmContainer.Subscriptions.Count);
        // DEBUG REFLECTION LISTENING END ---------------------------------------------------------------------------------------

        vmContainer.BindContainer().ToContainer(mContainer, m => TestVMFactory(m));

        vContainer.BindContainer().ToContainer(vmContainer,
                                               vm => TestViewFactory(
                                                   vm, factory,
                                                   vContainer.transform));
    }
Exemplo n.º 4
0
 public DebugService(ISaveService saveService,
                     DynamicModelContainer <DebuggableValueModel> debuggableValuesContainer)
 {
     SaveService = saveService;
     DebuggableValuesContainer = debuggableValuesContainer;
 }