Includes actions for base types.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.Actions {
|
||||
public class ActionManager {
|
||||
@@ -40,8 +41,14 @@ namespace Cryville.Crtr.Browsing.Actions {
|
||||
Unregister(typeof(T), action);
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<IResourceAction> GetActions(Type type) {
|
||||
return _actions[type];
|
||||
public IEnumerable<IResourceAction> GetActions(Type type) {
|
||||
List<IResourceAction> actions;
|
||||
if (!_actions.TryGetValue(type, out actions)) {
|
||||
actions = new List<IResourceAction>();
|
||||
}
|
||||
IEnumerable<IResourceAction> result = actions;
|
||||
if (type != typeof(object)) result = result.Concat(GetActions(type.BaseType));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
[SerializeField]
|
||||
ActionButton m_subButton;
|
||||
|
||||
public void Load(ResourceBrowser browser, IReadOnlyCollection<IResourceAction> actions) {
|
||||
public void Load(ResourceBrowser browser, IEnumerable<IResourceAction> actions) {
|
||||
var enumerator = actions.OrderBy(i => i.Priority).GetEnumerator();
|
||||
if (enumerator.MoveNext()) {
|
||||
gameObject.SetActive(true);
|
||||
|
Reference in New Issue
Block a user