Improve the ordering logic for applicable input handlers in input config.

This commit is contained in:
2023-06-06 21:27:33 +08:00
parent a6a0ac3f9e
commit 9833052849

View File

@@ -30,6 +30,7 @@ namespace Cryville.Crtr.Config {
public InputProxy proxy;
readonly Dictionary<Identifier, InputConfigPanelEntry> _entries = new Dictionary<Identifier, InputConfigPanelEntry>();
int _applicableEntries;
Identifier _sel;
int _targetDim;
PhysicalDimension? _targetPDim;
@@ -45,6 +46,7 @@ namespace Cryville.Crtr.Config {
CallHelper.Purge(m_deviceList);
_consumer.EnumerateEvents(ev => { });
_recvsrcs.Clear();
_applicableEntries = 1;
AddSourceItem(null);
}
@@ -143,7 +145,7 @@ namespace Cryville.Crtr.Config {
}
else flag = true;
btn.interactable = flag;
obj.transform.SetSiblingIndex(flag ? 1 : m_deviceList.childCount - 1);
obj.transform.SetSiblingIndex(flag ? _applicableEntries++ : m_deviceList.childCount - 1);
}
else {
obj.transform.SetSiblingIndex(0);