mirror of
https://github.com/Earth-Genesis-Games/Ajedrez_Purgatorio.git
synced 2026-09-11 09:47:35 +00:00
fix: empty board + state stuck in Dialogue
- BoardManager.SetupBoard: fallback to PlacePieces() when campaign identities are not configured (prevents empty board) - CampaignManager: only transition to Dialogue state if StartDialogue returns true (prevents state override when dialogue fails) - Same fix for outro dialogue transition
This commit is contained in:
@@ -72,7 +72,7 @@ public GameObject kingPrefab; // Prefab del Rey usado como "jefe" en el purgator
|
||||
{
|
||||
if (campaignState == null)
|
||||
{
|
||||
Debug.LogError("[BoardManager] CampaignState es null. Usando setup estándar.");
|
||||
Debug.Log("[BoardManager] CampaignState es null. Usando setup estándar.");
|
||||
PlacePieces();
|
||||
return;
|
||||
}
|
||||
@@ -85,7 +85,8 @@ public GameObject kingPrefab; // Prefab del Rey usado como "jefe" en el purgator
|
||||
|
||||
if (availablePieces.Count == 0)
|
||||
{
|
||||
Debug.LogError("[BoardManager] No hay piezas disponibles. La campaña debería terminar.");
|
||||
Debug.LogWarning("[BoardManager] No hay identidades de campaña configuradas. Usando setup estándar.");
|
||||
PlacePieces();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -362,19 +362,22 @@ public class CampaignManager : MonoBehaviour
|
||||
if (DialogueSystem.Instance != null)
|
||||
{
|
||||
// Subscribe BEFORE starting — StartDialogue can fire OnDialogueComplete immediately
|
||||
// if dialogue is not found, which would skip the transition.
|
||||
DialogueSystem.Instance.OnDialogueComplete += OnIntroDialogueComplete;
|
||||
DialogueSystem.Instance.StartDialogue(chapter.introDialogueId);
|
||||
bool started = DialogueSystem.Instance.StartDialogue(chapter.introDialogueId);
|
||||
|
||||
if (started)
|
||||
{
|
||||
// Only transition to Dialogue if dialogue actually started
|
||||
if (GameStateManager.Instance != null)
|
||||
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
|
||||
}
|
||||
// If started=false, OnDialogueComplete already fired → OnIntroDialogueComplete → TransitionToPlaying
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[CampaignManager] DialogueSystem no disponible. Saltando intro.");
|
||||
TransitionToPlaying();
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameStateManager.Instance != null)
|
||||
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
|
||||
}
|
||||
|
||||
private void OnIntroDialogueComplete()
|
||||
@@ -403,17 +406,20 @@ public class CampaignManager : MonoBehaviour
|
||||
{
|
||||
// Subscribe BEFORE starting — same fix as intro.
|
||||
DialogueSystem.Instance.OnDialogueComplete += OnOutroDialogueComplete;
|
||||
DialogueSystem.Instance.StartDialogue(CurrentChapter.outroDialogueId);
|
||||
bool started = DialogueSystem.Instance.StartDialogue(CurrentChapter.outroDialogueId);
|
||||
|
||||
if (started)
|
||||
{
|
||||
if (GameStateManager.Instance != null)
|
||||
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
|
||||
}
|
||||
// If started=false, OnDialogueComplete already fired → OnOutroDialogueComplete → CompleteChapter
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[CampaignManager] DialogueSystem no disponible. Saltando outro.");
|
||||
CompleteChapter();
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameStateManager.Instance != null)
|
||||
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
|
||||
}
|
||||
|
||||
private void OnOutroDialogueComplete()
|
||||
|
||||
+4358
-3
File diff suppressed because it is too large
Load Diff
+8841
-4486
File diff suppressed because it is too large
Load Diff
+8903
-4548
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user