Skip to content

Companion Lab window

gaurikadiwan edited this page Sep 13, 2023 · 1 revision

Introduction

Companion Lab Window allows you to explore the art of potion-making within the game. In the Lab Window, you will discover an assortment of elixirs and potions to give Companion newfound strength and resilience.

Usage

The primary purpose of the LabWindow class is to create and manage a graphical user interface window that allows players to perform actions related to potion-making and laboratory activities within the game.

Constructor

LabWindow(Texture background)

A Texture object representing the background image of the laboratory window.

Initialises a new instance of the LabWindow class with the specified background image.

Methods

MakeNewLaboratory(Entity deathpotion)

Creates a new LabWindow instance with a given Entity representing a death potion.

failLaboratory()

Call this method to exit the Laboratory without repairing the extractor.

remove()

Overrides the remove() method of the Window class to unregister input override when exiting.

Dependencies

Images (textures) are loaded using the Texture class.

The ServiceLocator class is used to access game services.

The Entity class represents game entities and its implementation.

The InputOverrideComponent class is used to override user input while the Laboratory window is open.

Implementation Details

The LabWindow class is a custom graphical user interface (GUI) window in a game, extending the LibGDX Window class. Its constructor configures the window's appearance and layout, initialising UI components, including potion buttons and an exit button, each styled using a provided Skin. Four potion buttons, labeled and associated with potion images, are added in a Table layout. Event listeners on these buttons trigger the failLaboratory() method when clicked. An InputOverrideComponent is employed to override user input while the laboratory window is open. TheLabWindowclass also includes the remove() method, unregisters the input override component, ensuring that normal user input is restored when the window is removed.

Clone this wiki locally