Ejemplo n.º 1
0
        private void GenerateExposedMethodButtons()
        {
            if (Inspector.ShowRemoveComponentButton && typeof(Component).IsAssignableFrom(BoundVariableType) && !typeof(Transform).IsAssignableFrom(BoundVariableType))
            {
                CreateExposedMethodButton(GameObjectField.removeComponentMethod, () => this, (value) => { });
            }

            ExposedMethod[] methods = BoundVariableType.GetExposedMethods();
            if (methods != null)
            {
                bool isInitialized = Value != null && !Value.Equals(null);
                for (int i = 0; i < methods.Length; i++)
                {
                    ExposedMethod method = methods[i];
                    if ((isInitialized && method.VisibleWhenInitialized) || (!isInitialized && method.VisibleWhenUninitialized))
                    {
                        CreateExposedMethodButton(method, () => Value, (value) => Value = value);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void GenerateMethods()
        {
            ExposedMethod[] methods = BoundVariableType.GetExposedMethods();
            if (methods != null)
            {
                bool isInitialized = Value != null && !Value.Equals(null);
                for (int i = 0; i < methods.Length; i++)
                {
                    ExposedMethod method = methods[i];
                    if ((isInitialized && method.VisibleWhenInitialized) || (!isInitialized && method.VisibleWhenUninitialized))
                    {
                        ExposedMethodField methodDrawer = (ExposedMethodField)Inspector.CreateDrawerForType(typeof(ExposedMethod), drawArea, Depth + 1, false);
                        if (methodDrawer != null)
                        {
                            methodDrawer.BindTo(typeof(ExposedMethod), string.Empty, () => Value, (value) => Value = value);
                            methodDrawer.SetBoundMethod(method);

                            exposedMethods.Add(methodDrawer);
                        }
                    }
                }
            }
        }