private static void EndVariableEditor(INamedVariable variable) { EditorGUILayout.EndHorizontal(); if (variable != null && VariableEditor.DebugVariables && variable.get_UseVariable() && !string.IsNullOrEmpty(variable.get_Name())) { SkillEditorGUILayout.ReadonlyTextField(variable.ToString(), new GUILayoutOption[0]); } }
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]); } } } }
private void DoVariableTable() { this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[0]); if (FsmEditorSettings.ShowHints) { GUILayout.Box(Strings.get_Hint_Variable_Panel(), SkillEditorStyles.HintBox, new GUILayoutOption[0]); } if (this.fsmVariables.get_Count() == 0) { GUILayout.BeginHorizontal(SkillEditorStyles.TableRowBox, new GUILayoutOption[0]); GUILayout.Label(Strings.get_Label_None_In_Table(), new GUILayoutOption[0]); GUILayout.EndHorizontal(); } else { if (this.filteredVariables.get_Count() == 0) { GUILayout.Label("No search results for: " + this.searchString, new GUILayoutOption[0]); } } int num = 0; for (int i = 0; i < this.filteredVariables.get_Count(); i++) { SkillVariable fsmVariable = this.filteredVariables.get_Item(i); int categoryID = fsmVariable.CategoryID; if (categoryID > 0 && categoryID != num) { num = categoryID; this.categoryLabels.get_Item(num).OnGUI(new GUILayoutOption[0]); SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]); } bool flag = fsmVariable == this.selectedFsmVariable; GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.BeginHorizontal(flag ? SkillEditorStyles.SelectedEventBox : (FsmEditorSettings.DebugVariables ? SkillEditorStyles.TableRowBoxNoDivider : SkillEditorStyles.TableRowBox), new GUILayoutOption[0]); GUIStyle gUIStyle = flag ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText; if (GUILayout.Button(new GUIContent(fsmVariable.Name, fsmVariable.Tooltip), gUIStyle, new GUILayoutOption[] { GUILayout.MinWidth(155f) })) { this.SelectVariable(fsmVariable); if ((Event.get_current().get_button() == 1 || EditorGUI.get_actionKey()) && this.VariableContextClicked != null) { this.VariableContextClicked(fsmVariable); } } GUILayout.FlexibleSpace(); int usedCount = this.GetUsedCount(fsmVariable.NamedVar); GUILayout.Label((usedCount >= 0) ? usedCount.ToString(CultureInfo.get_CurrentCulture()) : "-", gUIStyle, new GUILayoutOption[0]); GUILayout.Space(10f); bool changed = GUI.get_changed(); GUI.set_changed(false); VariableType newType = EditorGUILayout.Popup(fsmVariable.Type, SkillVariable.VariableTypeNames, new GUILayoutOption[] { GUILayout.MaxWidth(114f) }); if (GUI.get_changed()) { this.ChangeVariableType(fsmVariable, newType); GUIUtility.ExitGUI(); return; } GUI.set_changed(changed); if (SkillEditorGUILayout.DeleteButton()) { this.DeleteVariable(fsmVariable, true, true); GUIUtility.ExitGUI(); return; } GUILayout.EndHorizontal(); if (FsmEditorSettings.DebugVariables) { SkillEditorGUILayout.ReadonlyTextField(fsmVariable.NamedVar.ToString(), new GUILayoutOption[0]); } GUILayout.EndVertical(); if (flag) { this.selectedIndex = i; if (Event.get_current().get_type() == 7) { this.selectedRect = GUILayoutUtility.GetLastRect(); this.selectedRect.set_y(this.selectedRect.get_y() - this.scrollPosition.y); } } } Rect lastRect = GUILayoutUtility.GetLastRect(); this.mouseOverTable = (Event.get_current().get_mousePosition().y < lastRect.get_y() + lastRect.get_height()); if (this.fsmOwner != null) { this.DoGlobalVariablesTable(); } GUILayout.Space(20f); GUILayout.FlexibleSpace(); GUILayout.EndScrollView(); this.DoAutoScroll(); GUILayout.EndVertical(); if (Event.get_current().get_type() == 7) { FsmVariablesEditor.tableHeight = GUILayoutUtility.GetLastRect().get_height() + GUI.get_skin().get_horizontalScrollbar().get_fixedHeight() + EditorStyles.get_toolbar().get_fixedHeight(); } }
private void DoEventEditor() { if (EditorWindow.get_focusedWindow() != SkillEditor.Window) { return; } SkillEditorGUILayout.LabelWidth(86f); bool flag = !SkillEvent.IsNullOrEmpty(this.selectedEvent); SkillEditorGUILayout.Divider(new GUILayoutOption[0]); if (flag && FsmEditorSettings.ShowHints) { GUILayout.Box(this.selectedEvent.get_IsSystemEvent() ? Strings.get_Hint_System_Events_cannot_be_renamed() : Strings.get_Hint_Use_Event_Browser_to_rename_globally(), SkillEditorStyles.HintBox, new GUILayoutOption[0]); } if (flag && this.selectedEvent.get_IsGlobal()) { SkillEditorGUILayout.ReadonlyTextField(SkillEditorContent.GlobalEventName, 82f, this.newEventName, new GUILayoutOption[0]); } else { if (!flag || !this.selectedEvent.get_IsSystemEvent()) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label(flag ? SkillEditorContent.EditEventNameLabel : SkillEditorContent.AddEventLabel, new GUILayoutOption[] { GUILayout.MaxWidth(80f) }); this.newEventName = EditorGUILayout.TextField(this.newEventName, new GUILayoutOption[0]); string text = SkillEditorGUILayout.FsmEventListPopup(); if (text != "") { this.AddEvent(text); return; } EditorGUILayout.EndHorizontal(); if (!flag && FsmEditorSettings.ShowHints) { GUILayout.Box(Strings.get_Tooltip_EventManager_Add_Event(), SkillEditorStyles.HintBox, new GUILayoutOption[0]); } } } if (flag) { bool flag2 = false; using (List <SkillEvent> .Enumerator enumerator = SkillEditor.SelectedFsm.ExposedEvents.GetEnumerator()) { while (enumerator.MoveNext()) { SkillEvent current = enumerator.get_Current(); if (current.get_Name() == this.selectedEvent.get_Name()) { flag2 = true; break; } } } bool flag3 = EditorGUILayout.Toggle(SkillEditorContent.EventInspectorLabel, flag2, new GUILayoutOption[0]); if (flag2 != flag3) { if (!flag3) { EditorCommands.RemoveExposedEvent(SkillEditor.SelectedFsm, this.selectedEvent); } else { EditorCommands.AddExposedEvent(SkillEditor.SelectedFsm, this.selectedEvent); } SkillEditor.SetFsmDirty(false, false); } if (FsmEditorSettings.ShowHints) { GUILayout.Box(Strings.get_Hint_EventManager_Expose_Events(), SkillEditorStyles.HintBox, new GUILayoutOption[0]); } } string text2 = this.ValidateEventName(flag); bool flag4 = string.IsNullOrEmpty(text2); if (!flag4) { GUILayout.Box(text2, SkillEditorStyles.ErrorBox, new GUILayoutOption[0]); } if (Event.get_current().get_isKey()) { if (flag4 && Keyboard.EnterKeyPressed()) { if (!flag) { this.AddEvent(this.newEventName); } else { this.RenameEvent(this.selectedEvent, this.newEventName); } Event.get_current().Use(); GUIUtility.ExitGUI(); return; } if (Event.get_current().get_keyCode() == 27) { this.Reset(); } } }