Class DialogService

java.lang.Object
com.csse3200.game.services.DialogService

public class DialogService extends Object
Service for managing dialog components throughout the game. Provides convenient methods for creating and displaying different types of dialogs.
  • Constructor Details

    • DialogService

      public DialogService()
      Creates a new dialog service.
  • Method Details

    • info

      public DialogComponent info(String title, String message)
      Creates and shows an info dialog.
      Parameters:
      title - the dialog title
      message - the dialog message
      Returns:
      the created dialog component
    • info

      public DialogComponent info(String title, String message, Consumer<DialogComponent> onClose)
      Creates and shows an info dialog with a close callback.
      Parameters:
      title - the dialog title
      message - the dialog message
      onClose - callback when dialog is closed
      Returns:
      the created dialog component
    • warning

      public DialogComponent warning(String title, String message)
      Creates and shows a warning dialog.
      Parameters:
      title - the dialog title
      message - the dialog message
      Returns:
      the created dialog component
    • warning

      public DialogComponent warning(String title, String message, Consumer<DialogComponent> onConfirm, Consumer<DialogComponent> onCancel)
      Creates and shows a warning dialog with callbacks.
      Parameters:
      title - the dialog title
      message - the dialog message
      onConfirm - callback when user confirms/continues
      onCancel - callback when user cancels
      Returns:
      the created dialog component
    • error

      public DialogComponent error(String title, String message)
      Creates and shows an error dialog.
      Parameters:
      title - the dialog title
      message - the dialog message
      Returns:
      the created dialog component
    • error

      public DialogComponent error(String title, String message, Consumer<DialogComponent> onClose)
      Creates and shows an error dialog with a close callback.
      Parameters:
      title - the dialog title
      message - the dialog message
      onClose - callback when dialog is closed
      Returns:
      the created dialog component
    • skill

      public DialogComponent skill(String title, String message)
      Creates and shows a skill dialog.
      Parameters:
      title - the dialog title
      message - the dialog message
      Returns:
      the created dialog component
    • skill

      public DialogComponent skill(String title, String message, Consumer<DialogComponent> onUnlock, Consumer<DialogComponent> onClose)
      Creates and shows a skill dialog with callbacks.
      Parameters:
      title - the dialog title
      message - the dialog message
      onUnlock - callback when user unlocks the skill
      onClose - callback when user closes the dialog
      Returns:
      the created dialog component
    • hideAllDialogs

      public void hideAllDialogs()
      Hides all active dialogs.
    • getActiveDialogCount

      public int getActiveDialogCount()
      Gets the number of currently active dialogs.
      Returns:
      the number of active dialogs
    • hasActiveDialogs

      public boolean hasActiveDialogs()
      Checks if there are any active dialogs.
      Returns:
      true if there are active dialogs, false otherwise
    • getActiveDialogs

      public List<DialogComponent> getActiveDialogs()
      Gets a copy of the list of active dialogs.
      Returns:
      list of active dialog components
    • resize

      public void resize()
      Handles window resize by re-centering all active dialogs.
    • achievement

      public AchievementDialogComponent achievement(String name, String description, int skillPoints, String tier)
      Creates and shows an achievement dialog.
      Parameters:
      name - the name of the achievement
      description - the description of the achievement
      skillPoints - the skill points of the achievement
      tier - the tier of the achievement
      Returns:
      the created achievement dialog component