private void UpdateObjectPicker() { if (Event.current.commandName == "ObjectSelectorClosed") { switch (EditorGUIUtility.GetObjectPickerControlID()) { case (int)EditorCommons.WindowCommands.AddConcept: { Concept concept = (Concept)EditorGUIUtility.GetObjectPickerObject(); if (concept == null) { return; } if (!target.ContainsConcept(concept)) { target.AddConcept(concept); displayer = new EditorConditionDisplay(target) { DisplayConcepts = true }; EditorUtility.SetDirty(target); EditorUtility.SetDirty(target.gameObject); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()); } } break; } } }
/// <summary> /// Buttons related to condition creation functionality /// </summary> private void CreateConditionFunctionality() { if (target.ConceptList.Count <= 0) { return; } if (GUILayout.Button("Create contition")) { if (!_conditionDisplayer) { _conditionDisplayer = new EditorConditionDisplay(target); } target.CreateCondition(_conditionDisplayer.conceptDictionary[0], _conditionDisplayer.conceptDictionary[0].Functions[0], Operator.EQUALS); _conditionDisplayer.ReloadConditions(); _displayConditions = true; } if (GUILayout.Button("Remove condition")) { _conditionDisplayer.RemoveCondition(); target.RemoveCondition(); } }
public void OnEnable() { target = (FuzzyBehaviour)base.target; if (displayer == null && target != null) { displayer = new EditorConditionDisplay(target); } if (target.Config == null) { FuzzyBehaviourConfig __configFile = FindConfigFile(); if (__configFile != null) { __configFile = CreateConfigInstance(); target.Config = __configFile; } } }
public void OnEnable() { target = (FuzzyBehaviour)base.target; _conditionDisplayer = new EditorConditionDisplay(target); if (_displayFunctions == null) { _displayFunctions = new List <bool>(); } if (target.ConceptList.Count != _displayFunctions.Count) { _displayFunctions.Clear(); foreach (Concept concept in target.ConceptList) { _displayFunctions.Add(false); } } }
private void RemoveConceptFunctionality() { if (displayer == null) { displayer = new EditorConditionDisplay(target); } GUILayout.BeginHorizontal(); { if (target.ConceptList.Count > 0) { if (GUILayout.Button("Remove Concept", GUILayout.Width(150))) { RemoveConceptFromTargetList(); } selectedConcept = EditorGUILayout.Popup(selectedConcept, displayer.conceptNames.ToArray()); } } GUILayout.EndHorizontal(); }
private void DisplayConditionFunctionality() { GUILayout.Space(EditorCommons._defaultSpacing); //Display part. Foldout list of conditions if (target.ConditionList != null) { if (target.ConditionList.Count > 0) { if (_displayConditions = EditorGUILayout.Foldout(_displayConditions, "Condition list")) { if (_conditionDisplayer == null) { _conditionDisplayer = new EditorConditionDisplay(target); } for (int i = 0; i < target.ConditionList.Count; i++) { GUI.color = ConditionColor[i]; GUILayout.BeginVertical("Box"); { GUILayout.Label("Condition " + i); //UI function that displays the conditions DisplayConditions(i); //Buttons in the UI to add and remove expressions from the conditions AddRemoveExpressionFunctionality(i); } GUILayout.EndVertical(); } GUI.color = Color.white; UpdateConditions(); } } } }