36 lines
822 B
C#
36 lines
822 B
C#
using Cryville.Crtr.Browsing.Actions;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace Cryville.Crtr.Browsing.UI {
|
|
internal class ActionBar : MonoBehaviour {
|
|
[SerializeField]
|
|
ActionButton m_mainButton;
|
|
[SerializeField]
|
|
ActionButton m_subButton;
|
|
|
|
public void Load(ResourceBrowser browser, IEnumerable<IResourceAction> actions) {
|
|
var enumerator = actions.OrderBy(i => i.Priority).GetEnumerator();
|
|
if (enumerator.MoveNext()) {
|
|
gameObject.SetActive(true);
|
|
m_mainButton.Load(browser, enumerator.Current);
|
|
if (enumerator.MoveNext()) {
|
|
m_subButton.Load(browser, enumerator.Current);
|
|
}
|
|
else {
|
|
m_subButton.Clear();
|
|
}
|
|
}
|
|
else {
|
|
m_mainButton.Clear();
|
|
Clear();
|
|
}
|
|
}
|
|
|
|
public void Clear() {
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|