mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-09-20 21:46:02 +08:00
Restore UnlockMouse config, adjust config saving
This commit is contained in:
@ -49,7 +49,7 @@ namespace UnityExplorer.UI.CacheObject
|
||||
public override void SetValue()
|
||||
{
|
||||
RefConfig.BoxedValue = IValue.Value;
|
||||
ConfigManager.Handler.SaveConfig();
|
||||
ConfigManager.Handler.OnAnyConfigChanged();
|
||||
}
|
||||
|
||||
internal GameObject m_leftGroup;
|
||||
@ -59,7 +59,9 @@ namespace UnityExplorer.UI.CacheObject
|
||||
{
|
||||
base.ConstructUI();
|
||||
|
||||
var horiGroup = UIFactory.CreateHorizontalGroup(m_mainContent, "ConfigEntryHolder", true, false, true, true, 5, new Vector4(2,2,2,2));
|
||||
var vertGroup = UIFactory.CreateVerticalGroup(m_mainContent, "ConfigHolder", true, false, true, true, 5, new Vector4(2, 2, 2, 2));
|
||||
|
||||
var horiGroup = UIFactory.CreateHorizontalGroup(vertGroup, "ConfigEntryHolder", true, false, true, true);
|
||||
UIFactory.SetLayoutElement(horiGroup, minHeight: 30, flexibleHeight: 0);
|
||||
|
||||
// left group
|
||||
@ -89,6 +91,12 @@ namespace UnityExplorer.UI.CacheObject
|
||||
IValue.m_mainContentParent = m_rightGroup;
|
||||
IValue.m_subContentParent = this.m_subContent;
|
||||
}
|
||||
|
||||
// Config description label
|
||||
|
||||
UIFactory.CreateLabel(vertGroup, "Description", $"<i>{RefConfig.Description}</i>", TextAnchor.MiddleLeft, Color.grey);
|
||||
|
||||
m_subContent.transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,6 @@ namespace UnityExplorer.UI.Main.Options
|
||||
{
|
||||
ConstructUI();
|
||||
|
||||
_cachedConfigEntries.AddRange(ConfigManager.ConfigElements.Values
|
||||
.Where(it => !it.IsInternal)
|
||||
.Select(it => new CacheConfigEntry(it, m_contentObj)));
|
||||
|
||||
foreach (var entry in _cachedConfigEntries)
|
||||
entry.Enable();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,14 +44,26 @@ namespace UnityExplorer.UI.Main.Options
|
||||
var titleLabel = UIFactory.CreateLabel(Content, "Title", "Options", TextAnchor.UpperLeft, default, true, 25);
|
||||
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 30, flexibleHeight: 0);
|
||||
|
||||
// Save button
|
||||
|
||||
var btn = UIFactory.CreateButton(Content,
|
||||
"SaveButton",
|
||||
"Save Config File",
|
||||
() => { ConfigManager.Handler.SaveConfig(); },
|
||||
new Color(0.25f, 0.6f, 0.25f));
|
||||
UIFactory.SetLayoutElement(btn.gameObject, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 0);
|
||||
|
||||
// ~~~~~ Actual options ~~~~~
|
||||
|
||||
UIFactory.CreateScrollView(Content, "ConfigList", out m_contentObj, out _, new Color(0.05f, 0.05f, 0.05f));
|
||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(m_contentObj, forceHeight: true, spacing: 3, padLeft: 3, padRight: 3);
|
||||
|
||||
//m_contentObj = UIFactory.CreateVerticalGroup(Content, "OptionsGroup", true, false, true, false, 5, new Vector4(5,5,5,5),
|
||||
// new Color(0.1f, 0.1f, 0.1f));
|
||||
//UIFactory.SetLayoutElement(m_contentObj, minHeight: 340, flexibleHeight: 9999);
|
||||
_cachedConfigEntries.AddRange(ConfigManager.ConfigElements.Values
|
||||
.Where(it => !it.IsInternal)
|
||||
.Select(it => new CacheConfigEntry(it, m_contentObj)));
|
||||
|
||||
foreach (var entry in _cachedConfigEntries)
|
||||
entry.Enable();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user