Esempio n. 1
0
        public void Refresh()
        {
            if (workingDirectory.javaObj == null)
            {
                DvDInterface.GetInstance().AnalyzeDirectorys();
                directories = DvDInterface.GetInstance().GetDirectorys();
                files       = DvDInterface.GetInstance().GetFiles();
            }
            else
            {
                workingDirectory.AnalyzeDirectorys();
                directories = workingDirectory.GetDirectorys();
                //if (allowedExtensions.Length != 0) {
                //  files = allowedExtensions.SelectMany(filter =>
                //    workingDirectory.GetFiles("*" + filter)).OrderBy(x => x.name).ToArray();
                //} else {
                files = workingDirectory.GetFiles();
            }
            childCount = directories.Length + files.Length;
            pageCount  = Mathf.CeilToInt((float)childCount / (float)MaxChildrenPerPage);
            pageCount  = Mathf.Max(pageCount, 1);
            // If the PagedScrollRect already has active pages we need to Reset it
            // So that it will pick up the change to the working directories.
            PagedScrollRect scrollRect = GetComponent <PagedScrollRect>();

            if (scrollRect != null && scrollRect.ActivePage != null)
            {
                scrollRect.Reset();
            }
        }
        void Awake()
        {
            scrollRect = GetComponent <PagedScrollRect>();
            FileSelectorPageProvider fileSelector = GetComponent <FileSelectorPageProvider>();

            Assert.IsNotNull(fileSelector);
            fileSelector.OnFileChosen                 += OnFileChosen;
            fileSelector.AllowedExtensions             = MediaHelpers.EXTENSIONS_TO_MEDIA_TYPE.Keys.ToArray();
            MediaPlayerEventDispatcher.OnExitMedia    += OnExitMedia;
            MediaPlayerEventDispatcher.OnNextFile     += OnNextFile;
            MediaPlayerEventDispatcher.OnPreviousFile += OnPreviousFile;
        }
Esempio n. 3
0
 void Awake()
 {
     scrollRect   = GetComponent <PagedScrollRect>();
     fileSelector = GetComponent <FileSelectorPageProvider>();
     Assert.IsNotNull(fileSelector);
     fileSelector.OnFileChosen += OnFileChosen;
     //fileSelector.AllowedExtensions = MediaHelpers.EXTENSIONS_TO_MEDIA_TYPE.Keys.ToArray();
     MediaPlayerEventDispatcher.OnExitMedia    += OnExitMedia;
     MediaPlayerEventDispatcher.OnNextFile     += OnNextFile;
     MediaPlayerEventDispatcher.OnPreviousFile += OnPreviousFile;
     PlayerDataControl.GetInstance().StopPlayCallBack += DestroyMediaPlayer;
     DvDInterface.GetInstance().DiskUnLockCallBack    += OnDiskUnLocK;
     DvDInterface.GetInstance().DiskUpdateCallBack    += OnDIskUpdateCD;
 }
Esempio n. 4
0
        private void Refresh()
        {
            if (workingDirectory == null)
            {
                return;
            }

            try {
                directories = workingDirectory.GetDirectories();
                directories = directories.Where((directory) => {
                    return((directory.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden);
                }).ToArray();

                if (allowedExtensions.Length != 0)
                {
                    files = allowedExtensions.SelectMany(filter =>
                                                         workingDirectory.GetFiles("*" + filter)).OrderBy(x => x.Name).ToArray();
                }
                else
                {
                    files = workingDirectory.GetFiles();
                }
            } catch (Exception exception) {
                Debug.LogError(exception);
                directories = new DirectoryInfo[0];
                files       = new FileInfo[0];
            }

            childCount = directories.Length + files.Length;
            pageCount  = Mathf.CeilToInt((float)childCount / (float)MaxChildrenPerPage);
            pageCount  = Mathf.Max(pageCount, 1);

            // If the PagedScrollRect already has active pages we need to Reset it
            // So that it will pick up the change to the working directories.
            PagedScrollRect scrollRect = GetComponent <PagedScrollRect>();

            if (scrollRect != null && scrollRect.ActivePage != null)
            {
                scrollRect.Reset();
            }
        }
Esempio n. 5
0
 void OnDisable()
 {
     cachedPagedScrollRect = null;
 }