Example #1
0
        public override void Refresh()
        {
            var context = (Context)data;

            if (context != null)
            {
                _context = context;
            }
            if (_context == null)
            {
                throw new ArgumentException("null context");
            }
            _title.text = _context.Title;
            AllResources allResources;
            var          listPath = Paths.Getter().ResourceList();

            try
            {
                allResources = ResourceListStore.Instance.Load(listPath);
            }
            catch (Exception e)
            {
                _scanTipText.gameObject.SetActive(true);
                Debug.LogWarning("load allResources exception. " + e);
                _fileListView.SetData(new List <object>());
                return;
            }
            _scanTipText.gameObject.SetActive(false);
            ResourceList resourceList;

            switch (_context.Type)
            {
            case FileType.Model:
                resourceList = allResources.ModelList;
                break;

            case FileType.Motion:
                resourceList = allResources.MotionList;
                break;

            case FileType.Music:
                resourceList = allResources.MusicList;
                break;

            case FileType.BonePose:
                resourceList = allResources.BonePoseList;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            _fileListView.SetData(ConvertDataForUi(resourceList));
        }
Example #2
0
        private void RefreshByPath()
        {
            _fileListView.SetData(new List <object>());
            var currentDirectory = new DirectoryInfo(_context.Path);
            var directories      = currentDirectory.GetDirectories();
            var files            = currentDirectory.GetFiles();
            var list             = (from dir in directories
                                    let dir1 = dir
                                               select new MmdFileListItemData
            {
                FileName = dir.Name.Replace(' ', '\u00A0'),
                FilePath = dir.FullName.Replace(' ', '\u00A0'),
                Icon = Sprites.FileIconDirectory,
                OnClick = () =>
                {
                    _context.Path = dir1.FullName;
                    Refresh();
                }
            }).Cast <object>()
                                   .ToList();

            list.AddRange((from file in files
                           let file1 = file
                                       where GetFileExtsByFileType(_context.Type).Contains(file.Extension.ToLower())
                                       select new MmdFileListItemData
            {
                FileName = file.Name.Replace(' ', '\u00A0'),
                FilePath = file.FullName.Replace(' ', '\u00A0'),
                Icon = GetIconByFileType(_context.Type),
                OnClick = () =>
                {
                    ClosePage();
                    _context.OnFileSelect(file1.FullName);
                }
            }).Cast <object>());
            _fileListView.SetData(list);
        }
Example #3
0
 public override void Active()
 {
     base.Active();
     _modelListView.SetData(ConvertDataForUi());
 }
Example #4
0
 public override void Active()
 {
     base.Active();
     MainSceneController.Instance.ShowSelectedMark(MainSceneController.Instance.GetModelCount() > 0);
     _modelListView.SetData(ConvertDataForUi());
 }