Class NpcEvictionMenuDisplayNew
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.npcEvictionMenu.NpcEvictionMenuDisplayNew
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
A Window actor for displaying the npc eviction menu.
In order to match the game, this class is rebuilt passing Window() rather than UIComponent
How to use:
NpcEvictionMenuDisplayNew var = new NpcEvictionMenuDisplayNew(...);
window.addActor(var.creatEvictionMenu());
In order to match the game, this class is rebuilt passing Window() rather than UIComponent
How to use:
NpcEvictionMenuDisplayNew var = new NpcEvictionMenuDisplayNew(...);
window.addActor(var.creatEvictionMenu());
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
Types of result dialog box -
Field Summary
Fields inherited from class com.deco2800.game.ui.UIComponent
stage
-
Constructor Summary
ConstructorsConstructorDescriptionNpcEvictionMenuDisplayNew
(org.slf4j.Logger logger, ResourceService resourceService, float width, float height, ForestGameArea gameArea, GdxGame game) Implement NpcEvictionMenu in to a Window(), use creatEvictionMenu() to get this Window() -
Method Summary
Modifier and TypeMethodDescriptionvoid
createConfirmDialog
(String button_name) Display a confirm dialog on the window, the style is based on Team7 prototype
All scales are calculated according to the prototype from team 7 only
player has 3 choices to find traitor, if all fail, the game will directly over
if correct, A key will be spawned on the map, player can pick it up and use it in the warehouse.com.badlogic.gdx.scenes.scene2d.ui.Window
return the window of Eviction Menu, use window.addActor() to add onto windowprotected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.return the errorNumhandleLogic
(String name) Handle the game logic of select the traitor
player has 3 choices to find traitor
if wrong, it will decrease the blood and time at the same timevoid
setFindKey
(Boolean findKey) Setting from other class, true if the player has found the keyMethods inherited from class com.deco2800.game.ui.UIComponent
create, getLayer, getZIndex
Methods inherited from class com.deco2800.game.rendering.RenderComponent
compareTo, dispose, render
Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.deco2800.game.rendering.Renderable
render
-
Constructor Details
-
NpcEvictionMenuDisplayNew
public NpcEvictionMenuDisplayNew(org.slf4j.Logger logger, ResourceService resourceService, float width, float height, ForestGameArea gameArea, GdxGame game) Implement NpcEvictionMenu in to a Window(), use creatEvictionMenu() to get this Window()- Parameters:
logger
- logger from ScreenresourceService
- resourceService where load/unload the textureswidth
- width of window of the Screenheight
- height of window of the Screen
-
-
Method Details
-
getErrorNum
return the errorNum- Returns:
- errorNum
-
setFindKey
Setting from other class, true if the player has found the key- Parameters:
findKey
- whether player has found the key in this game round
-
handleLogic
Handle the game logic of select the traitor
player has 3 choices to find traitor
if wrong, it will decrease the blood and time at the same time- Parameters:
name
- name of npc selected- Returns:
- NpcResultDialogType.RIGHT_BOX: if player correctly select the traitor
NpcResultDialogType.WRONG_BOX1: if player fails for the first time
NpcResultDialogType.WRONG_BOX2: if player fails for the second time
NpcResultDialogType.LOSE: if player select 3 times and all fail
NpcResultDialogType.WIN: if player have correctly select in the past
null: This is not a return result that should occur. If it does, it indicates that there is a problem with in the code
-
creatEvictionMenu
public com.badlogic.gdx.scenes.scene2d.ui.Window creatEvictionMenu()return the window of Eviction Menu, use window.addActor() to add onto window- Returns:
- the window of Eviction Menu
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
createConfirmDialog
Display a confirm dialog on the window, the style is based on Team7 prototype
All scales are calculated according to the prototype from team 7 only
player has 3 choices to find traitor, if all fail, the game will directly over
if correct, A key will be spawned on the map, player can pick it up and use it in the warehouse. The game will win
For using the key, we have written the code in the warehouse component of team 8- Parameters:
button_name
- The name of the button that calls this function- See Also:
-