Ejemplo n.º 1
0
        private void Start()
        {
            m_parentPopup = GetComponentInParent <PopupWindow>();
            m_parentPopup.OK.AddListener(OnOK);

            RuntimeEditor          runtimeEditor = FindObjectOfType <RuntimeEditor>();
            ProjectResourcesWindow resources     = runtimeEditor.GetComponentInChildren <ProjectResourcesWindow>(true);
            IProjectManager        manager       = Dependencies.ProjectManager;

            if (manager != null)
            {
                ProjectItem[] itemsOfType = manager.Project.FlattenHierarchy();
                itemsOfType = itemsOfType.Where(item => item.TypeName != null && Type.GetType(item.TypeName) != null && ObjectType.IsAssignableFrom(Type.GetType(item.TypeName))).ToArray();

                m_resources                    = Instantiate(resources);
                m_resources.TypeFilter         = ObjectType;
                m_resources.transform.position = Vector3.zero;
                m_resources.transform.SetParent(ObjectsPanel, false);

                manager.GetOrCreateObjects(itemsOfType, objects =>
                {
                    m_resources.SetObjects(objects, true);
                });


                m_resources.DoubleClick      += OnResourcesDoubleClick;
                m_resources.SelectionChanged += OnResourcesSelectionChanged;
                m_resources.TypeFilter        = ObjectType;
            }
        }
Ejemplo n.º 2
0
        private void AddFolder()
        {
            ProjectItem parent = m_projectTree.SelectedFolder;

            ShowProgress = true;

            ProjectItemObjectPair[] selection = GetSelection(false);
            m_projectManager.SaveObjects(selection.Where(iop => iop.IsResource).ToArray(), () =>
            {
                m_projectManager.CreateFolder("Folder", parent, folder =>
                {
                    m_projectTree.AddProjectItem(folder, parent);
                    m_projectManager.GetOrCreateObjects(parent, objects =>
                    {
                        ShowProgress = false;
                        m_projectResources.SetSelectedItems(objects, new[] { folder });
                        m_projectResources.SetObjects(objects, false);
                    });
                });
            });
        }