Move ruleset config to main scene. Add title for UI.

This commit is contained in:
2023-02-06 22:55:14 +08:00
parent c0744a3464
commit da68c8b877
27 changed files with 94 additions and 35 deletions

View File

@@ -7,7 +7,7 @@ using UnityEngine.UI;
namespace Cryville.Crtr.Config {
public class InputConfigPanel : MonoBehaviour {
[SerializeField]
ConfigScene m_configScene;
ConfigPanelMaster m_configScene;
[SerializeField]
GameObject m_inputDialog;
@@ -24,7 +24,7 @@ namespace Cryville.Crtr.Config {
[SerializeField]
GameObject m_prefabInputConfigEntry;
readonly SimpleInputConsumer _consumer = new SimpleInputConsumer(Game.InputManager);
SimpleInputConsumer _consumer;
public InputProxy proxy;
readonly Dictionary<string, InputConfigPanelEntry> _entries = new Dictionary<string, InputConfigPanelEntry>();
@@ -50,7 +50,10 @@ namespace Cryville.Crtr.Config {
CloseDialog();
}
void Start() {
public void OnConfigEnable() {
CallHelper.Purge(m_entryList);
_entries.Clear();
_consumer = new SimpleInputConsumer(Game.InputManager);
_consumer.Activate();
foreach (var i in m_configScene.ruleset.Root.inputs) {
var e = GameObject.Instantiate(m_prefabInputConfigEntry, m_entryList.transform).GetComponent<InputConfigPanelEntry>();
@@ -61,7 +64,7 @@ namespace Cryville.Crtr.Config {
proxy.ProxyChanged += OnProxyChanged;
}
void OnDestroy() {
public void OnConfigDisable() {
_consumer.Deactivate();
}