Implement action bar.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
[SerializeField]
|
||||
DetailPanel m_detailPanel;
|
||||
[SerializeField]
|
||||
GameObject m_actionBar;
|
||||
ActionBar m_actionBar;
|
||||
|
||||
IPathedResourceManager<ChartDetail> _manager;
|
||||
IResourceAction _importAction;
|
||||
@@ -77,6 +77,7 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
_items.Clear();
|
||||
m_itemContainer.ItemCount = _manager.Count;
|
||||
m_detailPanel.Clear();
|
||||
m_actionBar.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +103,9 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
_selectedItems.Clear();
|
||||
_items[id].OnSelect();
|
||||
_selectedItems.Add(id);
|
||||
m_detailPanel.Load(_manager[id]);
|
||||
m_actionBar.SetActive(true);
|
||||
ChartDetail res = _manager[id];
|
||||
m_detailPanel.Load(res);
|
||||
m_actionBar.Load(this, Master.Actions.GetActions(res.GetType()));
|
||||
}
|
||||
|
||||
public void OnPathClicked(int index) {
|
||||
@@ -121,5 +123,19 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
if (result != 0) return;
|
||||
foreach (var item in _selectedItems.OrderByDescending(i => i)) _manager.RemoveAt(item);
|
||||
}
|
||||
|
||||
public override void InvokeAction(IResourceAction action) {
|
||||
if (_selectedItems.Count == 0) {
|
||||
Popup.Create("No item is selected.");
|
||||
return;
|
||||
}
|
||||
if (_selectedItems.Count > 1) {
|
||||
Popup.Create("Cannot run this action with multiple items.");
|
||||
return;
|
||||
}
|
||||
foreach (var i in _selectedItems) {
|
||||
action.Invoke(_manager.GetItemUri(i), _manager[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user