private static void CheckGlobalEvent(SkillEvent fsmEvent) { if (!fsmEvent.get_IsGlobal()) { SkillEditor.Builder.SetEventIsGlobal(fsmEvent); } }
private void DoEventLine(SkillEvent fsmEvent) { int eventUseCount = SkillSearch.GetEventUseCount(SkillEditor.SelectedFsm, fsmEvent.get_Name()); GUILayout.BeginHorizontal((this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.SelectedEventBox : SkillEditorStyles.TableRowBox, new GUILayoutOption[0]); EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent()); bool flag = GUILayout.Toggle(fsmEvent.get_IsGlobal(), SkillEditorContent.GlobalEventTooltipLabel, SkillEditorStyles.TableRowCheckBox, new GUILayoutOption[] { GUILayout.MaxWidth(17f), GUILayout.MinWidth(17f) }); if (flag != fsmEvent.get_IsGlobal()) { SkillEditor.Builder.SetEventIsGlobal(SkillEditor.SelectedFsm, fsmEvent, flag); GlobalEventsWindow.ResetView(); } EditorGUI.EndDisabledGroup(); GUIStyle gUIStyle = (this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText; if (GUILayout.Button(fsmEvent.get_Name(), gUIStyle, new GUILayoutOption[] { GUILayout.MinWidth(244f) })) { this.SelectEvent(fsmEvent, true); GUIUtility.set_keyboardControl(0); if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey()) { this.GenerateStateListMenu(this.selectedEvent).ShowAsContext(); } } GUILayout.FlexibleSpace(); GUILayout.Label(eventUseCount.ToString(CultureInfo.get_CurrentCulture()), gUIStyle, new GUILayoutOption[0]); GUILayout.Space(5f); if (SkillEditorGUILayout.DeleteButton()) { EditorCommands.DeleteEvent(fsmEvent); this.Reset(); } GUILayout.EndHorizontal(); }
public static List <SkillEvent> GetGlobalEventList() { List <SkillEvent> list = new List <SkillEvent>(); using (List <SkillEvent> .Enumerator enumerator = SkillEvent.get_EventList().GetEnumerator()) { while (enumerator.MoveNext()) { SkillEvent current = enumerator.get_Current(); if (current.get_IsGlobal()) { list.Add(current); } } } return(list); }
public static List <SkillEvent> GetGlobalEventList(Skill fsm) { if (fsm == null) { return(Events.GetGlobalEventList()); } List <SkillEvent> list = new List <SkillEvent>(); SkillEvent[] events = fsm.get_Events(); for (int i = 0; i < events.Length; i++) { SkillEvent fsmEvent = events[i]; if (fsmEvent.get_IsGlobal()) { list.Add(fsmEvent); } } return(list); }
private void RenameEvent(SkillEvent fsmEvent, string newName) { if (fsmEvent == null) { return; } if (fsmEvent.get_IsGlobal()) { if (Dialogs.AreYouSure(Strings.get_Dialog_Rename_Event(), Strings.get_Dialog_Rename_Event_Are_you_sure())) { SkillEditor.Builder.RenameEvent(fsmEvent.get_Name(), newName); } } else { SkillEditor.Builder.RenameEvent(SkillEditor.SelectedFsm, fsmEvent.get_Name(), newName); } SkillEditor.SelectedFsm.set_Events(ArrayUtility.Sort <SkillEvent>(SkillEditor.SelectedFsm.get_Events())); this.Reset(); }
private void DoEventLine(SkillEvent fsmEvent) { int num; this.usageCount.TryGetValue(fsmEvent, ref num); if (num == 0 && FsmEditorSettings.HideUnusedEvents) { return; } GUILayout.BeginHorizontal((this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.SelectedEventBox : SkillEditorStyles.TableRowBox, new GUILayoutOption[0]); EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent()); bool flag = GUILayout.Toggle(fsmEvent.get_IsGlobal(), new GUIContent("", Strings.get_Label_Global()), SkillEditorStyles.TableRowCheckBox, new GUILayoutOption[] { GUILayout.MaxWidth(17f), GUILayout.MinWidth(17f) }); if (flag != fsmEvent.get_IsGlobal()) { SkillEditor.Builder.SetEventIsGlobal(null, fsmEvent, flag); } EditorGUI.EndDisabledGroup(); GUIStyle gUIStyle = (this.selectedEvent != null && fsmEvent.get_Name() == this.selectedEvent.get_Name()) ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText; if (GUILayout.Button(fsmEvent.get_Name(), gUIStyle, new GUILayoutOption[] { GUILayout.MinWidth(base.get_position().get_width() - 100f) })) { this.SelectEvent(fsmEvent); if (Event.get_current().get_button() == 1 || EditorGUI.get_actionKey()) { this.GenerateUsageContextMenu(this.selectedEvent).ShowAsContext(); } if (EditorApplication.get_timeSinceStartup() - this.clickTime < 0.3) { this.AddSelectedEventToState(); } this.clickTime = EditorApplication.get_timeSinceStartup(); } GUILayout.FlexibleSpace(); GUILayout.Label(num.ToString(CultureInfo.get_CurrentCulture()), gUIStyle, new GUILayoutOption[0]); GUILayout.Space(10f); EditorGUI.BeginDisabledGroup(fsmEvent.get_IsSystemEvent()); if (SkillEditorGUILayout.DeleteButton() && Dialogs.YesNoDialog(Strings.get_Dialog_Delete_Event(), string.Format(Strings.get_Dialog_Delete_Event_Are_you_sure(), (num > 0) ? string.Concat(new object[] { "\n\n", Strings.get_Dialog_Delete_Event_Used_By(), num, (num > 1) ? Strings.get_Label_Postfix_FSMs_Plural() : Strings.get_Label_Postfix_FSM() }) : ""))) { EditorCommands.DeleteEventFromAll(fsmEvent); SkillEditor.EventManager.Reset(); SkillEvent.RemoveEventFromEventList(fsmEvent); if (fsmEvent.get_IsGlobal()) { SkillEvent.get_globalEvents().RemoveAll((string r) => r == fsmEvent.get_Name()); SkillEditor.SaveGlobals(); } this.BuildFilteredList(); base.Repaint(); } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); }