Ejemplo n.º 1
0
        private void RefreshList()
        {
            this.fsmList.Clear();
            if (this.filterMode == TimelineWindow.FsmFilter.RecentlySelected)
            {
                this.fsmList.AddRange(SkillEditor.SelectionHistory.GetRecentlySelectedFSMs());
            }
            else
            {
                using (List <Skill> .Enumerator enumerator = SkillEditor.SortedFsmList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Skill current = enumerator.get_Current();
                        switch (this.filterMode)
                        {
                        case TimelineWindow.FsmFilter.All:
                            this.fsmList.Add(current);
                            break;

                        case TimelineWindow.FsmFilter.OnSelectedObject:
                            if (current.get_GameObject() != null && Selection.Contains(current.get_GameObject()))
                            {
                                this.fsmList.Add(current);
                            }
                            break;

                        case TimelineWindow.FsmFilter.WithErrors:
                            if (FsmErrorChecker.FsmHasErrors(current))
                            {
                                this.fsmList.Add(current);
                            }
                            break;

                        case TimelineWindow.FsmFilter.InScene:
                            if (!SkillPrefabs.IsPersistent(current))
                            {
                                this.fsmList.Add(current);
                            }
                            break;
                        }
                    }
                }
            }
            base.Repaint();
        }
        private static void CheckActionParameter(SkillState state, SkillStateAction action, FieldInfo field)
        {
            if (state == null || action == null || field == null || state.get_Fsm() == null)
            {
                return;
            }
            Object ownerObject = state.get_Fsm().get_OwnerObject();

            FsmErrorChecker.ownerIsAsset      = SkillPrefabs.IsPersistent(ownerObject);
            FsmErrorChecker.gameObject        = state.get_Fsm().get_GameObject();
            FsmErrorChecker.checkingFsm       = state.get_Fsm();
            FsmErrorChecker.checkingState     = state;
            FsmErrorChecker.checkingAction    = action;
            FsmErrorChecker.checkingParameter = field.get_Name();
            Type   fieldType = field.get_FieldType();
            object value     = field.GetValue(action);

            FsmErrorChecker.attributes = CustomAttributeHelpers.GetCustomAttributes(field);
            FsmErrorChecker.CheckParameterType(fieldType, value);
        }
        public static GenericMenu GenerateFsmSelectionMenu(bool includeAssets, bool hasAddFsmOption)
        {
            GenericMenu genericMenu = new GenericMenu();

            genericMenu.AddItem(new GUIContent(Strings.get_Menu_None_FSM()), false, new GenericMenu.MenuFunction2(SkillEditor.SelectFsm), null);
            List <string> list          = new List <string>();
            List <Skill>  sortedFsmList = SkillEditor.SortedFsmList;

            using (List <Skill> .Enumerator enumerator = sortedFsmList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Skill current = enumerator.get_Current();
                    if (current != null && (includeAssets || !SkillPrefabs.IsPersistent(current)))
                    {
                        string text = Labels.GenerateUniqueLabel(list, Labels.GetFullFsmLabel(current));
                        list.Add(text);
                        genericMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(SkillEditor.SelectFsm), current);
                    }
                }
            }
            if (hasAddFsmOption)
            {
                genericMenu.AddSeparator(string.Empty);
                if (Selection.get_activeGameObject() != null)
                {
                    string text2 = string.Format(Strings.get_Menu_Add_FSM_to__(), Selection.get_activeGameObject().get_name());
                    genericMenu.AddItem(new GUIContent(text2), false, new GenericMenu.MenuFunction(SkillEditor.AddFsm));
                }
                else
                {
                    genericMenu.AddDisabledItem(new GUIContent(Strings.get_Menu_Disabled_Add_FSM_to_selected_object()));
                }
            }
            return(genericMenu);
        }
Ejemplo n.º 4
0
 public static bool IsPersistent(Object obj)
 {
     return(SkillPrefabs.IsPersistent(obj));
 }