Ejemplo n.º 1
0
    public void RegisterDebugValue <TObservableProperties>(float stepLength,
                                                           string name,
                                                           float defaultValue,
                                                           TObservableProperties
                                                           observableProperties,
                                                           Action <TObservableProperties, float>
                                                           propertySetter)
        where TObservableProperties : class, IObservableProperties
    {
        var debuggableValue = new DebuggableValueModel
        {
            Name       = name,
            StepLength = stepLength
        };

        bool saveDoesNotExist = !SaveService.TryLoad(debuggableValue);

        if (saveDoesNotExist)
        {
            debuggableValue.Value = defaultValue;
            SaveValue(debuggableValue);
        }

        observableProperties
        .Bind <TObservableProperties, float>(val => propertySetter(observableProperties, val))
        .ToProperty(debuggableValue, dv => dv.Value, nameof(DebuggableValueModel.Value));

        DebuggableValuesContainer.Add(debuggableValue);
    }
    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);
    }