コード例 #1
0
        private void DeleteUnusedEvents()
        {
            SkillSearch.Update(SkillEditor.SelectedFsm);
            List <string> unusedEvents = SkillSearch.GetUnusedEvents(SkillEditor.SelectedFsm);
            int           count        = unusedEvents.get_Count();

            if (count == 0)
            {
                EditorUtility.DisplayDialog(Strings.get_Dialog_Delete_Unused_Events(), Strings.get_Dialog_No_unused_events(), Strings.get_OK());
                return;
            }
            if (Dialogs.YesNoDialog(Strings.get_Dialog_Delete_Unused_Events(), string.Format(Strings.get_Dialog_Delete_Unused_Events_Are_you_sure(), count)))
            {
                SkillEditor.RegisterUndo(Strings.get_Dialog_Delete_Unused_Events());
                using (List <string> .Enumerator enumerator = unusedEvents.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.get_Current();
                        if (!SkillEvent.IsEventGlobal(current))
                        {
                            SkillEditor.Builder.DeleteEvent(SkillEditor.SelectedFsm, current);
                        }
                    }
                }
                this.Reset();
            }
            SkillEditor.SetFsmDirty(true, false);
        }