示例#1
0
 public static ValueIndex SetLastUsedTrigger(this ValueIndex index)
 {
     if (index != null)
     {
         index.TriggerIndexes = TriggerGroup.TryGetLastUsedTrigger();
     }
     return(index);
 }
示例#2
0
        public virtual bool Inspect()
        {
            if (!_name.IsNullOrEmpty())
            {
                _name.nl(PEGI_Styles.ListLabel);
            }

            var before = ConditionLogic.inspectedTarget;

            ConditionLogic.inspectedTarget = Values.global;

            var changed = false;



            if (_browsedBranch == -1)
            {
                var cnt = CountForInspector();

                if (cnt > 1)
                {
                    if (_type.ToString().Click((_type == ConditionBranchType.And
                        ? "All conditions and sub branches should be true"
                        : "At least one condition OR sub branch should be true")))
                    {
                        _type = (_type == ConditionBranchType.And ? ConditionBranchType.Or : ConditionBranchType.And);
                    }
                }

                if (cnt > 0)
                {
                    (CheckConditions(ConditionLogic.inspectedTarget) ? icon.Active : icon.InActive).nl();
                }

                var newC = "Conditions".edit_List(ref _conditions, ref _browsedCondition, ref changed);
                if (newC != null)
                {
                    newC.TriggerIndexes = TriggerGroup.TryGetLastUsedTrigger();
                }
            }

            pegi.line(Color.black);

            if (_branches.Count == 0 && "Create Sub Branch".Click().nl())
            {
                _branches.Add(new ConditionBranch());
            }

            if (_branches.Count > 0)
            {
                "Sub Branches".edit_List(ref _branches, ref _browsedBranch).changes(ref changed);
            }

            ConditionLogic.inspectedTarget = before;

            return(changed);
        }