// Disables file buttons with files that have a different file extension (than given to the OpenFilePanel) private void DisableWrongExtensionFiles(KImprovedFileBrowserButton button, string file) { if (!_fileBrowser.CompatibleFileExtension(file)) { button.Button.interactable = false; } }
// Creates a file button given a file public void CreateFileButton(string file) { KImprovedFileBrowserButton button = Instantiate(FileButtonPrefab, FilesContainer); // When in Load mode, disable the buttons with different extension than the given file extension if (_fileBrowser.GetMode() == FileBrowserMode.Load) { DisableWrongExtensionFiles(button, file); } SetupButton(button, Path.GetFileName(file)); // Setup FileButton script for file button (handles click and double click event) button.GetComponent <FileButton>().Setup(_fileBrowser, file, button.Button.interactable); }
private void SetupPrefab(KImprovedFileBrowserButton panel) { panel.Text.fontSize = ItemFontSize; panel.Text.color = ItemFontColor; panel.GetComponent <LayoutElement>().preferredHeight = ItemButtonHeight; }
// Generic method used to extract common code for creating a directory or file button private void SetupButton(KImprovedFileBrowserButton button, string text) { button.Text.text = text; }