Skip to content

Commit 1b007a2

Browse files
committed
AllFilesFilterText, FoldersFilterText and PickFolderQuickLinkText can now be changed after the file browser is initialized, as well
1 parent 6980dfd commit 1b007a2

File tree

5 files changed

+92
-22
lines changed

5 files changed

+92
-22
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.IO;
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
namespace SimpleFileBrowser
6+
{
7+
public class FBPostProcessBuild
8+
{
9+
[InitializeOnLoadMethod]
10+
public static void ValidatePlugin()
11+
{
12+
string jarPath = "Assets/Plugins/SimpleFileBrowser/Android/SimpleFileBrowser.jar";
13+
if( File.Exists( jarPath ) )
14+
{
15+
Debug.Log( "Deleting obsolete " + jarPath );
16+
AssetDatabase.DeleteAsset( jarPath );
17+
}
18+
}
19+
}
20+
}

Plugins/SimpleFileBrowser/Editor/SFBPostProcessBuild.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

Plugins/SimpleFileBrowser/Scripts/FileBrowser.cs

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ public override string ToString()
105105
#endregion
106106

107107
#region Static Variables
108-
public static string AllFilesFilterText = "All Files (.*)";
109-
public static string FoldersFilterText = "Folders";
110-
public static string PickFolderQuickLinkText = "Pick Folder";
111-
112108
public static bool IsOpen { get; private set; }
113109

114110
public static bool Success { get; private set; }
@@ -128,6 +124,77 @@ public static bool SingleClickMode
128124
set { m_singleClickMode = value; }
129125
}
130126

127+
private static string m_allFilesFilterText = "All Files (.*)";
128+
public static string AllFilesFilterText
129+
{
130+
get { return m_allFilesFilterText; }
131+
set
132+
{
133+
if( m_allFilesFilterText != value )
134+
{
135+
string oldValue = m_allFilesFilterText;
136+
m_allFilesFilterText = value;
137+
138+
if( m_instance )
139+
{
140+
Filter oldAllFilesFilter = m_instance.allFilesFilter;
141+
m_instance.allFilesFilter = new Filter( value );
142+
143+
if( m_instance.filters.Count > 0 && m_instance.filters[0] == oldAllFilesFilter )
144+
m_instance.filters[0] = m_instance.allFilesFilter;
145+
146+
if( m_instance.filtersDropdown.options[0].text == oldValue )
147+
m_instance.filtersDropdown.options[0].text = value;
148+
}
149+
}
150+
}
151+
}
152+
153+
154+
private static string m_foldersFilterText = "Folders";
155+
public static string FoldersFilterText
156+
{
157+
get { return m_foldersFilterText; }
158+
set
159+
{
160+
if( m_foldersFilterText != value )
161+
{
162+
string oldValue = m_foldersFilterText;
163+
m_foldersFilterText = value;
164+
165+
if( m_instance && m_instance.filtersDropdown.options[0].text == oldValue )
166+
m_instance.filtersDropdown.options[0].text = value;
167+
}
168+
}
169+
}
170+
171+
172+
private static string m_pickFolderQuickLinkText = "Pick Folder";
173+
public static string PickFolderQuickLinkText
174+
{
175+
get { return m_pickFolderQuickLinkText; }
176+
set
177+
{
178+
if( m_pickFolderQuickLinkText != value )
179+
{
180+
m_pickFolderQuickLinkText = value;
181+
182+
if( m_instance && m_instance.addedQuickLinksSet.Contains( SAF_PICK_FOLDER_QUICK_LINK_PATH ) )
183+
{
184+
for( int i = 0; i < m_instance.quickLinksContainer.childCount; i++ )
185+
{
186+
FileBrowserQuickLink quickLink = m_instance.quickLinksContainer.GetChild( i ).GetComponent<FileBrowserQuickLink>();
187+
if( quickLink && quickLink.TargetPath == SAF_PICK_FOLDER_QUICK_LINK_PATH )
188+
{
189+
quickLink.SetQuickLink( m_instance.driveIcon, value, SAF_PICK_FOLDER_QUICK_LINK_PATH );
190+
break;
191+
}
192+
}
193+
}
194+
}
195+
}
196+
}
197+
131198
private static FileBrowser m_instance = null;
132199
private static FileBrowser Instance
133200
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.yasirkula.simplefilebrowser",
33
"displayName": "Simple File Browser",
4-
"version": "1.3.9",
4+
"version": "1.4.0",
55
"description": "This plugin helps you show save/load dialogs during gameplay with its uGUI based file browser."
66
}

0 commit comments

Comments
 (0)