Code cleanup.

This commit is contained in:
2022-11-15 12:12:29 +08:00
parent fcc9935325
commit 7b1f639412
4 changed files with 5 additions and 9 deletions

View File

@@ -66,8 +66,7 @@ namespace Cryville.Crtr.Config {
ruleset.LoadPdt(dir);
_proxy = new InputProxy(ruleset.Root, null);
foreach (var i in ruleset.Root.inputs) {
var e = GameObject.Instantiate(m_prefabInputConfigEntry).GetComponent<InputConfigEntry>();
e.transform.SetParent(m_entryList.transform);
var e = GameObject.Instantiate(m_prefabInputConfigEntry, m_entryList.transform).GetComponent<InputConfigEntry>();
_entries.Add(i.Key, e);
e.SetKey(this, i.Key);
}
@@ -92,8 +91,7 @@ namespace Cryville.Crtr.Config {
void AddSourceItem(InputSource? src) {
if (_recvsrcs.Contains(src)) return;
_recvsrcs.Add(src);
var obj = Instantiate(m_prefabListItem);
obj.transform.SetParent(m_deviceList);
var obj = Instantiate(m_prefabListItem, m_deviceList);
obj.transform.Find("Text").GetComponent<Text>().text = src == null ? "None" : src.Value.Handler.GetTypeName(src.Value.Type);
var btn = obj.GetComponent<Button>();
if (src != null) btn.interactable = !_proxy.IsUsed(src.Value);