Exemple #1
0
        protected void DisplayChosenDirectoryPathLabel(string directoryPath)
        {
            GUILayout.Label(CerberusTexts.ChosenDirectory, cerberusStyles.MediumHeaderGuiStyle,
                            GUILayout.Width(chosenDirectoryLabelWidth));

            GUIContent directoryPathContent = new GUIContent(directoryPath);

            directoryPathContentSize =
                CerberusStyleHandler.CalculateContentSize(cerberusStyles.MediumHeaderItalicGuiStyle, directoryPathContent);

            var tmp = margin * 2 + chosenDirectoryLabelWidth + directoryButtonWidth;

            directoryPathContentSize.y = CerberusStyleHandler.CalculateContentHeight(
                cerberusStyles.MediumHeaderItalicGuiStyle, directoryPathContent, Screen.width - tmp);

            if (directoryPathContentSize.x + tmp > Screen.width)
            {
                GUILayout.Label(directoryPath, cerberusStyles.MediumHeaderItalicGuiStyle);
            }
            else
            {
                GUILayout.Label(directoryPath, cerberusStyles.MediumHeaderItalicGuiStyle,
                                GUILayout.Width(directoryPathContentSize.x + margin));
            }
        }
Exemple #2
0
        protected void DisplayFilesInTable(IList <CerberusFile> files, int extensionColumnWidth, int nameColumnWidth, int sizeColumnWidth)
        {
            foreach (CerberusFile file in files.Where(f => f.IsVisible))
            {
                GUILayout.BeginHorizontal();

                GUIContent fileNameContent = new GUIContent(file.Name);

                var contentHeight =
                    CerberusStyleHandler.CalculateContentHeight(cerberusStyles.TableContentGuiStyle, fileNameContent, 400);

                file.Selected = GUILayout.Toggle(file.Selected, "", GUILayout.Width(30));

                GUILayout.TextField(file.Extension, cerberusStyles.TableContentGuiStyle, GUILayout.Width(extensionColumnWidth),
                                    GUILayout.Height(contentHeight));

                GUILayout.TextField(file.Name, cerberusStyles.TableContentGuiStyle, GUILayout.Width(nameColumnWidth));

                if (sizeColumnWidth != 0)
                {
                    GUILayout.TextField(file.Size + CerberusTexts.KiloBytes, cerberusStyles.TableContentGuiStyle,
                                        GUILayout.Height(contentHeight), GUILayout.Width(sizeColumnWidth));
                }

                GUILayout.EndHorizontal();

                ChangeSelectionOfMetaFile(file, files.Where(f => !f.IsVisible).ToList());
            }
        }