Пример #1
0
        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();
        }