public void OnClickFileType(FileItem.FileType filetype)
    {
        FileItem.FileType lastType = FileListControl.Instance().SelectedType;
        FileListControl.Instance().SelectedType = filetype;
        for (int i = 0; i < tabArray.Length; ++i)
        {
            if (tabArray [i].btnTpye == filetype)
            {
                tabArray [i].HighColor();
            }

            if (tabArray [i].btnTpye == lastType)
            {
                tabArray [i].ReSetColor();
            }
        }

        if (filetype == FileItem.FileType.FileType_Web)
        {
            webObject.SetActive(true);
            videoObject.SetActive(false);
        }
        else if (filetype == FileItem.FileType.FileType_Video)
        {
            webObject.SetActive(false);
            videoObject.SetActive(true);
        }
    }
Exemple #2
0
    //not cache yet...
    public List <FileItem> GetFileListByType(FileItem.FileType filetype)
    {
        List <FileItem> result = new List <FileItem> ();

        foreach (var item in fileModel.FileDicInfo)
        {
            if (item._fileType == filetype)
            {
                result.Add(item);
            }
        }
        return(result);
    }
    //
    public static FileListView Create(string name, string title, Sprite sprite, FileItem.FileType filetype = FileItem.FileType.FileType_Video)
    {
        if (sprite == null)
        {
            Debug.Log("FileListView.Create(), sprite can not be null !");
            return(null);
        }

        GameObject go;

        if (FileItem.FileType.FileType_Video == filetype)
        {
            go = Instantiate(FileListControl.Instance().VideoViewPrefab) as GameObject;
        }
        else if (FileItem.FileType.FileType_Web == filetype)
        {
            go = Instantiate(FileListControl.Instance().WebViewPrefab) as GameObject;
        }
        else
        {
            Log.error("FileListView", "Unknown file type:" + filetype);
            return(null);
        }

        go.transform.SetParent(FileListControl.Instance().GetTempRoot());
        go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
        go.transform.localScale    = Vector3.one;
        go.name = name;

        //set title and sprite
        //RectTransform rect = go.GetComponent<RectTransform> ();
        //rect.rect.height = 100;
        //rect.rect.width = 100;
        FileListView instance = go.GetComponent <FileListView>();

        if (null == instance)
        {
            instance = go.AddComponent <FileListView>();
        }
        instance.title         = title;
        instance.preview       = sprite;
        instance.fileListModel = null;
        return(instance);
    }
Exemple #4
0
    /// <summary>
    /// Switchs the type of the preview list by.
    /// </summary>
    public void SwitchPreviewListByType(FileItem.FileType filetype)
    {
        int childcount             = ScreenRoot.transform.childCount;
        List <Transform> transList = new List <Transform> ();

        for (int i = 0; i < childcount; ++i)
        {
            Transform trans = ScreenRoot.transform.GetChild(i);
            transList.Add(trans);
        }

        foreach (Transform t in transList)
        {
            Destroy(t.gameObject);
        }
        transList.Clear();

        //Add new List Type...
        List <FileItem> itemList = GetFileListByType(filetype);

        FreshPreViewByType(itemList);

        RefreshFileList();
    }