Disables file watcher during gameplay.
This commit is contained in:
@@ -11,6 +11,9 @@ namespace Cryville.Crtr.Browsing {
|
||||
[Obsolete]
|
||||
IReadOnlyDictionary<string, string> GetPresetPaths();
|
||||
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
|
||||
event Action ItemChanged;
|
||||
}
|
||||
public interface IPathedResourceManager<T> : IResourceManager<T> {
|
||||
|
@@ -47,6 +47,14 @@ namespace Cryville.Crtr.Browsing {
|
||||
ReloadFiles();
|
||||
}
|
||||
|
||||
public void Activate() {
|
||||
_watcher.EnableRaisingEvents = !string.IsNullOrEmpty(_watcher.Path);
|
||||
}
|
||||
|
||||
public void Deactivate() {
|
||||
_watcher.EnableRaisingEvents = false;
|
||||
}
|
||||
|
||||
void ReloadFiles() {
|
||||
_items = _cd.GetDirectories();
|
||||
_version++;
|
||||
|
@@ -23,6 +23,14 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
InitDialog();
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
ResourceManager.Activate();
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
ResourceManager.Deactivate();
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
protected void InitDialog() {
|
||||
_dialog = Instantiate(Resources.Load<GameObject>("Common/FileDialog")).GetComponent<FileDialog>();
|
||||
|
Reference in New Issue
Block a user