private void Start()
        {
            m_parentPopup = GetComponentInParent <PopupWindow>();
            m_parentPopup.OK.AddListener(OnOK);

            RuntimeEditor     runtimeEditor = FindObjectOfType <RuntimeEditor>();
            ProjectFolderView resources     = runtimeEditor.GetComponentInChildren <ProjectFolderView>(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;
            }
        }
Esempio n. 2
0
        protected virtual void Awake()
        {
            m_projectFolderView = GetComponent <ProjectFolderView>();
            m_editor            = IOC.Resolve <IRuntimeEditor>();
            m_project           = IOC.Resolve <IProject>();
            m_windowManager     = IOC.Resolve <IWindowManager>();
            m_localization      = IOC.Resolve <ILocalization>();

            m_listBox = GetComponentInChildren <VirtualizingTreeView>();
            if (m_listBox == null)
            {
                m_listBox      = Instantiate(m_projectFolderView.ListBoxPrefab, transform).GetComponent <VirtualizingTreeView>();
                m_listBox.name = "AssetsListBox";
            }

            m_listBox.CanDrag           = true;
            m_listBox.CanReorder        = false;
            m_listBox.SelectOnPointerUp = true;
            m_listBox.CanRemove         = false;
            m_listBox.CanSelectAll      = false;

            m_listBox.ItemDataBinding  += OnItemDataBinding;
            m_listBox.ItemBeginDrag    += OnItemBeginDrag;
            m_listBox.ItemDragEnter    += OnItemDragEnter;
            m_listBox.ItemDrag         += OnItemDrag;
            m_listBox.ItemDragExit     += OnItemDragExit;
            m_listBox.ItemDrop         += OnItemDrop;
            m_listBox.ItemEndDrag      += OnItemEndDrag;
            m_listBox.ItemsRemoving    += OnItemRemoving;
            m_listBox.ItemsRemoved     += OnItemRemoved;
            m_listBox.ItemDoubleClick  += OnItemDoubleClick;
            m_listBox.ItemBeginEdit    += OnItemBeginEdit;
            m_listBox.ItemEndEdit      += OnItemEndEdit;
            m_listBox.SelectionChanged += OnSelectionChanged;
            m_listBox.ItemClick        += OnItemClick;
            m_listBox.Click            += OnListBoxClick;

            Editor.Selection.SelectionChanged += EditorSelectionChanged;
            Editor.Object.NameChanged         += OnNameChanged;

            m_projectFolderView.DragEnterEvent += OnDragEnter;
            m_projectFolderView.DragLeaveEvent += OnDragLeave;
            m_projectFolderView.DragEvent      += OnDrag;
            m_projectFolderView.DropEvent      += OnDrop;

            IOC.RegisterFallback <IProjectFolder>(this);
        }