Exemple #1
0
        public void SetItemContent(ListItem item)
        {
            FileBrowserItem file     = (FileBrowserItem)item;
            FileSystemInfo  fileInfo = validItems[item.Position];

            bool isDirectory = (fileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory;

            Sprite icon;

            if (isDirectory)
            {
                icon = folderIcon;
            }
            else if (!filetypeToIcon.TryGetValue(fileInfo.Extension.ToLower(), out icon))
            {
                icon = defaultIcon;
            }

            file.SetFile(icon, fileInfo.Name, isDirectory);

            if (item.Position == m_selectedFilePosition)
            {
                m_selectedFile = file;
                file.Select();
            }
            else
            {
                file.Deselect();
            }
        }
Exemple #2
0
        void Awake()
        {
            m_instance = this;
            InitRerences();
            itemPrefab      = CreateFbItem();
            quickLinkPrefab = CreateQuickLink();
            itemHeight      = ((RectTransform)itemPrefab.transform).sizeDelta.y;
            itemPrefab.gameObject.SetActive(false);
            quickLinkPrefab.gameObject.SetActive(false);
            nullPointerEventData = new UnityEngine.EventSystems.PointerEventData(null);

#if !UNITY_EDITOR && UNITY_IOS
            DEFAULT_PATH = Application.persistentDataPath;
#else
            DEFAULT_PATH = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
#endif

            InitializeFiletypeIcons();
            filetypeIcons = null;

            SetExcludedExtensions(excludeExtensions);
            excludeExtensions = null;

            filenameInputField.onValidateInput += OnValidateFilenameInput;

            InitializeQuickLinks();
            quickLinks = null;

            allFilesFilter = new Filter(ALL_FILES_FILTER_TEXT);
            filters.Add(allFilesFilter);

            listView.SetAdapter(this);
        }
Exemple #3
0
        public ListItem CreateItem()
        {
            FileBrowserItem item = Instantiate(itemPrefab, filesContainer, false);

            item.SetFileBrowser(this);

            return(item);
        }
Exemple #4
0
        public ListItem CreateItem()
        {
            FileBrowserItem item = (FileBrowserItem)Instantiate(itemPrefab, filesContainer, false);

            item.gameObject.SetActive(true);
            item.SetFileBrowser(this);
            return(item);
        }
Exemple #5
0
 public void OnItemOpened(FileBrowserItem item)
 {
     if (item.IsDirectory)
     {
         CurrentPath = Path.Combine(m_currentPath, item.Name);
     }
     else
     {
         OnSubmitButtonClicked();
     }
 }
Exemple #6
0
 public void OnItemSelected(FileBrowserItem item)
 {
     SelectedFile = item;
 }