修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -37,6 +37,9 @@ public class PauseManager : MonoBehaviour
|
||||
[SerializeField] private Button exitButton;
|
||||
[SerializeField] private Button settingsButton;
|
||||
|
||||
[Header("Settings Prefab")]
|
||||
[SerializeField] private GameObject settingsPrefab;
|
||||
|
||||
[Header("Pause Entry Animation")]
|
||||
[SerializeField] private bool playPauseEntryAnimation = true;
|
||||
[SerializeField] private float pauseItemEnterDuration = 0.18f;
|
||||
@@ -678,6 +681,23 @@ public class PauseManager : MonoBehaviour
|
||||
if (!IsPaused) return;
|
||||
if (TryOpenExistingSettingsPanel()) return;
|
||||
|
||||
// NEW: Try to instantiate from prefab if provided
|
||||
if (settingsPrefab != null)
|
||||
{
|
||||
GameObject newSettings = Instantiate(settingsPrefab);
|
||||
newSettings.name = "ui_Panel_Setting";
|
||||
|
||||
// Ensure it has required animation component if needed by PauseManager logic
|
||||
if (newSettings.GetComponent<UI_SettingsPanelEnterAnim>() == null)
|
||||
{
|
||||
newSettings.AddComponent<UI_SettingsPanelEnterAnim>();
|
||||
}
|
||||
|
||||
newSettings.SetActive(true);
|
||||
newSettings.transform.SetAsLastSibling();
|
||||
return;
|
||||
}
|
||||
|
||||
var topController = FindAnyObjectByType<btmandtopController>();
|
||||
if (topController != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user