private int GetUsedCount(NamedVariable variable) { if (this.fsmOwner != null) { return(SkillSearch.GetVariableUseCount(this.fsmOwner, variable)); } if (!(this.globalsOwner != null)) { return(-1); } if (SkillSearch.GlobalVariablesUsageInitialized) { return(SkillSearch.GetGlobalVariablesUsageCount(variable)); } return(-1); }
private void DoGlobalVariablesTable() { if (SkillSearch.GetGlobalVariablesUsedCount(SkillEditor.SelectedFsm) == 0) { return; } GUILayout.Space(10f); SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]); GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]); GUILayout.Label(SkillEditorContent.GlobalsLabel, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(SkillEditorContent.VariableUseCountLabel, new GUILayoutOption[0]); GUILayout.EndHorizontal(); List <NamedVariable> globalVariablesUsed = SkillSearch.GetGlobalVariablesUsed(SkillEditor.SelectedFsm); using (List <NamedVariable> .Enumerator enumerator = globalVariablesUsed.GetEnumerator()) { while (enumerator.MoveNext()) { NamedVariable current = enumerator.get_Current(); GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]); GUIStyle tableRowText = SkillEditorStyles.TableRowText; if (GUILayout.Button(new GUIContent(current.get_Name(), current.get_Tooltip()), tableRowText, new GUILayoutOption[] { GUILayout.MinWidth(155f) })) { Keyboard.ResetFocus(); this.Deselect(); if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey()) { FsmVariablesEditor.DoGlobalVariableContextMenu(current); } } int globalVariablesUsageCount = SkillSearch.GetGlobalVariablesUsageCount(current); GUILayout.FlexibleSpace(); GUILayout.Label(globalVariablesUsageCount.ToString(CultureInfo.get_CurrentCulture()), tableRowText, new GUILayoutOption[0]); GUILayout.Space(10f); GUILayout.EndHorizontal(); if (FsmEditorSettings.DebugVariables) { SkillEditorGUILayout.ReadonlyTextField(current.ToString(), new GUILayoutOption[0]); } } } }