Esempio n. 1
0
        public static void Show()
        {
            CreateActorWiz window = EditorWindow.GetWindow <CreateActorWiz>(true, "Create Actor", true);

            window.inited = false;
        }
Esempio n. 2
0
        private void LeftPanel()
        {
            EditorGUILayout.BeginVertical(GUILayout.Width(DatabaseEditor.LeftPanelWidth));
            GUILayout.Space(5);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Add Actors", XXToolsEdGui.Icon_Plus), EditorStyles.miniButtonLeft))
                {
                    GUI.FocusControl("");
                    //EditorUtility.OpenFilePanel("Select Scene", XXToolsEdUtil.FullProjectAssetsPath, "unity");
                    //TextInputWiz.Show("New Actor", "Enter name for new actor", "", CreateActor);
                    CreateActorWiz.Show();
                }
                GUI.enabled = true;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            scroll[0] = XXToolsEdGui.BeginScrollView(scroll[0], GUILayout.Width(DatabaseEditor.LeftPanelWidth));
            {
                if (ed.db.Actors.Length > 0)
                {
                    foreach (Actor actor in ed.db.Actors)
                    {
                        if (actor == null)
                        {
                            ed.db.actorsPrefabs = XXToolsEdUtil.CleanupList <GameObject>(ed.db.actorsPrefabs);
                            EditorUtility.SetDirty(ed.db);
                            AssetDatabase.SaveAssets();
                            GUIUtility.ExitGUI();
                            return;
                        }

                        EditorGUILayout.BeginHorizontal(GUILayout.Width(DatabaseEditor.LeftPanelWidth - 20), GUILayout.ExpandWidth(false));
                        {
                            if (XXToolsEdGui.ToggleButton(curr == actor, actor.name, XXToolsEdGui.ButtonLeftStyle, GUILayout.Width(160), GUILayout.ExpandWidth(false)))
                            {
                                GUI.FocusControl("");
                                curr   = actor;
                                currAc = null;
                                //GetCurrentEd();
                            }

                            //if (ed.db.Cameras.Length == 1) GUI.enabled = false; // can't allow deleting the camera if there is only one left since runtime depends on at least one being present
                            if (GUILayout.Button("X", XXToolsEdGui.ButtonRightStyle, GUILayout.Width(20)))
                            {
                                del = actor;
                            }
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    GUILayout.Label("No Actors are defined.", XXToolsEdGui.WarningLabelStyle);
                }
            }
            XXToolsEdGui.EndScrollView();

            GUILayout.Space(3);
            EditorGUILayout.EndVertical();

            if (del != null)
            {
                if (curr == del)
                {
                    curr = null;
                }
                ed.db.actorsPrefabs.Remove(del.gameObject);
                EditorUtility.SetDirty(ed.db);
                AssetDatabase.SaveAssets();

                string path = AssetDatabase.GetAssetPath(del.gameObject);
                AssetDatabase.DeleteAsset(path);
                AssetDatabase.Refresh();
                del = null;
            }
        }