Package fr.formiko.views
Class ViewCLI
java.lang.Object
fr.formiko.views.ViewCLI
- All Implemented Interfaces:
fr.formiko.usual.Progression
,View
View Console Line Interface.
- Author:
- Hydrolien
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Launch action game part.boolean
close()
close all the thing that need to be close after using view.boolean
endActionGame
(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.boolean
private int
getActionMenu
(int maxValue) Return an aviable action in a menu.private String
Return the color depending of the status of c for playingAnt.int
getAntChoice
(int[] t) Return the chosen value for ant action.private Fourmi
Select an ant from playingAnt anthill.getCCase()
get a CCase from the payer.transforme a String to a CCase and return it.private int
getIntBetween
(int minValue, int maxValue) Return an int between minValue & maxValue.Return the value of the looked CCase.private String
Ask a save name to the user.boolean
ini()
Initialize all the thing that need to be Initialize before using view.void
loadingMessage
(String message, int percentageDone) Print a loading message.makeUserChooseOnArray
(String[] array, String varName) Make user choose in a String array.boolean
Load the game load menu.boolean
menuMain()
Load main menu.boolean
Load new game menu.boolean
Load the options menu.boolean
personalise a game menu.void
Print a message.void
move
(ObjetSurCarteAId o, CCase from, CCase to) move ObjetSurCarteAId.boolean
paint()
Refrech actual view.int
Stop game and print the escape menu.void
popUpMessage
(String message) Print a message in a new window.popUpQuestion
(String message) Print a question in a new window.boolean
popUpQuestionYN
(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.private void
Print all action aviable in a menu.private void
Print tToPrint.private void
Print anthill of the playing ant.private void
printMap()
Print map of the actual Partie.void
setDownloadingMessage
(String message) Update downloading message.boolean
setLookedCCase
(CCase cc) Change the value of the loked Case.void
setMoveMode
(boolean b) Default fontion to move.void
set playing ant.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface fr.formiko.usual.Progression
closeLauncher, iniLauncher, setButtonRetryVisible, setDownloadingValue
Methods inherited from interface fr.formiko.views.View
centerOverCase, getMoveMode, isBladesEnable, makeUserChooseInt, popUpQuestionYN, popUpQuestionYN, waitForEndTurn
-
Field Details
-
scannerAnswer
-
tToPrint
-
cLIMap
-
sep
-
actionGameOn
private boolean actionGameOn
-
-
Constructor Details
-
ViewCLI
public ViewCLI()
-
-
Method Details
-
getActionGameOn
public boolean getActionGameOn()- Specified by:
getActionGameOn
in interfaceView
-
ini
public boolean ini()Initialize all the thing that need to be Initialize before using view. -
close
public boolean close()close all the thing that need to be close after using view. -
paint
public boolean paint()Refrech actual view. -
actionGame
public boolean actionGame()Launch action game part.- Specified by:
actionGame
in interfaceView
- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
pauseActionGame
public int pauseActionGame()Stop game and print the escape menu.
This action can only be run if action game is on.- Specified by:
pauseActionGame
in interfaceView
- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
endActionGame
public boolean endActionGame(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.
This action can only be run if action game is on.- Specified by:
endActionGame
in interfaceView
- Parameters:
withButton
- true if we need to add button "return to main menu" and "next level".nextLevel
- the number of the next level to link to the button. -1 = no next level.message
- message to print.gj
- sorted player list to print.- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
setLookedCCase
Change the value of the loked Case.
We need to repaint the information about this Case.
This action can only be run if action game is on.- Specified by:
setLookedCCase
in interfaceView
- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
getLookedCCase
Return the value of the looked CCase.
This action can only be run if action game is on and cLIMap have been created.- Specified by:
getLookedCCase
in interfaceView
- Returns:
- lookedCCase.
-
getCCase
get a CCase from the payer.
It read Strings like this: "b13", "2c"
This action can only be run if action game is on. -
getAntChoice
public int getAntChoice(int[] t) Return the chosen value for ant action.
This action can only be run if action game is on.- Specified by:
getAntChoice
in interfaceView
- Returns:
- Return ant choice.
-
message
Print a message.
If message.equals("") we may need to delete last message, but we don't need to print a new message. -
loadingMessage
Print a loading message.- Specified by:
loadingMessage
in interfaceView
- Parameters:
message
- the message to print.percentageDone
- the percentage of loading curently done.
-
popUpMessage
Print a message in a new window.- Specified by:
popUpMessage
in interfaceView
- Parameters:
message
- the message to print.
-
popUpQuestion
Print a question in a new window.- Specified by:
popUpQuestion
in interfaceView
- Parameters:
message
- the message to print.- Returns:
- the answer.
-
popUpQuestionYN
public boolean popUpQuestionYN(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.- Specified by:
popUpQuestionYN
in interfaceView
- Parameters:
message
- the message to print.important
- some gui action will be done if truecf
- CheckFunction to use to get text, default checked & launch function- Returns:
- the answer.
-
setPlayingAnt
set playing ant.
This action can only be run if action game is on.- Specified by:
setPlayingAnt
in interfaceView
-
move
move ObjetSurCarteAId.
This action can only be run if action game is on.
This action do noting on view cli. -
setDownloadingMessage
Update downloading message.- Specified by:
setDownloadingMessage
in interfacefr.formiko.usual.Progression
-
setMoveMode
public void setMoveMode(boolean b) Default fontion to move.- Specified by:
setMoveMode
in interfaceView
-
getAntFromFere
Select an ant from playingAnt anthill. -
printActionMenu
private void printActionMenu()Print all action aviable in a menu. -
printArray
private void printArray()Print tToPrint. -
printMap
private void printMap()Print map of the actual Partie. -
printFereInColor
private void printFereInColor()Print anthill of the playing ant. -
getAllyAntInColor
Return the color depending of the status of c for playingAnt.- Parameters:
c
- The Creature to inspect to know if it is ally, enemy or neutral (or equals to playingAnt).
-
getActionMenu
private int getActionMenu(int maxValue) Return an aviable action in a menu.
stop stop the game. cheat alowed to write 1 cheat code. -
getIntBetween
private int getIntBetween(int minValue, int maxValue) Return an int between minValue & maxValue.
stop stop the game. cheat alowed to write 1 cheat code. -
getSaveName
Ask a save name to the user.
If nothing is choose, save will have defaultName.
Save name will be file save for every os. -
getCCaseFromString
transforme a String to a CCase and return it.
This action can only be run if action game is on.- Parameters:
s
- String like this: "b13", "2c"- Returns:
- Selected CCase or null if it fail.
-
makeUserChooseOnArray
Make user choose in a String array.- Specified by:
makeUserChooseOnArray
in interfaceView
- Parameters:
array
- the array where to choosevarName
- the name of the variable tp choose
-