Beispiel #1
0
 public void AddCondition(ConditionTask condition)
 {
     Undo.RecordObject(this, "List Add Task");
     Undo.RecordObject(condition, "List Add Task");
     currentViewCondition = condition;
     conditions.Add(condition);
     condition.SetOwnerSystem(ownerSystem);
 }
Beispiel #2
0
        public void ShowNestedConditionsGUI()
        {
            if (conditions.Count == 1)
            {
                currentViewCondition = conditions[0] as ConditionTask;
            }

            if (currentViewCondition)
            {
                EditorUtils.BoldSeparator();
                currentViewCondition.ShowInspectorGUI();
            }
        }
Beispiel #3
0
        public void ShowListGUI()
        {
            if (this == null)
            {
                return;
            }

            EditorUtils.TaskSelectionButton(gameObject, typeof(ConditionTask), delegate(Task c){ AddCondition((ConditionTask)c); });

            ValidateList();

            if (conditions.Count == 0)
            {
                EditorGUILayout.HelpBox("No Conditions", MessageType.None);
                return;
            }

            EditorUtils.ReorderableList(conditions, delegate(int i){
                var o         = conditions[i];
                var condition = conditions[i] as ConditionTask;
                GUI.color     = new Color(1, 1, 1, 0.25f);
                GUILayout.BeginHorizontal("box");

                if (condition != null)
                {
                    GUI.color = condition.isActive? new Color(1, 1, 1, 0.8f) : new Color(1, 1, 1, 0.25f);

                    Undo.RecordObject(condition, "Mute");
                    condition.isActive = EditorGUILayout.Toggle(condition.isActive, GUILayout.Width(18));

                    GUI.backgroundColor = condition == currentViewCondition? Color.grey : Color.white;
                    if (GUILayout.Button(EditorUtils.viewIcon, GUILayout.Width(25), GUILayout.Height(18)))
                    {
                        currentViewCondition = condition == currentViewCondition? null : condition;
                    }
                    EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                    GUI.backgroundColor = Color.white;
                    GUILayout.Label(condition.summaryInfo);
                }
                else
                {
                    GUILayout.Label(MissingTaskText(o));
                    GUI.color = Color.white;
                }

                if (GUILayout.Button("X", GUILayout.MaxWidth(20)))
                {
                    Undo.RecordObject(this, "List Remove Task");
                    conditions.RemoveAt(i);
                    Undo.DestroyObjectImmediate(o);
                }

                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                GUILayout.EndHorizontal();
                GUI.color = Color.white;
            });

            EditorUtils.Separator();

            if (conditions.Count > 1)
            {
                GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f);
                if (GUILayout.Button(allSuccessRequired? "ALL True Required":"ANY True Suffice"))
                {
                    allSuccessRequired = !allSuccessRequired;
                }
                GUI.backgroundColor = Color.white;
            }
        }
Beispiel #4
0
 protected override void OnConnectionInspectorGUI()
 {
     if (!condition)
     {
         EditorUtils.TaskSelectionButton(gameObject, typeof(ConditionTask), delegate(Task c){ condition = (ConditionTask)c; });
     }
     else
     {
         condition.ShowInspectorGUI();
     }
 }