mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-23 08:53:05 +08:00
More progress, and change Aggressive Mouse Unlock behaviour
This commit is contained in:
@ -102,8 +102,14 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public override void SetActive(bool active)
|
||||
{
|
||||
if (this.Enabled.Equals(active))
|
||||
return;
|
||||
|
||||
base.SetActive(active);
|
||||
|
||||
if (!ApplyingSaveData)
|
||||
SaveToConfigManager();
|
||||
|
||||
if (NavButtonWanted)
|
||||
{
|
||||
if (active)
|
||||
@ -186,6 +192,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
ConstructPanelContent();
|
||||
|
||||
ApplyingSaveData = true;
|
||||
// apply panel save data or revert to default
|
||||
try
|
||||
{
|
||||
@ -203,18 +210,29 @@ namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
SaveToConfigManager();
|
||||
};
|
||||
ApplyingSaveData = false;
|
||||
}
|
||||
|
||||
public override void ConstructUI(GameObject parent) => ConstructUI();
|
||||
|
||||
// SAVE DATA
|
||||
|
||||
public abstract void SaveToConfigManager();
|
||||
public void SaveToConfigManager()
|
||||
{
|
||||
if (UIManager.Initializing)
|
||||
return;
|
||||
|
||||
DoSaveToConfigElement();
|
||||
}
|
||||
|
||||
public abstract void DoSaveToConfigElement();
|
||||
|
||||
public abstract void SetDefaultPosAndAnchors();
|
||||
|
||||
public abstract void LoadSaveData();
|
||||
|
||||
public bool ApplyingSaveData { get; set; }
|
||||
|
||||
public virtual string ToSaveData()
|
||||
{
|
||||
try
|
||||
@ -223,8 +241,9 @@ namespace UnityExplorer.UI.Panels
|
||||
$"|{mainPanelRect.RectAnchorsToString()}" +
|
||||
$"|{mainPanelRect.RectPositionToString()}";
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExplorerCore.LogWarning($"Exception generating Panel save data: {ex}");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user