Beispiel #1
0
        private ParameterProxy CreateParameterProxy(ParameterBase param, EntityData _entity)
        {
            ParameterProxy proxy = null;

            if (param is Parameter_Boolean)
            {
                proxy = new ParameterProxy_Boolean(_entity, (Parameter_Boolean)param);
            }
            else if (param is Parameter_Integer)
            {
                proxy = new ParameterProxy_Integer(_entity, (Parameter_Integer)param);
            }
            else if (param is Parameter_Double)
            {
                proxy = new ParameterProxy_Double(_entity, (Parameter_Double)param);
            }
            else if (param is Parameter_DoubleRange)
            {
                proxy = new ParameterProxy_DoubleRange(_entity, (Parameter_DoubleRange)param);
            }
            else if (param is Parameter_String)
            {
                proxy = new ParameterProxy_String(_entity, (Parameter_String)param);
            }
            else if (param is Parameter_List)
            {
                proxy = new ParameterProxy_List(_entity, (Parameter_List)param);
            }
            else if (param is Parameter_Vector3)
            {
                proxy = new ParameterProxy_Vector3(_entity, (Parameter_Vector3)param);
            }

            return(proxy);
        }
Beispiel #2
0
        protected override void FindVariables()
        {
            ParameterBase[] parameters = FindParameters();
            foreach (ParameterBase param in parameters)
            {
                ParameterProxy proxy = CreateParameterProxy(param, Entity);

                if (proxy != null)
                {
                    if (proxy.IsValid())
                    {
                        m_proxies.Add(proxy);
                    }
                    else
                    {
                        Debug.LogWarningFormat("Could not find entity value '{0}' of type {1} in entity '{2}'",
                                               param.Name, proxy.GetTypeName(), Entity.Name);
                    }
                }
                else
                {
                    Debug.LogWarningFormat("Could not create proxy for type of parameter '{0}'", param.Name);
                }
            }
        }
Beispiel #3
0
        protected void FindVariables()
        {
            // transform variables
            m_valEnabled  = CanDisableGameObject() ? m_entity.GetValue_Boolean(EntityValue.ENABLED) : null;
            m_valPosition = DoTrans() ? m_entity.GetValue_Vector3D(EntityValue.POSITION) : null;
            m_valRotation = DoRot() ? m_entity.GetValue_Quaternion(EntityValue.ROTATION) : null;
            m_valScale    = DoScale() ? m_entity.GetValue_Vector3D(EntityValue.SCALE) : null;

            // parameter variables
            List <ParameterBase> parameters = FindParameters();

            foreach (ParameterBase param in parameters)
            {
                ParameterProxy proxy = CreateParameterProxy(param, m_entity);

                if (proxy != null)
                {
                    if (proxy.IsValid())
                    {
                        m_proxies.Add(proxy);
                    }
                    else
                    {
                        Debug.LogWarningFormat("Could not find entity value '{0}' of type {1} in entity '{2}'",
                                               param.Name, proxy.GetTypeName(), m_entity.Name);
                    }
                }
                else
                {
                    Debug.LogWarningFormat("Could not create proxy for type of parameter '{0}'", param.Name);
                }
            }
        }
Beispiel #4
0
        public void Execute(object parameter, NSObject source)
        {
            var responder = ResponderForSelector(executeSelector);

            if (responder == null)
            {
                return;
            }

            if (selectorSupportsParameter)
            {
                var parameterProxy = ParameterProxy.Create(parameter);
                try {
                    objc_msgSend_void_IntPtr_IntPtr(
                        responder.Handle,
                        executeSelector.Handle,
                        source == null ? IntPtr.Zero : source.Handle,
                        parameterProxy == null ? IntPtr.Zero : parameterProxy.Handle);
                    return;
                } finally {
                    parameterProxy?.Dispose();
                }
            }

            objc_msgSend_void_IntPtr(
                responder.Handle,
                executeSelector.Handle,
                source == null ? IntPtr.Zero : source.Handle);
        }
Beispiel #5
0
        protected void CreateVariables(EntityData _entity)
        {
            // transform variables
            if (CanDisableGameObject())
            {
                _entity.AddValue_Boolean(EntityValue.ENABLED, gameObject.activeSelf);
            }

            if (DoTrans())
            {
                _entity.AddValue_Vector3D(EntityValue.POSITION, transform.localPosition);
            }

            if (DoRot())
            {
                _entity.AddValue_Quaternion(EntityValue.ROTATION, transform.localRotation);
            }

            if (DoScale() && GetComponent <Camera>() == null)
            {
                // no scale in cameras
                _entity.AddValue_Vector3D(EntityValue.SCALE, transform.localScale);
            }

            // parameter variables
            List <ParameterBase> parameters = FindParameters();

            foreach (ParameterBase param in parameters)
            {
                ParameterProxy proxy = CreateParameterProxy(param, _entity);

                if (proxy != null)
                {
                    if (proxy.IsValid())
                    {
                        m_proxies.Add(proxy);
                    }
                    else
                    {
                        Debug.LogWarningFormat("Could not create entity value '{0}' of type {1} in entity '{2}'",
                                               param.Name, proxy.GetTypeName(), _entity.Name);
                    }
                }
                else
                {
                    Debug.LogWarningFormat("Could not create proxy for type of parameter '{0}'", param.Name);
                }
            }
        }
Beispiel #6
0
        public bool CanExecute(object parameter, NSObject source)
        {
            if (canExecuteSelector != null)
            {
                var responder = ResponderForSelector(canExecuteSelector);
                if (responder != null)
                {
                    var parameterProxy = ParameterProxy.Create(parameter);
                    try {
                        return(objc_msgSend_bool_IntPtr_IntPtr(
                                   responder.Handle,
                                   executeSelector.Handle,
                                   source == null ? IntPtr.Zero : source.Handle,
                                   parameterProxy == null ? IntPtr.Zero : parameterProxy.Handle));
                    } finally {
                        parameterProxy?.Dispose();
                    }
                }
            }

            return(ResponderForSelector(executeSelector) != null);
        }