Skip to content

Textbox Display

Jackson Van Duikeren edited this page Sep 10, 2024 · 1 revision

Overview

The TextDisplay class is a UI component created for the purpose of rendering and managing text display in the game. It allows for the slow, typewriter-like reveal of text, which can be broken into parts for multi-step displays. This class is particularly useful for displaying narrative text, dialogues, or other forms of sequential information to the player.

Methods in TextDisplay.java

void create()

Initializes the UI elements and sets up the layout, including a stack that contains the text box image and label for text display. It also sets up input listeners and event listeners.

void setText(String text)

Takes a String input and splits it into chunks based on a defined character limit.

List getText()

Returns the list of the split text which will be displayed

void setVisible(Boolean value)

Sets the visibility of the text display. If true, the text box and label will be shown; otherwise, they will be hidden.

boolean getVisible()

Returns the current visibility state of the text display.

void update()

Handles the logic for updating the text display, revealing one character at a time based on the delay. This method is called continuously to drive the typewriter effect.

void setupInputListener()

Sets up an input listener for the stage that listens for the ENTER key. When pressed, it moves to the next part of the text. If all parts have been displayed, it hides the text display.

How to use

To create your own text display, you can simply use the setText function which will automatically make the textbox visible. A example of creating a textbox is shown in ForestGameArea.java. The code below shows the functions which creates the textbox for this area

private void createTextBox(String text) {
    for (Entity entity: ServiceLocator.getEntityService().getEntities()) {
      entity.getEvents().trigger("SetText", text);
    }
}

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally