Class SkilltreeActions
java.lang.Object
com.badlogic.gdx.scenes.scene2d.InputListener
com.badlogic.gdx.scenes.scene2d.utils.ClickListener
com.csse3200.game.components.skilltree.SkilltreeActions
- All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.EventListener
public class SkilltreeActions
extends com.badlogic.gdx.scenes.scene2d.utils.ClickListener
SkilltreeActions is a click listener for skill tree buttons. It handles user interactions with
individual skill buttons:
-
Field Summary
Fields inherited from class com.badlogic.gdx.scenes.scene2d.utils.ClickListener
visualPressedDuration
-
Constructor Summary
ConstructorsConstructorDescriptionSkilltreeActions
(String skillName, SkillSet skillSet, com.badlogic.gdx.graphics.Texture unlockedTexture, com.badlogic.gdx.scenes.scene2d.ui.Button skillButton, com.badlogic.gdx.scenes.scene2d.Stage stage, SkilltreeDisplay display) Creates a newSkilltreeActions
listener. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clicked
(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) Called when the skill button is clicked.void
enter
(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y, int pointer, com.badlogic.gdx.scenes.scene2d.Actor fromActor) Called when the cursor enters the skill button area.void
exit
(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y, int pointer, com.badlogic.gdx.scenes.scene2d.Actor toActor) Called when the cursor exits the skill button area.Methods inherited from class com.badlogic.gdx.scenes.scene2d.utils.ClickListener
cancel, getButton, getPressedButton, getPressedPointer, getTapCount, getTapSquareSize, getTouchDownX, getTouchDownY, inTapSquare, inTapSquare, invalidateTapSquare, isOver, isOver, isPressed, isVisualPressed, setButton, setTapCount, setTapCountInterval, setTapSquareSize, setVisualPressed, touchDown, touchDragged, touchUp
Methods inherited from class com.badlogic.gdx.scenes.scene2d.InputListener
handle, keyDown, keyTyped, keyUp, mouseMoved, scrolled
-
Constructor Details
-
SkilltreeActions
public SkilltreeActions(String skillName, SkillSet skillSet, com.badlogic.gdx.graphics.Texture unlockedTexture, com.badlogic.gdx.scenes.scene2d.ui.Button skillButton, com.badlogic.gdx.scenes.scene2d.Stage stage, SkilltreeDisplay display) Creates a newSkilltreeActions
listener.- Parameters:
skillName
- the name of the skill this button representsskillSet
- the player's current skill setunlockedTexture
- texture to display once the skill is unlockedskillButton
- the button representing the skillstage
- the stage to which UI components are addeddisplay
- the skill tree display that manages popups
-
-
Method Details
-
clicked
public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y) Called when the skill button is clicked. Plays a click sound and displays the unlock popup for the associated skill.- Overrides:
clicked
in classcom.badlogic.gdx.scenes.scene2d.utils.ClickListener
- Parameters:
event
- the input eventx
- the x-coordinate of the clicky
- the y-coordinate of the click
-
enter
public void enter(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y, int pointer, com.badlogic.gdx.scenes.scene2d.Actor fromActor) Called when the cursor enters the skill button area. Plays a hover sound and scales the button up slightly for visual feedback.- Overrides:
enter
in classcom.badlogic.gdx.scenes.scene2d.utils.ClickListener
- Parameters:
event
- the input eventx
- x-coordinate of the cursory
- y-coordinate of the cursorpointer
- pointer indexfromActor
- the actor the cursor came from
-
exit
public void exit(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, float y, int pointer, com.badlogic.gdx.scenes.scene2d.Actor toActor) Called when the cursor exits the skill button area. Scales the button back to its original size.- Overrides:
exit
in classcom.badlogic.gdx.scenes.scene2d.utils.ClickListener
- Parameters:
event
- the input eventx
- x-coordinate of the cursory
- y-coordinate of the cursorpointer
- pointer indextoActor
- the actor the cursor moves to
-