Beispiel #1
0
        public void SetAction(ActValue <object> action)
        {
            this.action = () => {
#if UNITY_EDITOR
                flow_state = FlowState.Active;
#endif
                return((T)action());
            };
        }
Beispiel #2
0
 // The cast parameter is used to differentiate the constructor
 public OutputValue(Node node, Type type, ActValue <object> action)
 {
     this.node = node;
     if (typeof(T).IsAssignableFrom(type))
     {
         this.action = () => {
             return((T)action());
         };
     }
 }
Beispiel #3
0
        protected Port RegisterOutputValue(Type type, string name, ActValue <object> action, bool display_port = true)
        {
            recently_modified.Add(name);
            Port p;

            if (outputs.TryGetValue(name, out p))
            {
                p.display_port = display_port;
                IOutputValue output = p as IOutputValue;
                if (output != null)
                {
                    output.SetAction(action);
                    return((Port)output);
                }
            }
            return(RegisterOutputPort(name, (ValuePort)CreateGenericInstance(typeof(OutputValue <>), type, this, type, action), display_port));
        }
Beispiel #4
0
        protected OutputValue <T> RegisterOutputValue <T>(string name, ActValue <T> action, bool display_port = true)
        {
            recently_modified.Add(name);
            Port p;

            if (outputs.TryGetValue(name, out p))
            {
                p.display_port = display_port;
                OutputValue <T> output = p as OutputValue <T>;
                if (output)
                {
                    output.SetAction(action);
                    return(output);
                }
            }
            return(RegisterOutputPort(name, new OutputValue <T>(this, action), display_port));
        }
Beispiel #5
0
        public virtual List <ActValue> GetAO()
        {
            SqlParameter[] parms = { new SqlParameter("@AO", SqlDbType.Int) };
            parms[0].Value = (int)EnmScType.Aoc;

            var entities = new List <ActValue>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_His.Sql_Value_Repository_GetAO, parms)) {
                while (rdr.Read())
                {
                    var entity = new ActValue();
                    entity.DevId      = SqlTypeConverter.DBNullInt32Handler(rdr["DevId"]);
                    entity.NodeId     = SqlTypeConverter.DBNullInt32Handler(rdr["NodeId"]);
                    entity.NodeType   = SqlTypeConverter.DBNullEnmScTypeHandler(rdr["NodeType"]);
                    entity.Value      = SqlTypeConverter.DBNullFloatHandler(rdr["Value"]);
                    entity.State      = SqlTypeConverter.DBNullEnmPointStatusHandler(rdr["State"]);
                    entity.UpdateTime = SqlTypeConverter.DBNullDateTimeHandler(rdr["UpdateTime"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }
Beispiel #6
0
 public void SetAction(ActValue <T> action)
 {
     this.action = action;
 }
Beispiel #7
0
 public OutputValue(Node node, ActValue <T> action)
 {
     this.node   = node;
     this.action = action;
 }