Ejemplo n.º 1
0
        /// <summary>
        /// Outputs all unique triggers for the given table.
        /// </summary>
        static public int UniqueRuleTriggers(RSRuleTableData inTableData, ICollection <RSTriggerId> outCollection)
        {
            Assert.True(inTableData != null, "Cannot read from null table");
            Assert.True(outCollection != null, "Cannot output to null collection");

            if (inTableData == null || inTableData.Rules == null)
            {
                return(0);
            }

            int count = 0;

            for (int i = 0; i < inTableData.Rules.Length; ++i)
            {
                RSTriggerId trigger = inTableData.Rules[i].TriggerId;
                if (trigger == RSTriggerId.Null)
                {
                    continue;
                }
                if (outCollection.Contains(trigger))
                {
                    continue;
                }

                outCollection.Add(trigger);
                ++count;
            }

            return(count);
        }
Ejemplo n.º 2
0
 public void DefaultInitialize()
 {
     Name            = "New Rule";
     RoutineGroup    = null;
     Enabled         = true;
     OnlyOnce        = false;
     TriggerId       = RSTriggerId.Null;
     Conditions      = null;
     ConditionSubset = Subset.All;
     Actions         = null;
 }
Ejemplo n.º 3
0
 public void CopyFrom(RSRuleData inRule)
 {
     Name            = inRule.Name;
     RoutineGroup    = inRule.RoutineGroup;
     Enabled         = inRule.Enabled;
     OnlyOnce        = inRule.OnlyOnce;
     TriggerId       = inRule.TriggerId;
     Conditions      = CloneUtils.DeepClone(inRule.Conditions);
     ConditionSubset = inRule.ConditionSubset;
     Actions         = CloneUtils.DeepClone(inRule.Actions);
 }
Ejemplo n.º 4
0
        void ISerializedObject.Serialize(Serializer ioSerializer)
        {
            ioSerializer.Enum("type", ref m_Type, InnerType.Null, FieldOptions.PreferAttribute);
            switch (m_Type)
            {
            case InnerType.Bool:
            {
                bool bValue = ioSerializer.IsWriting ? BoolValue : false;
                ioSerializer.Serialize("value", ref bValue);
                if (ioSerializer.IsReading)
                {
                    BoolValue = bValue;
                }
                break;
            }

            case InnerType.Color:
            {
                Color value = ioSerializer.IsWriting ? ColorValue : default(Color);
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    ColorValue = value;
                }
                break;
            }

            case InnerType.Float:
            {
                float value = ioSerializer.IsWriting ? FloatValue : 0;
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    FloatValue = value;
                }
                break;
            }

            case InnerType.Int32:
            {
                int value = ioSerializer.IsWriting ? IntValue : 0;
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    IntValue = value;
                }
                break;
            }

            case InnerType.String:
            {
                string value = ioSerializer.IsWriting ? StringValue : null;
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    StringValue = value;
                }
                break;
            }

            case InnerType.Vector2:
            {
                Vector2 value = ioSerializer.IsWriting ? Vector2Value : default(Vector2);
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    Vector2Value = value;
                }
                break;
            }

            case InnerType.Vector3:
            {
                Vector3 value = ioSerializer.IsWriting ? Vector3Value : default(Vector3);
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    Vector3Value = value;
                }
                break;
            }

            case InnerType.Vector4:
            {
                Vector4 value = ioSerializer.IsWriting ? Vector4Value : default(Vector4);
                ioSerializer.Serialize("value", ref value);
                if (ioSerializer.IsReading)
                {
                    Vector4Value = value;
                }
                break;
            }

            case InnerType.Enum:
            {
                ioSerializer.Serialize("value", ref m_IntValue);
                ioSerializer.Serialize("enumType", ref m_StringValue);
                break;
            }

            case InnerType.EntityScope:
            {
                EntityScopeData value = ioSerializer.IsWriting ? EntityValue : default(EntityScopeData);
                ioSerializer.Object("value", ref value);
                if (ioSerializer.IsReading)
                {
                    EntityValue = value;
                }
                break;
            }

            case InnerType.GroupId:
            {
                RSGroupId value = ioSerializer.IsWriting ? GroupIdValue : default(RSGroupId);
                ioSerializer.Int32Proxy("value", ref value);
                if (ioSerializer.IsReading)
                {
                    GroupIdValue = value;
                }
                break;
            }

            case InnerType.TriggerId:
            {
                RSTriggerId value = ioSerializer.IsWriting ? TriggerIdValue : default(RSTriggerId);
                ioSerializer.Int32Proxy("value", ref value);
                if (ioSerializer.IsReading)
                {
                    TriggerIdValue = value;
                }
                break;
            }
            }
        }
Ejemplo n.º 5
0
 private RSValue(RSTriggerId inTrigger) : this(InnerType.TriggerId, (int)inTrigger)
 {
 }
Ejemplo n.º 6
0
 static public RSValue FromTriggerId(RSTriggerId inGroupId)
 {
     return(new RSValue(inGroupId));
 }
Ejemplo n.º 7
0
 public TriggerIdRefVisitor(RSTriggerId inId)
 {
     m_TriggerId = inId;
 }