Working dialogue images mixed with text
This commit is contained in:
@@ -76,20 +76,29 @@ namespace Dialogue
|
||||
{
|
||||
if (speechBubble == null || !HasAnyLines()) return;
|
||||
|
||||
// Advance the dialogue state to move to the next content
|
||||
AdvanceDialogueState();
|
||||
|
||||
// Check if we have DialogueContent available
|
||||
// Check if we have DialogueContent available (prioritizing the new content system)
|
||||
DialogueContent content = GetCurrentDialogueContent();
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
// Display the content with the new method that handles both text and images
|
||||
// Display the content with the method that handles both text and images
|
||||
// and pass whether there are more lines available for prompt display
|
||||
speechBubble.DisplayDialogueContent(content, HasAnyLines());
|
||||
|
||||
// Log the content type for debugging
|
||||
Debug.Log($"Displaying content type: {content.ContentType} - {(content.ContentType == DialogueContentType.Text ? content.Text : content.Image?.name)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fall back to legacy text-only method
|
||||
// Fall back to legacy text-only method if no DialogueContent is available
|
||||
string line = GetCurrentDialogueLine();
|
||||
speechBubble.DisplayDialogueLine(line, HasAnyLines());
|
||||
|
||||
// Log for debugging
|
||||
Debug.Log($"Displaying legacy text: {line}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +148,7 @@ namespace Dialogue
|
||||
int index = Mathf.Clamp(currentLineIndex, 0, contentForState.Count - 1);
|
||||
return contentForState[index];
|
||||
}
|
||||
return null; // No content for this slot state
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -281,18 +291,41 @@ namespace Dialogue
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have more lines in the current node, advance to the next line
|
||||
if (currentLineIndex < currentNode.dialogueLines.Count - 1)
|
||||
// First check if we have any dialogueContent to process
|
||||
bool hasDialogueContent = currentNode.dialogueContent != null && currentNode.dialogueContent.Count > 0;
|
||||
|
||||
if (hasDialogueContent)
|
||||
{
|
||||
currentLineIndex++;
|
||||
return;
|
||||
}
|
||||
// If we have dialogueContent and there are more entries, advance to the next one
|
||||
if (currentLineIndex < currentNode.dialogueContent.Count - 1)
|
||||
{
|
||||
currentLineIndex++;
|
||||
return;
|
||||
}
|
||||
|
||||
// If we should loop through lines, reset the index
|
||||
if (currentNode.loopThroughLines && currentNode.dialogueLines.Count > 0)
|
||||
// If we should loop through content, reset the index
|
||||
if (currentNode.loopThroughLines && currentNode.dialogueContent.Count > 0)
|
||||
{
|
||||
currentLineIndex = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentLineIndex = 0;
|
||||
return;
|
||||
// Fall back to legacy dialogueLines
|
||||
// If we have more lines in the current node, advance to the next line
|
||||
if (currentLineIndex < currentNode.dialogueLines.Count - 1)
|
||||
{
|
||||
currentLineIndex++;
|
||||
return;
|
||||
}
|
||||
|
||||
// If we should loop through lines, reset the index
|
||||
if (currentNode.loopThroughLines && currentNode.dialogueLines.Count > 0)
|
||||
{
|
||||
currentLineIndex = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're at a node that doesn't have a next node, we're done
|
||||
|
||||
@@ -7,10 +7,34 @@ namespace UI
|
||||
{
|
||||
public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
private static PauseMenu _instance;
|
||||
private static bool _isQuitting;
|
||||
|
||||
public static PauseMenu Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && Application.isPlaying && !_isQuitting)
|
||||
{
|
||||
_instance = FindAnyObjectByType<PauseMenu>();
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("PauseMenu");
|
||||
_instance = go.AddComponent<PauseMenu>();
|
||||
// DontDestroyOnLoad(go);
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("UI References")]
|
||||
[SerializeField] private GameObject pauseMenuPanel;
|
||||
[SerializeField] private GameObject pauseButton;
|
||||
|
||||
public event Action OnGamePaused;
|
||||
public event Action OnGameResumed;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Subscribe to scene loaded events
|
||||
@@ -32,6 +56,11 @@ namespace UI
|
||||
}
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
_isQuitting = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the pause menu game object active or inactive based on the current level
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user