コード例 #1
0
        public virtual void Visit(RSRuleData inRuleData, TableLineRef inSourceRef)
        {
            if (inRuleData == null)
            {
                return;
            }

            inSourceRef = inSourceRef.WithRule(inRuleData.Id).CombineEnabled(inRuleData.Enabled);

            if (inRuleData.Conditions != null)
            {
                for (int i = 0; i < inRuleData.Conditions.Length; ++i)
                {
                    Visit(inRuleData.Conditions[i], inSourceRef.WithCondition(i));
                }
            }

            if (inRuleData.Actions != null)
            {
                for (int i = 0; i < inRuleData.Actions.Length; ++i)
                {
                    Visit(inRuleData.Actions[i], inSourceRef.WithAction(i));
                }
            }
        }
コード例 #2
0
        public virtual bool Visit(RSRuleData ioRuleData)
        {
            if (ioRuleData == null)
            {
                return(false);
            }

            bool bChanged = false;

            if (ioRuleData.Conditions != null)
            {
                for (int i = 0; i < ioRuleData.Conditions.Length; ++i)
                {
                    bChanged |= Visit(ioRuleData.Conditions[i]);
                }
            }

            if (ioRuleData.Actions != null)
            {
                for (int i = 0; i < ioRuleData.Actions.Length; ++i)
                {
                    bChanged |= Visit(ioRuleData.Actions[i]);
                }
            }

            return(bChanged);
        }
コード例 #3
0
ファイル: TableUtils.cs プロジェクト: BeauPrime/RuleScript
            public override void Visit(RSRuleData inRuleData, TableLineRef inSourceRef)
            {
                base.Visit(inRuleData, inSourceRef);

                if (inRuleData != null)
                {
                    inSourceRef = inSourceRef.WithRule(inRuleData.Id).CombineEnabled(inRuleData.Enabled);

                    if (inRuleData.TriggerId == m_TriggerId)
                    {
                        AddRef(inSourceRef, "Rule Trigger");
                    }
                }
            }
コード例 #4
0
ファイル: TableUtils.cs プロジェクト: BeauPrime/RuleScript
            public override void Visit(RSRuleData inRuleData, TableLineRef inSourceRef)
            {
                base.Visit(inRuleData, inSourceRef);

                if (inRuleData != null)
                {
                    inSourceRef = inSourceRef.WithRule(inRuleData.Id).CombineEnabled(inRuleData.Enabled);

                    if (Match(inRuleData.Name))
                    {
                        AddRef(inSourceRef, "Rule Name: " + inRuleData.Name);
                    }

                    if (Match(inRuleData.RoutineGroup))
                    {
                        AddRef(inSourceRef, "Rule Group: " + inRuleData.RoutineGroup);
                    }
                }
            }
コード例 #5
0
ファイル: TableUtils.cs プロジェクト: BeauPrime/RuleScript
        static private bool CleanUp(RSRuleData ioRule, HashSet <string> ioDiscoveredRules)
        {
            bool bChanged = false;

            if (string.IsNullOrEmpty(ioRule.Id))
            {
                ioRule.Id = ScriptUtils.NewId();
                bChanged  = true;
            }

            while (!ioDiscoveredRules.Add(ioRule.Id))
            {
                UnityEngine.Debug.LogErrorFormat("[TableUtils] Overlapping rule id {0}", ioRule.Id);
                ioRule.Id = ScriptUtils.NewId();
                bChanged  = true;
            }

            return(bChanged);
        }
コード例 #6
0
ファイル: TableUtils.cs プロジェクト: BeauPrime/RuleScript
        /// <summary>
        /// Outputs all flags for the given rule.
        /// </summary>
        static public RuleFlags GetRuleFlags(RSRuleData inRuleData, RSLibrary inLibrary)
        {
            Assert.True(inRuleData != null, "Cannot read from null rule");

            RuleFlags flags = 0;

            if (inRuleData.Conditions != null)
            {
                foreach (var condition in inRuleData.Conditions)
                {
                    flags |= GetRuleFlags(condition, inLibrary);
                }
            }

            if (inRuleData.Actions != null)
            {
                foreach (var action in inRuleData.Actions)
                {
                    flags |= GetRuleFlags(action, inLibrary);
                }
            }

            return(flags);
        }