Update wiki to match gradle conversion authored by Derek Williams's avatar Derek Williams
## Overview
For this wiki article we will demonstrate adding Quests and Highscore to the dropdown menu, assuming all of their UIs have already been made.
## Creating The Drop-down
Within GameClient/src/view/screen/menu/MenuUI.java, first add the label(s) of the element(s) you wish to add to the drop-down as instance variable constants (QUEST_BUTTON_TEXT and HIGHSCORE_BUTTON_TEXT below. Then, add the following method to the class, where your new constants will be set along with the preexisting ones:
## Creating The Drop-down
Within GameClient/src/main/java/view/screen/menu/MenuUI.java, first add the label(s) of the element(s) you wish to add to the drop-down as instance variable constants (QUEST_BUTTON_TEXT and HIGHSCORE_BUTTON_TEXT below. Then, add the following method to the class, where your new constants will be set along with the preexisting ones:
```java
/**
* Adds the dropown menu to the UI
* @param text - the the label of the dropdown menu
* @param listener - The listener listening to the dropdown menu
* @param clickListener - the click listener that will close the windows.
* @param clickListener - the click listener that will close the windows.
*/
public void addDropdown(String text, ChangeListener listener, ClickListener clickListener)
{
selectBox=new SelectBox<String>(skin);
selectBox.setColor(Color.GRAY);
selectBox.setItems(
QUEST_BUTTON_TEXT,
QUEST_BUTTON_TEXT,
HIGHSCORE_BUTTON_TEXT);
selectBox.addListener(listener);
selectBox.addListener(clickListener);
tabs.add(selectBox);
}
......@@ -42,10 +42,10 @@ private ChangeListener dropDownChangeListener()
return new ChangeListener()
{
@Override
public void changed(ChangeEvent event, Actor actor)
public void changed(ChangeEvent event, Actor actor)
{
String buttonText = menuArea.getSelectBox().getSelected();
String buttonText = menuArea.getSelectBox().getSelected();
switch (buttonText)
{
case "Quests":
......@@ -60,7 +60,7 @@ private ChangeListener dropDownChangeListener()
if(!highScoreToggled)
highScoreUI.toggleVisibility();
break;
}
}
}
};
}
......@@ -103,8 +103,3 @@ The drop-down will be added to the table at the top of the screen
Displaying the items inside the drop-down
![image](uploads/ecd3664ee2b550770c6316c56c93a6af/image.png)