public void Initialize(PropertyInfo propertyInfo, object propertyInfoResolutionObject, ISchemaProvider schemaProvider)
        {
            var foundMutableField      = propertyInfo.GetValue(propertyInfoResolutionObject, null);
            var assignableMutableField = foundMutableField as IMutableField;

            MutableField = assignableMutableField;

            SchemaProvider = schemaProvider;

            Type = propertyInfo.PropertyType.GetGenericArguments().First();

            var controllableAttribute = propertyInfo.GetCustomAttributes(typeof(ControllableAttribute), true).Cast <ControllableAttribute>().FirstOrDefault();

            if (controllableAttribute != null)
            {
                ConnectValidValuesProperty(propertyInfoResolutionObject, controllableAttribute);
            }

            LabelText = ControllableUtility.GetControllableLabel(propertyInfo);


            if (!ShowLabel)
            {
                LabelComponent.gameObject.SetActive(false);
                MainContentsPanel.offsetMin = new Vector2(16, MainContentsPanel.offsetMin.y);
            }

            PopulateInitialValue();
        }
        private static void AddMethod(MethodInfo methodInfo, IControllableMemberGeneratable view)
        {
            var button = AddElement <ButtonBehaviour>(ButtonPrefab, view);

            button.LabelText = ControllableUtility.GetControllableLabel(methodInfo);

            button.Clicked += () => methodInfo.Invoke(view.Model, null);
        }
        private static void AddTextBox(PropertyInfo propertyInfo, IControllableMemberGeneratable view)
        {
            var textBox = AddElement <TextBoxBehaviour>(TextBoxPrefab, view);

            textBox.TextSubmitted += s =>
            {
                propertyInfo.SetValue(view.Model, s, null);
            };

            textBox.Text = propertyInfo.GetValue(view.Model, null) as string;

            textBox.LabelText = ControllableUtility.GetControllableLabel(propertyInfo);
        }
        private static void AddReadOnlyObjectBox(PropertyInfo propertyInfo, IControllableMemberGeneratable view)
        {
            var textBox = AddElement <TextBoxBehaviour>(TextBoxPrefab, view);

            textBox.Interactable = false;

            // object-type text boxes are read-only ( interactable is false)
            textBox.TextSubmitted += s =>
            {
            };

            textBox.Text = propertyInfo.GetValue(view.Model, null).ToString();

            textBox.LabelText = ControllableUtility.GetControllableLabel(propertyInfo);
        }
Beispiel #5
0
        public void Initialize(PropertyInfo propertyInfo, object propertyInfoResolutionObject, ISchemaProvider schemaProvider)
        {
            var foundMutableField      = propertyInfo.GetValue(propertyInfoResolutionObject, null);
            var assignableMutableField = foundMutableField as MutableTarget;

            MutableTarget = assignableMutableField;


            SchemaProvider = schemaProvider;


            StringKeyLabelText = ControllableUtility.GetControllableLabel(propertyInfo) + " Value Name";

            MutableLabelText = ControllableUtility.GetControllableLabel(propertyInfo) + " Path";


            PopulateInitialValue();
        }
        private static void AddPayloadExpression(PropertyInfo propertyInfo, IControllableMemberGeneratable controllable)
        {
            // set up a payload expression ...

            var foundObj   = propertyInfo.GetValue(controllable.Model, null);
            var expression = foundObj as PayloadExpression;

            var view = AddElement <PayloadExpressionControllableViewBehaviour>(PayloadExpressionControllablePrefab, controllable);

            //var view = go.GetComponent<PayloadExpressionControllableViewBehaviour>();

            //view.transform.SetParent(OptionsRootTransform, false);
            //view.transform.SetAsLastSibling();

            view.PropertyName      = ControllableUtility.GetControllableLabel(propertyInfo);
            view.PayloadExpression = expression;

            view.ExternalSchemaProvider = controllable.SchemaProvider;
        }
Beispiel #7
0
        public void Initialize(PropertyInfo propertyInfo, object propertyInfoResolutionObject, ISchemaProvider schemaProvider)
        {
            var foundScope      = propertyInfo.GetValue(propertyInfoResolutionObject, null);
            var assignableScope = foundScope as MutableScope;

            Scope = assignableScope;

            SchemaProvider = schemaProvider;

            LabelText = ControllableUtility.GetControllableLabel(propertyInfo);


            if (!ShowLabel)
            {
                LabelComponent.gameObject.SetActive(false);
                MainContentsPanel.offsetMin = new Vector2(16, MainContentsPanel.offsetMin.y);
            }

            PopulateInitialValue();
        }