예제 #1
0
 private static void ProjectWindowItemCallback(string guid, Rect selectionRect)
 {
     if (SkillPrefabs.AssetHasPlayMakerFSM(guid))
     {
         Rect rect = new Rect(selectionRect.get_x() + selectionRect.get_width() - 20f, selectionRect.get_y(), 15f, 15f);
         GUI.Box(rect, Gizmos.WanIcon, GUIStyle.get_none());
     }
 }
예제 #2
0
 public static void UpdateIsModifiedPrefabInstance(Skill fsm)
 {
     if (fsm == null || fsm.get_Owner() == null)
     {
         return;
     }
     fsm.set_IsModifiedPrefabInstance(SkillPrefabs.IsModifiedPrefabInstance(fsm));
 }
예제 #3
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);
        }
예제 #5
0
        public static string GetFsmSavePath(Skill fsm)
        {
            if (fsm == null)
            {
                return("");
            }
            if (fsm.get_UsedInTemplate())
            {
                return("Template." + fsm.get_UsedInTemplate().get_name());
            }
            string text = fsm.get_OwnerName() + '.' + Labels.GetFsmLabel(fsm);

            if (SkillPrefabs.IsPrefab(fsm))
            {
                return("Prefab." + text);
            }
            string text2 = (fsm.get_GameObject() != null && fsm.get_GameObject().get_scene().get_name() != null) ? fsm.get_GameObject().get_scene().get_name().Replace(".unity", "").Replace("Assets/", "").Replace("/", ".") : "";

            return(text2 + "." + text);
        }
예제 #6
0
 public static void DeleteEventFromAll(SkillEvent fsmEvent)
 {
     if (FsmEditorSettings.LoadAllPrefabs)
     {
         Files.LoadAllPlaymakerPrefabs();
     }
     using (List <Skill> .Enumerator enumerator = SkillEditor.FsmList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Skill current = enumerator.get_Current();
             if (SkillPrefabs.ShouldModify(current))
             {
                 Undo.RecordObject(current.get_OwnerObject(), Strings.get_Command_Delete_Event_From_All_FSMs());
                 SkillEditor.Builder.DeleteEvent(current, fsmEvent);
                 SkillEditor.SaveActions(current);
             }
         }
     }
     SkillEditor.RepaintAll();
 }
        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);
        }
예제 #8
0
 public static bool IsPrefab(Skill fsm)
 {
     return(SkillPrefabs.IsPrefab(fsm));
 }
예제 #9
0
 private static void BeginPrefabInstanceCheck()
 {
     if (FsmEditorSettings.ConfirmEditingPrefabInstances && InspectorPanel.editingPrefabInstance != null && InspectorPanel.editingPrefabInstance == SkillEditor.SelectedFsm)
     {
         EditorGUILayout.HelpBox(Strings.get_Label_Editing_Prefab_Instance(), 1);
         InspectorPanel.editingDisabledForPrefabInstance = false;
     }
     else
     {
         InspectorPanel.editingDisabledForPrefabInstance = (FsmEditorSettings.ConfirmEditingPrefabInstances && SkillPrefabs.IsPrefabInstance(SkillEditor.SelectedFsm));
         if (InspectorPanel.editingDisabledForPrefabInstance)
         {
             EditorGUILayout.HelpBox(Strings.get_Label_Confirm_Editing_of_Prefab_Instance(), 1);
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             if (GUILayout.Button(Strings.get_Label_Edit_Prefab(), new GUILayoutOption[0]))
             {
                 SkillEditor.SelectPrefabParent();
             }
             if (GUILayout.Button(Strings.get_Label_Edit_Instance(), new GUILayoutOption[0]))
             {
                 InspectorPanel.editingPrefabInstance = SkillEditor.SelectedFsm;
             }
             GUILayout.EndHorizontal();
             SkillEditor.GraphView.DisableEditing(Strings.get_Label_Editing_of_Prefab_Instance_is_disabled());
         }
     }
     EditorGUI.BeginDisabledGroup(InspectorPanel.editingDisabledForPrefabInstance);
 }
예제 #10
0
 public static bool IsPersistent(Skill fsm)
 {
     return(fsm != null && (fsm.get_UsedInTemplate() || SkillPrefabs.IsPrefab(fsm)));
 }
예제 #11
0
 public static void LoadUsedPrefabs()
 {
     SkillPrefabs.LoadUsedPrefabs();
 }
예제 #12
0
 public static bool StateExistsInPrefabParent(SkillState state)
 {
     return(SkillPrefabs.StateExistsInPrefabParent(state));
 }
예제 #13
0
 public static bool AssetHasPlayMakerFSM(string guid)
 {
     return(SkillPrefabs.AssetHasPlayMakerFSM(guid));
 }
예제 #14
0
 public static void BuildAssetsWithPlayMakerFSMsList()
 {
     SkillPrefabs.BuildAssetsWithPlayMakerFSMsList();
 }
예제 #15
0
 public static bool IsFsmInstanceOfPrefab(Skill fsm, Skill prefab)
 {
     return(SkillPrefabs.IsFsmInstanceOfPrefab(fsm, prefab));
 }
예제 #16
0
 public static bool IsPrefabInstance(Skill fsm)
 {
     return(SkillPrefabs.IsPrefabInstance(fsm));
 }
예제 #17
0
 public static bool IsPersistent(Object obj)
 {
     return(SkillPrefabs.IsPersistent(obj));
 }
예제 #18
0
 public static bool ShouldModify(Skill fsm)
 {
     return(SkillPrefabs.ShouldModify(fsm));
 }
예제 #19
0
 public static void UpdateIsModifiedPrefabInstance(Skill fsm)
 {
     SkillPrefabs.UpdateIsModifiedPrefabInstance(fsm);
 }