Reloads actions on actions changed.
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
UnregisterManager();
|
||||
}
|
||||
void UnregisterManager() {
|
||||
Master.Actions.Unregister(_importAction);
|
||||
if (_importAction != null) Master.Actions.Unregister(_importAction);
|
||||
_manager.ItemChanged -= OnItemChanged;
|
||||
_manager.DirectoryChanged -= OnDirectoryChanged;
|
||||
}
|
||||
@@ -111,9 +111,19 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
_selectedItems.Add(id);
|
||||
var res = _manager[id];
|
||||
m_detailPanel.Load(res);
|
||||
m_actionBar.Load(this, Master.Actions.GetActions(res.GetType()).Except(_importActionArray));
|
||||
if (_selectedItems.Count == 1) {
|
||||
LoadActions(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
internal override void OnActionsChanged() {
|
||||
if (_selectedItems.Count == 1) {
|
||||
LoadActions(_manager[_selectedItems.Single()]);
|
||||
}
|
||||
}
|
||||
void LoadActions(IResourceMeta res) {
|
||||
m_actionBar.Load(this, Master.Actions.GetActions(res.GetType()).Except(_importActionArray));
|
||||
}
|
||||
|
||||
public void OnPathClicked(int index) {
|
||||
_manager.ReturnToDirectory(index);
|
||||
|
@@ -15,5 +15,6 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
public abstract void OnItemClicked(int index);
|
||||
|
||||
public abstract void InvokeAction(IResourceAction action);
|
||||
internal abstract void OnActionsChanged();
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
base.Awake();
|
||||
|
||||
Actions = new ActionManager();
|
||||
Actions.Changed += OnActionsChanged;
|
||||
Actions.Register(new PlayChartAction());
|
||||
|
||||
OnTabClicked(AddPathedBrowserTab("Local", new LegacyResourceManager(Settings.Default.GameDataPath)));
|
||||
@@ -64,6 +65,12 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
}
|
||||
}
|
||||
|
||||
void OnActionsChanged() {
|
||||
foreach (var tab in _tabs) {
|
||||
tab.Value.OnActionsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Back() {
|
||||
return true; // TODO
|
||||
}
|
||||
|
@@ -9,5 +9,6 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
}
|
||||
public override void OnItemClicked(int index) { }
|
||||
public override void InvokeAction(IResourceAction action) { }
|
||||
internal override void OnActionsChanged() { }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user